html5_spec.html 7.6 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888
  1. <!DOCTYPE html><html data-revision="$Revision: 8753 $" lang=en-GB-x-hixie><title>HTML Standard</title><script>
  2. var loadTimer = new Date();
  3. var current_revision = "r" + document.documentElement.getAttribute('data-revision').substr(11);
  4. current_revision = current_revision.substr(0, current_revision.length - 2);
  5. var last_known_revision = current_revision;
  6. function F( /* varargs... */) {
  7. var fragment = document.createDocumentFragment();
  8. for (var index = 0; index < arguments.length; index += 1) {
  9. if (arguments[index] instanceof Array) {
  10. fragment.appendChild(F.apply(this, arguments[index]));
  11. } else if (typeof arguments[index] == 'string') {
  12. fragment.appendChild(document.createTextNode(arguments[index]));
  13. } else {
  14. fragment.appendChild(arguments[index]);
  15. }
  16. }
  17. return fragment;
  18. }
  19. function E(name, /* optional */ attributes /*, varargs... */) {
  20. var element = document.createElement(name);
  21. var index = 1;
  22. if ((arguments.length > 1) && (typeof attributes != 'string') &&
  23. (!(attributes instanceof Node)) && (!(attributes instanceof Array))) {
  24. for (var attName in attributes) {
  25. if (typeof attributes[attName] == 'boolean') {
  26. if (attributes[attName])
  27. element.setAttribute(attName, '');
  28. } else if (typeof attributes[attName] == 'function') {
  29. element[attName] = attributes[attName];
  30. } else {
  31. element.setAttribute(attName, attributes[attName]);
  32. }
  33. }
  34. index = 2;
  35. }
  36. for (; index < arguments.length; index += 1) {
  37. if (arguments[index] instanceof Array) {
  38. element.appendChild(F.apply(this, arguments[index]));
  39. } else if (typeof arguments[index] == 'string') {
  40. element.appendChild(document.createTextNode(arguments[index]));
  41. } else {
  42. element.appendChild(arguments[index]);
  43. }
  44. }
  45. return element;
  46. }
  47. function getCookie(name) {
  48. var params = location.search.substr(1).split("&");
  49. for (var index = 0; index < params.length; index++) {
  50. if (params[index] == name)
  51. return "1";
  52. var data = params[index].split("=");
  53. if (data[0] == name)
  54. return unescape(data[1]);
  55. }
  56. var cookies = document.cookie.split("; ");
  57. for (var index = 0; index < cookies.length; index++) {
  58. var data = cookies[index].split("=");
  59. if (data[0] == name)
  60. return unescape(data[1]);
  61. }
  62. return null;
  63. }
  64. var currentAlert;
  65. var currentAlertTimeout;
  66. function showAlert(s, href) {
  67. if (!currentAlert) {
  68. currentAlert = document.createElement('div');
  69. currentAlert.id = 'alert';
  70. var x = document.createElement('button');
  71. x.textContent = '\u2573';
  72. x.onclick = closeAlert2;
  73. currentAlert.appendChild(x);
  74. currentAlert.appendChild(document.createElement('span'));
  75. currentAlert.onmousemove = function () {
  76. clearTimeout(currentAlertTimeout);
  77. currentAlert.className = '';
  78. currentAlertTimeout = setTimeout(closeAlert, 10000);
  79. }
  80. document.body.appendChild(currentAlert);
  81. } else {
  82. clearTimeout(currentAlertTimeout);
  83. currentAlert.className = '';
  84. }
  85. currentAlert.lastChild.textContent = '';
  86. currentAlert.lastChild.appendChild(F(s));
  87. if (href) {
  88. var link = document.createElement('a');
  89. link.href = href;
  90. link.textContent = href;
  91. currentAlert.lastChild.appendChild(F(' ', link));
  92. }
  93. currentAlertTimeout = setTimeout(closeAlert, 10000);
  94. }
  95. function closeAlert() {
  96. clearTimeout(currentAlertTimeout);
  97. if (currentAlert) {
  98. currentAlert.className = 'closed';
  99. currentAlertTimeout = setTimeout(closeAlert2, 3000);
  100. }
  101. }
  102. function closeAlert2() {
  103. clearTimeout(currentAlertTimeout);
  104. if (currentAlert) {
  105. currentAlert.parentNode.removeChild(currentAlert);
  106. currentAlert = null;
  107. }
  108. }
  109. window.addEventListener('keydown', function (event) {
  110. if (event.keyCode == 27) {
  111. if (currentAlert)
  112. closeAlert2();
  113. } else {
  114. closeAlert();
  115. }
  116. }, false);
  117. window.addEventListener('scroll', function (event) {
  118. closeAlert();
  119. }, false);
  120. function load(script) {
  121. var e = document.createElement('script');
  122. e.setAttribute('src', '//www.whatwg.org/specs/web-apps/current-work/' + script);
  123. document.body.appendChild(e);
  124. }
  125. var startedInit = 0;
  126. function init() {
  127. startedInit = 1;
  128. if (location.search == '?slow-browser')
  129. return;
  130. load('reviewer.js');
  131. if (document.documentElement.className == "big" || document.documentElement.className == "big split index")
  132. load('toc.js');
  133. load('updater.js');
  134. load('dfn.js');
  135. load('status.js');
  136. if (getCookie('profile') == '1')
  137. document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
  138. }
  139. if (document.documentElement.className == "")
  140. setTimeout(function () {
  141. if (!startedInit)
  142. showAlert("Too slow? Try reading the multipage copy of the spec instead:", "http://whatwg.org/html");
  143. }, 6000);
  144. window.addEventListener('keypress', function (event) {
  145. if ((event.which == 114) && (event.metaKey)) {
  146. if (!confirm('Are you sure you want to reload this page?'))
  147. event.preventDefault();
  148. }
  149. }, false);
  150. </script><link rel=stylesheet href=//www.whatwg.org/style/specification><link rel=icon href=//www.whatwg.org/images/icon><style>
  151. .proposal { border: blue solid; padding: 1em; }
  152. .bad, .bad *:not(.X\58X) { color: gray; border-color: gray; background: transparent; }
  153. #updatesStatus { display: none; z-index: 10; }
  154. #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; }
  155. div.head .logo { width: 11em; margin-bottom: 20em; }
  156. #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; }
  157. #configUI p { margin: 0.75em 0; padding: 0.3em; }
  158. #configUI p label { display: block; }
  159. #configUI #updateUI, #configUI .loginUI { text-align: center; }
  160. #configUI input[type=button] { display: block; margin: auto; }
  161. #configUI :link, #configUI :visited { color: white; }
  162. #configUI :link:hover, #configUI :visited:hover { background: transparent; }
  163. #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; }
  164. #alert.closed { opacity: 0; }
  165. #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; }
  166. #alert :link, #alert :visited { color: white; }
  167. #alert :link:hover, #alert :visited:hover { background: transparent; }
  168. @media print { #configUI { display: none; } }
  169. .rfc2119 { font-variant: small-caps; text-shadow: 0 0 0.5em yellow; position: static; }
  170. .rfc2119::after { position: absolute; left: 0; width: 25px; text-align: center; color: yellow; text-shadow: 0.075em 0.075em 0.2em black; }
  171. .rfc2119.m\ust::after { content: '\2605'; }
  172. .rfc2119.s\hould::after { content: '\2606'; }
  173. [hidden] { display: none; }
  174. .fingerprint { float: right; }
  175. .applies .yes { background: yellow; }
  176. </style><style>
  177. .applies thead th > * { display: block; }
  178. .applies thead code { display: block; }
  179. .applies td { text-align: center; }
  180. .matrix, .matrix td { border: hidden; text-align: right; }
  181. .matrix { margin-left: 2em; }
  182. .vertical-summary-table tr > th[rowspan="2"]:first-child + th,
  183. .vertical-summary-table tr > td[rowspan="2"]:first-child + td { border-bottom: hidden; }
  184. .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
  185. .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
  186. .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
  187. td.eg { border-width: thin; text-align: center; }
  188. #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
  189. #table-example-1 caption { padding-bottom: 0.5em; }
  190. #table-example-1 thead, #table-example-1 tbody { border: none; }
  191. #table-example-1 th, #table-example-1 td { border: solid thin; }
  192. #table-example-1 th { font-weight: normal; }
  193. #table-example-1 td { border-style: none solid; vertical-align: top; }
  194. #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
  195. #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
  196. #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
  197. #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
  198. #table-example-1 tbody td:first-child::after { content: leader(". "); }
  199. #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
  200. #table-example-1 tbody td:first-child + td { width: 10em; }
  201. #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
  202. #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
  203. .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
  204. .apple-table-examples * { font-family: "Times", serif; }
  205. .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
  206. .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
  207. .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
  208. .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
  209. .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
  210. .apple-table-examples td { text-align: right; vertical-align: top; }
  211. .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
  212. .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
  213. .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
  214. .apple-table-examples sup { line-height: 0; }
  215. .three-column-nowrap tr > td:first-child,
  216. .three-column-nowrap tr > td:first-child + td,
  217. .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; }
  218. .details-example img { vertical-align: top; }
  219. #base64-table {
  220. white-space: nowrap;
  221. font-size: 0.6em;
  222. column-width: 6em;
  223. column-count: 5;
  224. column-gap: 1em;
  225. -moz-column-width: 6em;
  226. -moz-column-count: 5;
  227. -moz-column-gap: 1em;
  228. -webkit-column-width: 6em;
  229. -webkit-column-count: 5;
  230. -webkit-column-gap: 1em;
  231. }
  232. #base64-table thead { display: none; }
  233. #base64-table * { border: none; }
  234. #base64-table tbody td:first-child:after { content: ':'; }
  235. #base64-table tbody td:last-child { text-align: right; }
  236. #named-character-references-table {
  237. white-space: nowrap;
  238. font-size: 0.6em;
  239. column-width: 30em;
  240. column-gap: 1em;
  241. -moz-column-width: 30em;
  242. -moz-column-gap: 1em;
  243. -webkit-column-width: 30em;
  244. -webkit-column-gap: 1em;
  245. }
  246. #named-character-references-table > table > tbody > tr > td:first-child + td,
  247. #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
  248. #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; }
  249. #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
  250. .glyph.control { color: red; }
  251. </style><style>
  252. #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
  253. @font-face {
  254. font-family: 'Essays1743';
  255. src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
  256. }
  257. @font-face {
  258. font-family: 'Essays1743';
  259. font-weight: bold;
  260. src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
  261. }
  262. @font-face {
  263. font-family: 'Essays1743';
  264. font-style: italic;
  265. src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
  266. }
  267. @font-face {
  268. font-family: 'Essays1743';
  269. font-style: italic;
  270. font-weight: bold;
  271. src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
  272. }
  273. </style><link rel=stylesheet href=status.css><body onload=init()>
  274. <header id=head class="head with-buttons">
  275. <p><a href=//www.whatwg.org/ class=logo><img src=/images/logo width=101 alt=WHATWG height=101></a></p>
  276. <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>
  277. <nav>
  278. <div>
  279. <a href=//whatwg.org/html><span><strong>Multipage Version</strong> <code>whatwg.org/html</code></span></a>
  280. <a href=//whatwg.org/c><span><strong>One-Page Version</strong> <code>whatwg.org/c</code></span></a>
  281. <a href=//whatwg.org/pdf><span><strong>PDF Version</strong> <code>whatwg.org/pdf</code></span></a>
  282. <a href=http://developers.whatwg.org/><span><strong>Developer Version</strong> <code>developers.whatwg.org</code></span></a>
  283. </div>
  284. <div>
  285. <a href=//whatwg.org/faq class=misc><span><strong>FAQ</strong> <code>whatwg.org/faq</code></span></a>
  286. <a href=http://validator.whatwg.org/ class=misc><span><strong>Validators</strong> <code>validator.whatwg.org</code></span></a>
  287. </div>
  288. <div>
  289. <a href=//www.whatwg.org/mailing-list class=comms><span><strong>Join our Mailing List</strong> <code>whatwg@whatwg.org</code></span></a>
  290. <a href=http://wiki.whatwg.org/wiki/IRC class=comms><span><strong>Join us on IRC</strong> <code>#whatwg on Freenode</code></span></a>
  291. <a href=http://forums.whatwg.org/ class=comms><span><strong>Join our Forums</strong> <code>forums.whatwg.org</code></span></a>
  292. </div>
  293. <div>
  294. <a href=http://html5.org/tools/web-apps-tracker class=changes><span><strong>Change Log</strong> <code>html5.org's tracker</code></span></a>
  295. <a href=http://twitter.com/WHATWG class=changes><span><strong>Twitter Updates</strong> <code>@WHATWG</code></span></a>
  296. </div>
  297. <div>
  298. <a href="https://www.w3.org/Bugs/Public/buglist.cgi?bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;component=HTML&amp;product=WHATWG" class=feedback><span><strong>View Open Bugs</strong> <code>filed in Bugzilla</code></span></a>
  299. <a href=//www.whatwg.org/newbug class=feedback><span><strong>File a Bug</strong> <code>whatwg.org/newbug</code></span></a>
  300. <a href=http://ian.hixie.ch/+ class=feedback><span><strong>E-mail the Editor</strong> <code>ian@hixie.ch</code></span></a>
  301. </div>
  302. </nav>
  303. </header>
  304. <hr>
  305. <div id=configUI></div>
  306. <h2 id=contents class="no-num no-toc">Table of contents</h2>
  307. <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
  308. <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
  309. 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
  310. 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
  311. 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
  312. 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>
  313. 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
  314. 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: &lt;b>&lt;i>&lt;/b>&lt;/i></a><li><a href=#misnested-tags:-b-p-/b-/p>12.2.8.2 Misnested tags: &lt;b>&lt;p>&lt;/b>&lt;/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>
  315. <h2 id=introduction>1 Introduction</h2>
  316. <h3 id=abstract>1.1 Where does this specification fit?</h3>
  317. <p>This specification defines a big part of the Web platform, in lots of detail. Its place in the
  318. Web platform specification stack relative to other specifications can be best summed up as
  319. follows:</p>
  320. <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>
  321. <h3 id=is-this-html5?>1.2 Is this HTML5?</h3>
  322. <p><i>This section is non-normative.</i></p>
  323. <p>In short: Yes.</p>
  324. <p>In more length: The term "HTML5" is widely used as a buzzword to refer to modern Web
  325. technologies, many of which (though by no means all) are developed at the WHATWG. This document is
  326. one such; others are available from <a href=http://www.whatwg.org/specs/>the WHATWG
  327. specification index</a>.</p>
  328. <p class=note>Although we have asked them to stop doing so, the W3C also republishes some parts
  329. of this specification as separate documents. There are numerous differences between this
  330. specification and the W3C forks; some minor, some major. Unfortunately these are not currently
  331. accurately documented anywhere, so there is no way to know which are intentional and which are
  332. not.</p>
  333. <h3 id=background>1.3 Background</h3>
  334. <p><i>This section is non-normative.</i></p>
  335. <p>HTML is the World Wide Web's core markup language. Originally, HTML was primarily designed as a
  336. language for semantically describing scientific documents. Its general design, however, has
  337. enabled it to be adapted, over the subsequent years, to describe a number of other types of
  338. documents and even applications.</p>
  339. <h3 id=audience>1.4 Audience</h3>
  340. <p><i>This section is non-normative.</i></p>
  341. <p>This specification is intended for authors of documents and scripts that use the features
  342. defined in this specification, implementors of tools that operate on pages that
  343. use the features defined in this specification, and individuals wishing to establish the
  344. correctness of documents or implementations with respect to the requirements of this
  345. specification.</p>
  346. <p>This document is probably not suited to readers who do not already have at least a passing
  347. familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity
  348. for completeness. More approachable tutorials and authoring guides can provide a gentler
  349. introduction to the topic.</p>
  350. <p>In particular, familiarity with the basics of DOM is necessary for a complete understanding of
  351. some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML,
  352. Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not
  353. essential.</p>
  354. <h3 id=scope>1.5 Scope</h3>
  355. <p><i>This section is non-normative.</i></p>
  356. <p>This specification is limited to providing a semantic-level markup language and associated
  357. semantic-level scripting APIs for authoring accessible pages on the Web ranging from static
  358. documents to dynamic applications.</p>
  359. <p>The scope of this specification does not include providing mechanisms for media-specific
  360. customization of presentation (although default rendering rules for Web browsers are included at
  361. the end of this specification, and several mechanisms for hooking into CSS are provided as part of
  362. the language).</p>
  363. <p>The scope of this specification is not to describe an entire operating system. In particular,
  364. hardware configuration software, image manipulation tools, and applications that users would be
  365. expected to use with high-end workstations on a daily basis are out of scope. In terms of
  366. applications, this specification is targeted specifically at applications that would be expected
  367. to be used by users on an occasional basis, or regularly but from disparate locations, with low
  368. CPU requirements. Examples of such applications include online purchasing systems, searching
  369. systems, games (especially multiplayer online games), public telephone books or address books,
  370. communications software (e-mail clients, instant messaging clients, discussion software), document
  371. editing software, etc.</p>
  372. <h3 id=history-2>1.6 History</h3>
  373. <p><i>This section is non-normative.</i></p>
  374. <p>For its first five years (1990-1995), HTML went through a number of revisions and experienced a
  375. number of extensions, primarily hosted first at CERN, and then at the IETF.</p>
  376. <p>With the creation of the W3C, HTML's development changed venue again. A first abortive attempt
  377. at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as
  378. HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year.</p>
  379. <p>The following year, the W3C membership decided to stop evolving HTML and instead begin work on
  380. an XML-based equivalent, called XHTML. This
  381. effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new
  382. features except the new serialisation, and which was completed in 2000. After XHTML 1.0, the W3C's
  383. focus turned to making it easier for other working groups to extend XHTML, under the banner of
  384. XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not
  385. compatible with the earlier HTML and XHTML languages, calling it XHTML2.</p>
  386. <p>Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed
  387. by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level
  388. 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered
  389. out, with some DOM Level 3 specifications published in 2004 but the working group being closed
  390. before all the Level 3 drafts were completed.</p>
  391. <p>In 2003, the publication of XForms, a technology which was positioned as the next generation of
  392. Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements
  393. for it. This interest was borne from the realization that XML's deployment as a Web technology was
  394. limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for
  395. existing deployed technologies (like HTML).</p>
  396. <p>A proof of concept to show that it was possible to extend HTML4's forms to provide many of the
  397. features that XForms 1.0 introduced, without requiring browsers to implement rendering engines
  398. that were incompatible with existing HTML Web pages, was the first result of this renewed
  399. interest. At this early stage, while the draft was already publicly available, and input was
  400. already being solicited from all sources, the specification was only under Opera Software's
  401. copyright.</p>
  402. <p>The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where
  403. some of the principles that underlie the HTML5 work (described below), as well as the
  404. aforementioned early draft proposal covering just forms-related features, were presented to the
  405. W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal
  406. conflicted with the previously chosen direction for the Web's evolution; the W3C staff and
  407. membership voted to continue developing XML-based replacements instead.</p>
  408. <p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue
  409. working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list
  410. was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to
  411. be jointly owned by all three vendors, and to allow reuse of the specification.</p>
  412. <p>The WHATWG was based on several core principles, in particular that technologies need to be
  413. backwards compatible, that specifications and implementations need to match even if this means
  414. changing the specification rather than the implementations, and that specifications need to be
  415. detailed enough that implementations can achieve complete interoperability without
  416. reverse-engineering each other.</p>
  417. <p>The latter requirement in particular required that the scope of the HTML5 specification include
  418. what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It
  419. also meant including significantly more detail than had previously been considered the norm.</p>
  420. <p>In 2006, the W3C indicated an interest to participate in the development of HTML5 after all,
  421. and in 2007 formed a working group chartered to work with the WHATWG on the development of the
  422. HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under
  423. the W3C copyright, while keeping a version with the less restrictive license on the WHATWG
  424. site.</p>
  425. <p>For a number of years, both groups then worked together. In 2011, however, the groups came to
  426. the conclusion that they had different goals: the W3C wanted to publish a "finished" version of
  427. "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously
  428. maintaining the specification rather than freezing it in a state with known problems, and adding
  429. new features as needed to evolve the platform.</p>
  430. <p>Since then, the WHATWG has been working on this specification (amongst others), and the W3C has
  431. been copying fixes made by the WHATWG into their fork of the document, as well as making other
  432. changes, some intentional and some not, with no documentation listing or explaining the
  433. differences.</p>
  434. <h3 id=design-notes>1.7 Design notes</h3>
  435. <p><i>This section is non-normative.</i></p>
  436. <p>It must be admitted that many aspects of HTML appear at first glance to be nonsensical and
  437. inconsistent.</p>
  438. <p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been
  439. developed over a period of several decades by a wide array of people with different priorities
  440. who, in many cases, did not know of each other's existence.</p>
  441. <p>Features have thus arisen from many sources, and have not always been designed in especially
  442. consistent ways. Furthermore, because of the unique characteristics of the Web, implementation
  443. bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally
  444. written in ways that rely on them before they can be fixed.</p>
  445. <p>Despite all this, efforts have been made to adhere to certain design goals. These are described
  446. in the next few subsections.</p>
  447. <h4 id=serialisability-of-script-execution>1.7.1 Serialisability of script execution</h4>
  448. <p><i>This section is non-normative.</i></p>
  449. <p>To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are
  450. designed such that no script can ever detect the simultaneous execution of other scripts. Even
  451. with <a href=#worker id=serialisability-of-script-execution:worker>workers</a>, the intent is that the behavior of implementations can
  452. 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>
  453. <p class=note>The <code id=serialisability-of-script-execution:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method, in
  454. this model, is equivalent to allowing other scripts to run while the calling script is
  455. blocked.</p>
  456. <h4 id=compliance-with-other-specifications>1.7.2 Compliance with other specifications</h4>
  457. <p><i>This section is non-normative.</i></p>
  458. <p>This specification interacts with and relies on a wide variety of other specifications. In
  459. certain circumstances, unfortunately, conflicting needs have led to this specification violating
  460. the requirements of these other specifications. Whenever this has occurred, the transgressions
  461. have each been noted as a "<dfn id=willful-violation>willful violation</dfn>", and the reason for the violation has
  462. been noted.</p>
  463. <h4 id=extensibility>1.7.3 Extensibility</h4>
  464. <p><i>This section is non-normative.</i></p>
  465. <p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a
  466. safe manner:</p>
  467. <ul><li><p>Authors can use the <code id=extensibility:classes><a href=#classes>class</a></code> attribute to extend elements,
  468. effectively creating their own elements, while using the most applicable existing "real" HTML
  469. element, so that browsers and other tools that don't know of the extension can still support it
  470. 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
  471. to process using the <code id=extensibility:attr-data-*><a href=#attr-data-*>data-*=""</a></code> attributes. These are guaranteed
  472. to never be touched by browsers, and allow scripts to include data on HTML elements that scripts
  473. can then look for and process.<li><p>Authors can use the <code id=extensibility:the-meta-element><a href=#the-meta-element>&lt;meta name="" content=""></a></code> mechanism to
  474. include page-wide metadata by registering <a href=#concept-meta-extensions id=extensibility:concept-meta-extensions>extensions to
  475. 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
  476. links with specific meanings by registering <a href=#concept-rel-extensions id=extensibility:concept-rel-extensions>extensions to
  477. 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>&lt;script type=""></a></code>
  478. 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
  479. <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
  480. 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>
  481. attributes) to embed nested name-value pairs of data to be shared with other applications and
  482. sites.</ul>
  483. <h3 id=html-vs-xhtml>1.8 HTML vs XHTML</h3>
  484. <p><i>This section is non-normative.</i></p>
  485. <p>This specification defines an abstract language for describing documents and applications, and
  486. some APIs for interacting with in-memory representations of resources that use this language.</p>
  487. <p>The in-memory representation is known as "DOM HTML", or "the DOM" for short.</p>
  488. <p>There are various concrete syntaxes that can be used to transmit resources that use this
  489. abstract language, two of which are defined in this specification.</p>
  490. <p>The first such concrete syntax is the HTML syntax. This is the format suggested for most
  491. authors. It is compatible with most legacy Web browsers. If a document is transmitted with the
  492. <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
  493. Web browsers. This specification defines the latest HTML syntax, known simply as "HTML".</p>
  494. <p>The second concrete syntax is the XHTML syntax, which is an application of XML. When a document
  495. 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>,
  496. then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors
  497. are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors
  498. will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in
  499. the HTML syntax. This specification defines the latest XHTML syntax, known simply as "XHTML".</p>
  500. <p>The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For
  501. example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM
  502. 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
  503. represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax.
  504. Comments that contain the string "<code>--></code>" can only be represented in the
  505. DOM, not in the HTML and XHTML syntaxes.</p>
  506. <h3 id=structure-of-this-specification>1.9 Structure of this specification</h3>
  507. <p><i>This section is non-normative.</i></p>
  508. <p>This specification is divided into the following major sections:</p>
  509. <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
  510. 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
  511. defines the features of this DOM, as well as introducing the features common to all elements, and
  512. 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
  513. on how to use the element, along with user agent requirements for how to
  514. handle each element, are also given. This includes large signature features of HTML such
  515. as video playback and subtitles, form controls and form submission, and a 2D graphics API known
  516. as the HTML canvas.<dt><a href=#microdata>Microdata</a><dd>This specification introduces a mechanism for adding machine-readable annotations to
  517. documents, so that tools can extract trees of name-value pairs from the document. This section
  518. describes this mechanism and some algorithms that can be used to convert HTML
  519. documents into other formats. This section also defines some sample Microdata vocabularies
  520. 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
  521. 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
  522. that affect environments that deal with multiple pages, such as Web browsers and offline
  523. 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
  524. communicate with other applications from different domains running on the same client. It also
  525. introduces a server-push event stream mechanism known as Server Sent Events or
  526. <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
  527. Sockets.
  528. <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
  529. 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>
  530. <p>There are also some appendices, listing <a href=#obsolete>obsolete features</a> and <a href=#iana>IANA considerations</a>, and several indices.</p>
  531. <h4 id=how-to-read-this-specification>1.9.1 How to read this specification</h4>
  532. <p>This specification should be read like all other specifications. First, it should be read
  533. cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be
  534. read by picking random sections from the contents list and following all the cross-references.</p>
  535. <p>As described in the conformance requirements section below, this specification describes
  536. conformance criteria for a variety of conformance classes. In particular, there are conformance
  537. requirements that apply to <em>producers</em>, for example authors and the documents they create,
  538. and there are conformance requirements that apply to <em>consumers</em>, for example Web browsers.
  539. They can be distinguished by what they are requiring: a requirement on a producer states what is
  540. allowed, while a requirement on a consumer states how software is to act.</p>
  541. <div class=example>
  542. <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
  543. integer</a>" is a requirement on producers, as it lays out the allowed values; in contrast,
  544. the requirement "the <code>foo</code> attribute's value must be parsed using the
  545. <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
  546. process the content.</p>
  547. </div>
  548. <p><strong>Requirements on producers have no bearing whatsoever on consumers.</strong></p>
  549. <div class=example>
  550. <p>Continuing the above example, a requirement stating that a particular attribute's value is
  551. 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
  552. about the requirements on consumers. It might be that the consumers are in fact required to treat
  553. the attribute as an opaque string, completely unaffected by whether the value conforms to the
  554. requirements or not. It might be (as in the previous example) that the consumers are required to
  555. parse the value using specific rules that define how invalid (non-numeric in this case) values
  556. are to be processed.</p>
  557. </div>
  558. <h4 id=typographic-conventions>1.9.2 Typographic conventions</h4>
  559. <p>This is a definition, requirement, or explanation.</p>
  560. <p class=note>This is a note.</p>
  561. <p class=example>This is an example.</p>
  562. <p class=XXX>This is an open issue.</p>
  563. <p class=warning>This is a warning.</p>
  564. <pre class="idl extract">interface <dfn>Example</dfn> {
  565. // this is an IDL definition
  566. };</pre>
  567. <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>
  568. <p>This is a note to authors describing the usage of an interface.</p>
  569. </dl>
  570. <pre class=css>/* this is a CSS fragment */</pre>
  571. <p>The defining instance of a term is marked up like <dfn id=x-this>this</dfn>. Uses of that
  572. 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>
  573. <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
  574. like <code id=typographic-conventions:x-that-2><a href=#x-that>this</a></code>.</p>
  575. <p>Other code fragments are marked up <code>like this</code>.</p>
  576. <p>Variables are marked up like <var>this</var>.</p>
  577. <p>In an algorithm, steps in <a href=#synchronous-section id=typographic-conventions:synchronous-section>synchronous
  578. sections</a> are marked with ⌛.</p>
  579. <p>In some cases, requirements are given in the form of lists with conditions and corresponding
  580. requirements. In such cases, the requirements that apply to a condition are always the first set
  581. of requirements that follow the condition, even in the case of there being multiple sets of
  582. conditions for those requirements. Such cases are presented as follows:</p>
  583. <dl class=switch><dt>This is a condition
  584. <dt>This is another condition
  585. <dd>This is the requirement that applies to the conditions above.
  586. <dt>This is a third condition
  587. <dd>This is the requirement that applies to the third condition.
  588. </dl>
  589. <h3 id=fingerprint>1.10 Privacy concerns</h3>
  590. <p><i>This section is non-normative.</i></p>
  591. <p>Some features of HTML trade user convenience for a measure of user privacy.</p>
  592. <p>In general, due to the Internet's architecture, a user can be distinguished from another by the
  593. user's IP address. IP addresses do not perfectly match to a user; as a user moves from device to
  594. device, or from network to network, their IP address will change; similarly, NAT routing, proxy
  595. servers, and shared computers enable packets that appear to all come from a single IP address to
  596. actually map to multiple users. Technologies such as onion routing can be used to further
  597. anonymise requests so that requests from a single user at one node on the Internet appear to come
  598. from many disparate parts of the network.</p>
  599. <p>However, the IP address used for a user's requests is not the only mechanism by which a user's
  600. requests could be related to each other. Cookies, for example, are designed specifically to enable
  601. this, and are the basis of most of the Web's session features that enable you to log into a site
  602. with which you have an account.</p>
  603. <p>There are other mechanisms that are more subtle. Certain characteristics of a user's system can
  604. be used to distinguish groups of users from each other; by collecting enough such information, an
  605. individual user's browser's "digital fingerprint" can be computed, which can be as good, if not
  606. better, as an IP address in ascertaining which requests are from the same user.</p>
  607. <p>Grouping requests in this manner, especially across multiple sites, can be used for both benign
  608. (and even arguably positive) purposes, as well as for malevolent purposes. An example of a
  609. reasonably benign purpose would be determining whether a particular person seems to prefer sites
  610. with dog illustrations as opposed to sites with cat illustrations (based on how often they visit
  611. the sites in question) and then automatically using the preferred illustrations on subsequent
  612. visits to participating sites. Malevolent purposes, however, could include governments combining
  613. information such as the person's home address (determined from the addresses they use when getting
  614. driving directions on one site) with their apparent political affiliations (determined by
  615. examining the forum sites that they participate in) to determine whether the person should be
  616. prevented from voting in an election.</p>
  617. <p>Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to
  618. consider how to provide their users with tools to minimise leaking information that could be used
  619. to fingerprint a user.</p>
  620. <p>Unfortunately, as the first paragraph in this section implies, sometimes there is great benefit
  621. to be derived from exposing the very information that can also be used for fingerprinting
  622. purposes, so it's not as easy as simply blocking all possible leaks. For instance, the ability to
  623. log into a site to post under a specific identity requires that the user's requests be
  624. identifiable as all being from the same user, more or less by definition. More subtly, though,
  625. information such as how wide text is, which is necessary for many effects that involve drawing
  626. text onto a canvas (e.g. any effect that involves drawing a border around the text) also leaks
  627. information that can be used to group a user's requests. (In this case, by potentially exposing,
  628. via a brute force search, which fonts a user has installed, information which can vary
  629. considerably from user to user.)</p>
  630. <p>Features in this specification which can be <dfn id=fingerprinting-vector>used to
  631. fingerprint the user</dfn> are marked as this paragraph is.
  632. <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>
  633. </p>
  634. <p>Other features in the platform can be used for the same purpose, though, including, though not
  635. limited to:</p>
  636. <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>
  637. object. <a href=#refsMQ>[MQ]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a><li>The user's time zone.</ul>
  638. <h4 id=fingerprint-postMessage>1.10.1 Cross-site communication</h4>
  639. <p>The <code id=fingerprint-postMessage:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> API provides a mechanism by
  640. which two sites can communicate directly. At first glance, this might appear to open a new way by
  641. which the problems described above can occur. However, in practice, multiple mechanisms exist by
  642. which two sites can communicate that predate this API: a site embedding another can send data via
  643. 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
  644. unique identifier known to the server to initiate a server-side data exchange; or indeed the
  645. fingerprinting techniques described above can be used by two sites to uniquely identify a visitor
  646. such that information can then be exchanged on the server side.</p>
  647. <p>Fundamentally, users that do not trust a site to treat their information with respect have to
  648. avoid visiting that site at all.</p>
  649. <h3 id=a-quick-introduction-to-html>1.11 A quick introduction to HTML</h3>
  650. <p><i>This section is non-normative.</i></p>
  651. <p>A basic HTML document looks like this:</p>
  652. <pre id=intro-early-example>&lt;!DOCTYPE html>
  653. &lt;html>
  654. &lt;head>
  655. &lt;title>Sample page&lt;/title>
  656. &lt;/head>
  657. &lt;body>
  658. &lt;h1>Sample page&lt;/h1>
  659. &lt;p>This is a &lt;a href="demo.html">simple&lt;/a> sample.&lt;/p>
  660. &lt;!-- this is a comment -->
  661. &lt;/body>
  662. &lt;/html></pre>
  663. <p>HTML documents consist of a tree of elements and text. Each element is denoted in the source by
  664. a <a href=#syntax-start-tag id=a-quick-introduction-to-html:syntax-start-tag>start tag</a>, such as "<code>&lt;body></code>", and
  665. an <a href=#syntax-end-tag id=a-quick-introduction-to-html:syntax-end-tag>end tag</a>, such as "<code>&lt;/body></code>".
  666. (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>
  667. <p>Tags have to be nested such that elements are all completely within each other, without
  668. overlapping:</p>
  669. <pre class=bad>&lt;p>This is &lt;em>very &lt;strong>wrong&lt;/em>!&lt;/strong>&lt;/p></pre>
  670. <pre>&lt;p>This &lt;em>is &lt;strong>correct&lt;/strong>.&lt;/em>&lt;/p></pre>
  671. <p>This specification defines a set of elements that can be used in HTML, along with rules about
  672. the ways in which the elements can be nested.</p>
  673. <p>Elements can have attributes, which control how the elements work. In the example below, there
  674. 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>
  675. <pre>&lt;a href="demo.html">simple&lt;/a></pre>
  676. <p><a href=#syntax-attributes id=a-quick-introduction-to-html:syntax-attributes>Attributes</a> are placed inside the start tag, and consist
  677. 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.
  678. 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>&lt;</code> or
  679. <code>></code>. Otherwise, it has to be quoted using either single or double quotes.
  680. The value, along with the "<code>=</code>" character, can be omitted altogether if the
  681. value is the empty string.</p>
  682. <pre>&lt;!-- empty attributes -->
  683. &lt;input name=address disabled>
  684. &lt;input name=address disabled="">
  685. &lt;!-- attributes with a value -->
  686. &lt;input name=address maxlength=200>
  687. &lt;input name=address maxlength='200'>
  688. &lt;input name=address maxlength="200"></pre>
  689. <p>HTML user agents (e.g. Web browsers) then <i>parse</i> this markup, turning it into a DOM
  690. (Document Object Model) tree. A DOM tree is an in-memory representation of a document.</p>
  691. <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,
  692. <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
  693. <code id=a-quick-introduction-to-html:processinginstruction><a href=#processinginstruction>ProcessingInstruction</a></code> nodes.</p>
  694. <p>The <a href=#intro-early-example>markup snippet at the top of this section</a> would be
  695. turned into the following DOM tree:</p>
  696. <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>
  697. <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
  698. 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>
  699. 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>
  700. <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,
  701. because the source contains a number of spaces (represented here by "␣") and line breaks
  702. ("⏎") 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
  703. reasons not all of the spaces and line breaks in the original markup appear in the DOM. In
  704. 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,
  705. 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
  706. <code id=a-quick-introduction-to-html:the-body-element-4><a href=#the-body-element>body</a></code>.</p>
  707. <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
  708. <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
  709. 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>
  710. <hr>
  711. <p>This DOM tree can be manipulated from scripts in the page. Scripts (typically in JavaScript)
  712. 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
  713. handler content attributes</a>. For example, here is a form with a script that sets the value
  714. 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>
  715. <pre>&lt;<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">
  716. Result: &lt;<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">&lt;/output>
  717. &lt;<a href=#the-script-element id=a-quick-introduction-to-html:the-script-element-2>script</a>>
  718. <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';
  719. &lt;/script>
  720. &lt;/form></pre>
  721. <p>Each element in the DOM tree is represented by an object, and these objects have APIs so that
  722. 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)
  723. 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
  724. ways:</p>
  725. <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
  726. 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
  727. 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
  728. a.setAttribute('href', 'http://example.com/'); // change the content attribute directly</pre>
  729. <p>Since DOM trees are used as the way to represent HTML documents when they are processed and
  730. presented by implementations (especially interactive implementations like Web browsers), this
  731. specification is mostly phrased in terms of DOM trees, instead of the markup described above.</p>
  732. <hr>
  733. <p>HTML documents represent a media-independent description of interactive content. HTML documents
  734. might be rendered to a screen, or through a speech synthesiser, or on a braille display. To
  735. influence exactly how such rendering takes place, authors can use a styling language such as
  736. CSS.</p>
  737. <p>In the following example, the page has been made yellow-on-blue using CSS.</p>
  738. <pre>&lt;!DOCTYPE html>
  739. &lt;html>
  740. &lt;head>
  741. &lt;title>Sample styled page&lt;/title>
  742. &lt;style>
  743. body { background: navy; color: yellow; }
  744. &lt;/style>
  745. &lt;/head>
  746. &lt;body>
  747. &lt;h1>Sample styled page&lt;/h1>
  748. &lt;p>This page is just a demo.&lt;/p>
  749. &lt;/body>
  750. &lt;/html></pre>
  751. <p>For more details on how to use HTML, authors are encouraged to consult tutorials and guides.
  752. Some of the examples included in this specification might also be of use, but the novice author is
  753. cautioned that this specification, by necessity, defines the language with a level of detail that
  754. might be difficult to understand at first.</p>
  755. <h4 id=writing-secure-applications-with-html>1.11.1 Writing secure applications with HTML</h4>
  756. <p><i>This section is non-normative.</i></p>
  757. <p>When HTML is used to create interactive sites, care needs to be taken to avoid introducing
  758. vulnerabilities through which attackers can compromise the integrity of the site itself or of the
  759. site's users.</p>
  760. <p>A comprehensive study of this matter is beyond the scope of this document, and authors are
  761. strongly encouraged to study the matter in more detail. However, this section attempts to provide
  762. a quick introduction to some common pitfalls in HTML application development.</p>
  763. <p>The security model of the Web is based on the concept of "origins", and correspondingly many of
  764. the potential attacks on the Web involve cross-origin actions. <a href=#refsORIGIN>[ORIGIN]</a></p>
  765. <dl><dt>Not validating user input<dt>Cross-site scripting (XSS)<dt>SQL injection<dd>
  766. <p>When accepting untrusted input, e.g. user-generated content such as text comments, values in
  767. URL parameters, messages from third-party sites, etc, it is imperative that the data be
  768. validated before use, and properly escaped when displayed. Failing to do this can allow a
  769. hostile user to perform a variety of attacks, ranging from the potentially benign, such as
  770. providing bogus user information like a negative age, to the serious, such as running scripts
  771. every time a user looks at a page that includes the information, potentially propagating the
  772. attack in the process, to the catastrophic, such as deleting all data in the server.</p>
  773. <p>When writing filters to validate user input, it is imperative that filters always be
  774. whitelist-based, allowing known-safe constructs and disallowing all other input. Blacklist-based
  775. filters that disallow known-bad inputs and allow everything else are not secure, as not
  776. everything that is bad is yet known (for example, because it might be invented in the
  777. future).</p>
  778. <div class=example>
  779. <p>For example, suppose a page looked at its URL's query string to determine what to display,
  780. and the site then redirected the user to that page to display a message, as in:</p>
  781. <pre>&lt;ul>
  782. &lt;li>&lt;a href="message.cgi?say=Hello">Say Hello&lt;/a>
  783. &lt;li>&lt;a href="message.cgi?say=Welcome">Say Welcome&lt;/a>
  784. &lt;li>&lt;a href="message.cgi?say=Kittens">Say Kittens&lt;/a>
  785. &lt;/ul></pre>
  786. <p>If the message was just displayed to the user without escaping, a hostile attacker could
  787. then craft a URL that contained a script element:</p>
  788. <pre>http://example.com/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E</pre>
  789. <p>If the attacker then convinced a victim user to visit this page, a script of the attacker's
  790. choosing would run on the page. Such a script could do any number of hostile actions, limited
  791. only by what the site offers: if the site is an e-commerce shop, for instance, such a script
  792. could cause the user to unknowingly make arbitrarily many unwanted purchases.</p>
  793. <p>This is called a cross-site scripting attack.</p>
  794. </div>
  795. <p>There are many constructs that can be used to try to trick a site into executing code. Here
  796. are some that authors are encouraged to consider when writing whitelist filters:</p>
  797. <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
  798. any provided attributes as well. If one allowed all attributes then an attacker could, for
  799. instance, use the <code id=writing-secure-applications-with-html:handler-onload><a href=#handler-onload>onload</a></code> attribute to run arbitrary
  800. script.<li>When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be
  801. explicitly whitelisted, as there are many schemes that can be abused. The most prominent
  802. example is "<code id=writing-secure-applications-with-html:javascript-protocol><a href=#javascript-protocol>javascript:</a></code>", but user agents can
  803. 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
  804. in the page with relative links can be hijacked, and similarly that any form submissions can
  805. get redirected to a hostile site.</ul>
  806. <dt>Cross-site request forgery (CSRF)<dd>
  807. <p>If a site allows a user to make form submissions with user-specific side-effects, for example
  808. posting messages on a forum under the user's name, making purchases, or applying for a passport,
  809. it is important to verify that the request was made by the user intentionally, rather than by
  810. another site tricking the user into making the request unknowingly.</p>
  811. <p>This problem exists because HTML forms can be submitted to other origins.</p>
  812. <p>Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by
  813. checking <code id=writing-secure-applications-with-html:http-origin><a href=#http-origin>Origin</a></code> headers on all requests.</p>
  814. <dt>Clickjacking<dd>
  815. <p>A page that provides users with an interface to perform actions that the user might not wish
  816. to perform needs to be designed so as to avoid the possibility that users can be tricked into
  817. activating the interface.</p>
  818. <p>One way that a user could be so tricked is if a hostile site places the victim site in a
  819. 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
  820. play a reaction game. Once the user is playing the game, the hostile site can quickly position
  821. the iframe under the mouse cursor just as the user is about to click, thus tricking the user
  822. into clicking the victim site's interface.</p>
  823. <p>To avoid this, sites that do not expect to be used in frames are encouraged to only enable
  824. 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>
  825. attribute).</p>
  826. </dl>
  827. <h4 id=common-pitfalls-to-avoid-when-using-the-scripting-apis>1.11.2 Common pitfalls to avoid when using the scripting APIs</h4>
  828. <p><i>This section is non-normative.</i></p>
  829. <p>Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run
  830. the script uninterrupted before doing anything else, such as firing further events or continuing
  831. to parse the document.</p>
  832. <p>On the other hand, parsing of HTML files happens asynchronously and incrementally, meaning that
  833. the parser can pause at any point to let scripts run. This is generally a good thing, but it does
  834. mean that authors need to be careful to avoid hooking event handlers after the events could have
  835. possibly fired.</p>
  836. <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
  837. attributes</a>, or create the element and add the event handlers in the same script. The latter
  838. is safe because, as mentioned earlier, scripts are run to completion before further events can
  839. fire.</p>
  840. <div class=example>
  841. <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
  842. parsed, especially if the image has already been cached (which is common).</p>
  843. <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
  844. <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>
  845. <pre>&lt;img src="games.png" alt="Games" onload="gamesLogoHasLoaded(event)"></pre>
  846. <p>If the element is being added by script, then so long as the event handlers are added in the
  847. same script, the event will still not be missed:</p>
  848. <pre>&lt;script>
  849. var img = new Image();
  850. img.src = 'games.png';
  851. img.alt = 'Games';
  852. img.onload = gamesLogoHasLoaded;
  853. // img.addEventListener('load', gamesLogoHasLoaded, false); // would work also
  854. &lt;/script></pre>
  855. <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
  856. 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>
  857. event would be fired in between, leading it to be missed:</p>
  858. <pre class=bad>&lt;!-- Do not use this style, it has a race condition! -->
  859. &lt;img id="games" src="games.png" alt="Games">
  860. &lt;!-- the 'load' event might fire here while the parser is taking a
  861. break, in which case you will not see it! -->
  862. &lt;script>
  863. var img = document.getElementById('games');
  864. img.onload = gamesLogoHasLoaded; // might never fire!
  865. &lt;/script></pre>
  866. </div>
  867. <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>
  868. <p><i>This section is non-normative.</i></p>
  869. <p>Authors are encouraged to make use of conformance checkers (also known as <i>validators</i>) to
  870. catch common mistakes. The WHATWG maintains a list of such tools at: <a href=http://validator.whatwg.org/>http://validator.whatwg.org/</a></p>
  871. <h3 id=conformance-requirements-for-authors>1.12 Conformance requirements for authors</h3>
  872. <p><i>This section is non-normative.</i></p>
  873. <p>Unlike previous versions of the HTML specification, this specification defines in some detail
  874. the required processing for invalid documents as well as valid documents.</p>
  875. <p>However, even though the processing of invalid content is in most cases well-defined,
  876. conformance requirements for documents are still important: in practice, interoperability (the
  877. situation in which all implementations process particular content in a reliable and identical or
  878. equivalent way) is not the only goal of document conformance requirements. This section details
  879. some of the more common reasons for still distinguishing between a conforming document and one
  880. with errors.</p>
  881. <h4 id=presentational-markup>1.12.1 Presentational markup</h4>
  882. <p><i>This section is non-normative.</i></p>
  883. <p>The majority of presentational features from previous versions of HTML are no longer allowed.
  884. Presentational markup in general has been found to have a number of problems:</p>
  885. <dl><dt>The use of presentational elements leads to poorer accessibility<dd>
  886. <p>While it is possible to use presentational markup in a way that provides users of assistive
  887. technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly
  888. more difficult than doing so when using semantically-appropriate markup. Furthermore, even using
  889. such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users
  890. of text-mode browsers.</p>
  891. <p>Using media-independent markup, on the other hand, provides an easy way for documents to be
  892. authored in such a way that they work for more users (e.g. text browsers).</p>
  893. <dt>Higher cost of maintenance<dd>
  894. <p>It is significantly easier to maintain a site written in such a way that the markup is
  895. style-independent. For example, changing the colour of a site that uses <code>&lt;font color=""></code> throughout requires changes across the entire site,
  896. whereas a similar change to a site based on CSS can be done by changing a single file.</p>
  897. <dt>Larger document sizes<dd>
  898. <p>Presentational markup tends to be much more redundant, and thus results in larger document
  899. sizes.</p>
  900. </dl>
  901. <p>For those reasons, presentational markup has been removed from HTML in this version. This
  902. change should not come as a surprise; HTML4 deprecated presentational markup many years ago and
  903. provided a mode (HTML4 Transitional) to help authors move away from presentational markup; later,
  904. XHTML 1.1 went further and obsoleted those features altogether.</p>
  905. <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
  906. it can be useful for rapid prototyping (where its rules can be directly moved into a separate
  907. style sheet later) and for providing specific styles in unusual cases where a separate style sheet
  908. 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
  909. for page-specific styles, but in general an external style sheet is likely to be more convenient
  910. when the styles apply to multiple pages.</p>
  911. <p>It is also worth noting that some elements that were previously presentational have been
  912. 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>,
  913. <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>
  914. <h4 id=syntax-errors>1.12.2 Syntax errors</h4>
  915. <p><i>This section is non-normative.</i></p>
  916. <p>The syntax of HTML is constrained to avoid a wide variety of problems.</p>
  917. <dl><dt>Unintuitive error-handling behavior<dd>
  918. <p>Certain invalid syntax constructs, when parsed, result in DOM trees that are highly
  919. unintuitive.</p>
  920. <div class=example>
  921. <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
  922. 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>
  923. <pre class=bad>&lt;table>&lt;hr>...</pre>
  924. </div>
  925. <dt>Errors with optional error recovery<dd>
  926. <p>To allow user agents to be used in controlled environments without having to implement the
  927. more bizarre and convoluted error handling rules, user agents are permitted to fail whenever
  928. encountering a <a href=#parse-error id=syntax-errors:parse-error>parse error</a>.</p>
  929. <dt>Errors where the error-handling behavior is not compatible with streaming user agents<dd>
  930. <p>Some error-handling behavior, such as the behavior for the <code>&lt;table>&lt;hr>...</code> example mentioned above, are incompatible with streaming
  931. user agents (user agents that process HTML files in one pass, without storing state). To avoid
  932. interoperability problems with such user agents, any syntax resulting in such behavior is
  933. considered invalid.</p>
  934. <dt>Errors that can result in infoset coercion<dd>
  935. <p>When a user agent based on XML is connected to an HTML parser, it is possible that certain
  936. invariants that XML enforces, such as comments never containing two consecutive hyphens, will be
  937. violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an
  938. XML-compatible infoset. Most syntax constructs that require such handling are considered
  939. invalid.</p>
  940. <dt>Errors that result in disproportionally poor performance<dd>
  941. <p>Certain syntax constructs can result in disproportionally poor performance. To discourage the
  942. use of such constructs, they are typically made non-conforming.</p>
  943. <div class=example>
  944. <p>For example, the following markup results in poor performance, since all the unclosed
  945. <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
  946. more elements in each paragraph:</p>
  947. <pre class=bad>&lt;p>&lt;i>He dreamt.
  948. &lt;p>&lt;i>He dreamt that he ate breakfast.
  949. &lt;p>&lt;i>Then lunch.
  950. &lt;p>&lt;i>And finally dinner.</pre>
  951. <p>The resulting DOM for this fragment would be:</p>
  952. <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>
  953. </div>
  954. <dt>Errors involving fragile syntax constructs<dd>
  955. <p>There are syntax constructs that, for historical reasons, are relatively fragile. To help
  956. reduce the number of users who accidentally run into such problems, they are made
  957. non-conforming.</p>
  958. <div class=example>
  959. <p>For example, the parsing of certain named character references in attributes happens even
  960. with the closing semicolon being omitted. It is safe to include an ampersand followed by
  961. letters that do not form a named character reference, but if the letters are changed to a
  962. string that <em>does</em> form a named character reference, they will be interpreted as that
  963. character instead.</p>
  964. <p>In this fragment, the attribute's value is "<code>?bill&amp;ted</code>":</p>
  965. <pre class=bad>&lt;a href="?bill&amp;ted">Bill and Ted&lt;/a></pre>
  966. <p>In the following fragment, however, the attribute's value is actually "<code>?art©</code>", <em>not</em> the intended "<code>?art&amp;copy</code>",
  967. because even without the final semicolon, "<code>&amp;copy</code>" is handled the same
  968. as "<code>&amp;copy;</code>" and thus gets interpreted as "<code>©</code>":</p>
  969. <pre class=bad>&lt;a href="?art&amp;copy">Art and Copy&lt;/a></pre>
  970. <p>To avoid this problem, all named character references are required to end with a semicolon,
  971. and uses of named character references without a semicolon are flagged as errors.</p>
  972. <p>Thus, the correct way to express the above cases is as
  973. follows:</p>
  974. <pre>&lt;a href="?bill&amp;ted">Bill and Ted&lt;/a> &lt;!-- &amp;ted is ok, since it's not a named character reference --></pre>
  975. <pre>&lt;a href="?art&amp;amp;copy">Art and Copy&lt;/a> &lt;!-- the &amp; has to be escaped, since &amp;copy <em>is</em> a named character reference --></pre>
  976. </div>
  977. <dt>Errors involving known interoperability problems in legacy user agents<dd>
  978. <p>Certain syntax constructs are known to cause especially subtle or serious problems in legacy
  979. user agents, and are therefore marked as non-conforming to help authors avoid them.</p>
  980. <div class=example>
  981. <p>For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted
  982. attributes. In certain legacy user agents, it is sometimes treated as a
  983. quote character.</p>
  984. </div>
  985. <div class=example>
  986. <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
  987. mode</a>, because the behavior of legacy user agents in <a href=#quirks-mode id=syntax-errors:quirks-mode>quirks mode</a> is often
  988. largely undocumented.</p>
  989. </div>
  990. <dt>Errors that risk exposing authors to security attacks<dd>
  991. <p>Certain restrictions exist purely to avoid known security problems.</p>
  992. <div class=example>
  993. <p>For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a
  994. known cross-site-scripting attack using UTF-7. <a href=#refsUTF7>[UTF7]</a></p>
  995. </div>
  996. <dt>Cases where the author's intent is unclear<dd>
  997. <p>Markup where the author's intent is very unclear is often made non-conforming. Correcting
  998. these errors early makes later maintenance easier.</p>
  999. <div class=example>
  1000. <p>For example, it is unclear whether the author intended the following to be an
  1001. <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>
  1002. <pre class=bad>&lt;h1>Contact details&lt;/h2></pre>
  1003. </div>
  1004. <dt>Cases that are likely to be typos<dd>
  1005. <p>When a user makes a simple typo, it is helpful if the error can be caught early, as this can
  1006. save the author a lot of debugging time. This specification therefore usually considers it an
  1007. error to use element names, attribute names, and so forth, that do not match the names defined
  1008. in this specification.</p>
  1009. <div class=example>
  1010. <p>For example, if the author typed <code>&lt;capton></code> instead of <code>&lt;caption></code>, this would be flagged as an error and the author could correct
  1011. the typo immediately.</p>
  1012. </div>
  1013. <dt>Errors that could interfere with new syntax in the future<dd>
  1014. <p>In order to allow the language syntax to be extended in the future, certain otherwise
  1015. harmless features are disallowed.</p>
  1016. <div class=example>
  1017. <p>For example, "attributes" in end tags are ignored currently, but they are invalid, in case a
  1018. future change to the language makes use of that syntax feature without conflicting with
  1019. already-deployed (and valid!) content.</p>
  1020. </div>
  1021. </dl>
  1022. <p>Some authors find it helpful to be in the practice of always quoting all attributes and always
  1023. including all optional tags, preferring the consistency derived from such custom over the minor
  1024. benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such
  1025. authors, conformance checkers can provide modes of operation wherein such conventions are
  1026. enforced.</p>
  1027. <h4 id=restrictions-on-content-models-and-on-attribute-values>1.12.3 Restrictions on content models and on attribute values</h4>
  1028. <p><i>This section is non-normative.</i></p>
  1029. <p>Beyond the syntax of the language, this specification also places restrictions on how elements
  1030. and attributes can be specified. These restrictions are present for similar reasons:</p>
  1031. <dl><dt>Errors involving content with dubious semantics<dd>
  1032. <p>To avoid misuse of elements with defined meanings, content models are defined that restrict
  1033. how elements can be nested when such nestings would be of dubious value.</p>
  1034. <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>
  1035. 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
  1036. that an entire section should be keyed in.</p>
  1037. <dt>Errors that involve a conflict in expressed semantics<dd>
  1038. <p>Similarly, to draw the author's attention to mistakes in the use of elements, clear
  1039. contradictions in the semantics expressed are also considered conformance errors.</p>
  1040. <div class=example>
  1041. <p>In the fragments below, for example, the semantics are nonsensical: a separator cannot
  1042. simultaneously be a cell, nor can a radio button be a progress bar.</p>
  1043. <pre class=bad>&lt;hr role="cell"></pre>
  1044. <pre class=bad>&lt;input type=radio role=progressbar></pre>
  1045. </div>
  1046. <p class=example>Another example is the restrictions on the content models of the
  1047. <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
  1048. 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
  1049. 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>
  1050. <dt>Cases where the default styles are likely to lead to confusion<dd>
  1051. <p>Certain elements have default styles or behaviors that make certain combinations likely to
  1052. lead to confusion. Where these have equivalent alternatives without this problem, the confusing
  1053. combinations are disallowed.</p>
  1054. <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
  1055. <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
  1056. 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
  1057. <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>
  1058. 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>
  1059. element, but only the latter involves a block box in an inline box, the latter combination is
  1060. disallowed.</p>
  1061. <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
  1062. 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>
  1063. element. This is because the default behavior of such nesting interactive elements would be
  1064. highly confusing to users. Instead of nesting these elements, they can be placed side by
  1065. side.</p>
  1066. <dt>Errors that indicate a likely misunderstanding of the specification<dd>
  1067. <p>Sometimes, something is disallowed because allowing it would likely cause author
  1068. confusion.</p>
  1069. <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>
  1070. attribute to the value "<code>false</code>" is disallowed, because despite the
  1071. appearance of meaning that the element is enabled, it in fact means that the element is
  1072. <em>disabled</em> (what matters for implementations is the presence of the attribute, not its
  1073. value).</p>
  1074. <dt>Errors involving limits that have been imposed merely to simplify the language<dd>
  1075. <p>Some conformance errors simplify the language that authors need to learn.</p>
  1076. <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
  1077. 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
  1078. tutorials and other learning aids. There would be no benefit to allowing both, but it would
  1079. cause extra confusion when teaching the language.</p>
  1080. <dt>Errors that involve peculiarities of the parser<dd>
  1081. <p>Certain elements are parsed in somewhat eccentric ways (typically for historical reasons),
  1082. and their content model restrictions are intended to avoid exposing the author to these
  1083. issues.</p>
  1084. <div class=example>
  1085. <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>,
  1086. 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
  1087. <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>
  1088. <pre>&lt;p>Welcome. &lt;form>&lt;label>Name:&lt;/label> &lt;input>&lt;/form></pre>
  1089. <p>It is parsed exactly like the following:</p>
  1090. <pre>&lt;p>Welcome. &lt;/p>&lt;form>&lt;label>Name:&lt;/label> &lt;input>&lt;/form></pre>
  1091. </div>
  1092. <dt>Errors that would likely result in scripts failing in hard-to-debug ways<dd>
  1093. <p>Some errors are intended to help prevent script problems that would be hard to debug.</p>
  1094. <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
  1095. element being selected, with sometimes disastrous effects whose cause is hard to determine.</p>
  1096. <dt>Errors that waste authoring time<dd>
  1097. <p>Some constructs are disallowed because historically they have been the cause of a lot of
  1098. wasted authoring time, and by encouraging authors to avoid making them, authors can save time in
  1099. future efforts.</p>
  1100. <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.
  1101. However, this isn't obvious, especially if the element's contents appear to be executable script
  1102. — which can lead to authors spending a lot of time trying to debug the inline script
  1103. without realizing that it is not executing. To reduce this problem, this specification makes it
  1104. 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
  1105. validating their documents are less likely to waste time with this kind of mistake.</p>
  1106. <dt>Errors that involve areas that affect authors migrating to and from XHTML<dd>
  1107. <p>Some authors like to write files that can be interpreted as both XML and HTML with similar
  1108. results. Though this practice is discouraged in general due to the myriad of subtle
  1109. complications involved (especially when involving scripting, styling, or any kind of automated
  1110. serialisation), this specification has a few restrictions intended to at least somewhat mitigate
  1111. the difficulties. This makes it easier for authors to use this as a transitionary step when
  1112. migrating between HTML and XHTML.</p>
  1113. <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
  1114. intended to keep the two synchronized.</p>
  1115. <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
  1116. elements in conforming documents end up in the same namespaces whether processed as HTML or
  1117. XML.</p>
  1118. <dt>Errors that involve areas reserved for future expansion<dd>
  1119. <p>As with the restrictions on the syntax intended to allow for new syntax in future revisions
  1120. of the language, some restrictions on the content models of elements and values of attributes
  1121. are intended to allow for future expansion of the HTML vocabulary.</p>
  1122. <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
  1123. character (_) to only specific predefined values allows new predefined values to be introduced
  1124. at a future time without conflicting with author-defined values.</p>
  1125. <dt>Errors that indicate a mis-use of other specifications<dd>
  1126. <p>Certain restrictions are intended to support the restrictions made by other
  1127. specifications.</p>
  1128. <p class=example>For example, requiring that attributes that take media query lists use only
  1129. <em>valid</em> media query lists reinforces the importance of following the conformance rules of
  1130. that specification.</p>
  1131. </dl>
  1132. <h3 id=suggested-reading>1.13 Suggested reading</h3>
  1133. <p><i>This section is non-normative.</i></p>
  1134. <p>The following documents might be of interest to readers of this specification.</p>
  1135. <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
  1136. developers, and content developers with a common reference for interoperable text manipulation on
  1137. the World Wide Web, building on the Universal Character Set, defined jointly by the Unicode
  1138. Standard and ISO/IEC 10646. Topics addressed include use of the terms 'character', 'encoding' and
  1139. 'string', a reference processing model, choice and identification of character encodings,
  1140. 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
  1141. the varied writing systems of the world, incorrect usage can expose programs or systems to
  1142. possible security attacks. This is especially important as more and more products are
  1143. internationalized. This document describes some of the security considerations that programmers,
  1144. system analysts, standards developers, and users should take into account, and provides specific
  1145. 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
  1146. recommendations for making Web content more accessible. Following these guidelines will make
  1147. content accessible to a wider range of people with disabilities, including blindness and low
  1148. vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited
  1149. movement, speech disabilities, photosensitivity and combinations of these. Following these
  1150. guidelines will also often make your Web content more usable to users in
  1151. 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
  1152. authoring tools that are more accessible for people with disabilities. An authoring tool that
  1153. conforms to these guidelines will promote accessibility by providing an accessible user interface
  1154. to authors with disabilities as well as by enabling, supporting, and promoting the production of
  1155. 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
  1156. lower barriers to Web accessibility for people with disabilities. User agents include browsers
  1157. and other types of software that retrieve and render Web content. A user agent that conforms to
  1158. these guidelines will promote accessibility through its own user interface and through other
  1159. internal facilities, including its ability to communicate with other technologies (especially
  1160. assistive technologies). Furthermore, all users, not just users with disabilities, should find
  1161. conforming user agents to be more usable.</blockquote></dl>
  1162. <h2 id=infrastructure>2 Common infrastructure</h2>
  1163. <h3 id=terminology>2.1 Terminology</h3>
  1164. <p>This specification refers to both HTML and XML attributes and IDL attributes, often in the same
  1165. 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
  1166. attributes</dfn> for those defined on IDL interfaces. Similarly, the term "properties" is used for
  1167. both JavaScript object properties and CSS properties. When these are ambiguous they are qualified
  1168. as <dfn>object properties</dfn> and <dfn>CSS properties</dfn> respectively.</p>
  1169. <p>Generally, when the specification states that a feature applies to <a href=#syntax id=terminology:syntax>the HTML syntax</a>
  1170. 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
  1171. applies to one of the two languages, it is called out by explicitly stating that it does not apply
  1172. to the other format, as in "for HTML, ... (this does not apply to XHTML)".</p>
  1173. <p>This specification uses the term <dfn>document</dfn> to refer to any use of HTML,
  1174. ranging from short static documents to long essays or reports with rich multimedia, as well as to
  1175. fully-fledged interactive applications. The term is used to refer both to <code id=terminology:document><a href=#document>Document</a></code>
  1176. 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
  1177. on context.</p>
  1178. <p>In the context of the DOM structures, the terms <a href=#html-documents id=terminology:html-documents>HTML
  1179. document</a> and <a href=#xml-documents id=terminology:xml-documents>XML document</a> are used as defined in the DOM
  1180. specification, and refer specifically to two different modes that <code id=terminology:document-2><a href=#document>Document</a></code> objects
  1181. can find themselves in. <a href=#refsDOM>[DOM]</a> (Such uses are always hyperlinked to their
  1182. definition.)</p>
  1183. <p>In the context of byte streams, the term HTML document refers to resources labeled as
  1184. <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
  1185. MIME type</a>.</p>
  1186. <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
  1187. 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
  1188. elements from the <a href=#html-namespace-2 id=terminology:html-namespace-2-2>HTML namespace</a>, depending on context.</p>
  1189. <hr>
  1190. <p>For simplicity, terms such as <dfn>shown</dfn>, <dfn>displayed</dfn>, and
  1191. <dfn>visible</dfn> might sometimes be used when referring to the way a document is
  1192. rendered to the user. These terms are not meant to imply a visual medium; they must be considered
  1193. to apply to other media in equivalent ways.</p>
  1194. <p>When an algorithm B says to return to another algorithm A, it implies that A called B. Upon
  1195. returning to A, the implementation must continue from where it left off in calling B.</p>
  1196. <p>The term "transparent black" refers to the colour with red, green, blue, and alpha channels all
  1197. set to zero.</p>
  1198. <h4 id=resources>2.1.1 Resources</h4>
  1199. <p>The specification uses the term <dfn>supported</dfn> when referring to whether a user
  1200. agent has an implementation capable of decoding the semantics of an external resource. A format or
  1201. type is said to be <i>supported</i> if the implementation can process an external resource of that
  1202. format or type without critical aspects of the resource being ignored. Whether a specific resource
  1203. is <i>supported</i> can depend on what features of the resource's format are in use.</p>
  1204. <p class=example>For example, a PNG image would be considered to be in a supported format if its
  1205. pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image
  1206. also contained animation data.</p>
  1207. <p class=example>An MPEG-4 video file would not be considered to be in a supported format if the
  1208. compression format used was not supported, even if the implementation could determine the
  1209. dimensions of the movie from the file's metadata.</p>
  1210. <p>What some specifications, in particular the HTTP specification, refer to as a
  1211. <i>representation</i> is referred to in this specification as a <dfn>resource</dfn>.
  1212. <a href=#refsHTTP>[HTTP]</a></p>
  1213. <p>The term <dfn id=mime-type>MIME type</dfn> is used to refer to what is sometimes called an <i>Internet media
  1214. type</i> in protocol literature. The term <i>media type</i> in this specification is used to refer
  1215. 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>
  1216. <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
  1217. 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>
  1218. <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
  1219. 7231</a>, but does not contain any U+003B SEMICOLON characters (;). In other words, if it consists
  1220. only of a type and subtype, with no MIME Type parameters. <a href=#refsHTTP>[HTTP]</a></p>
  1221. <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>
  1222. <code id=resources:text/html><a href=#text/html>text/html</a></code>.</p>
  1223. <p>A resource's <dfn id=critical-subresources>critical subresources</dfn> are those that the resource needs to have
  1224. available to be correctly processed. Which resources are considered critical or not is defined by
  1225. the specification that defines the resource's format.</p>
  1226. <h4 id=xml>2.1.2 XML</h4>
  1227. <p id=html-namespace>To ease migration from HTML to XHTML, UAs conforming to this specification
  1228. 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
  1229. CSS. The term "<dfn id=html-elements>HTML elements</dfn>", when used in this specification, refers to any element
  1230. in that namespace, and thus refers to both HTML and XHTML elements.</p>
  1231. <p>Except where otherwise stated, all elements defined or mentioned in this specification are in
  1232. 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
  1233. attributes defined or mentioned in this specification have no namespace.</p>
  1234. <p>The term <dfn id=element-type>element type</dfn> is used to refer to the set of elements that have a given
  1235. 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
  1236. 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
  1237. (implicitly as defined above) the <a href=#html-namespace-2 id=xml:html-namespace-2-3>HTML namespace</a>.</p>
  1238. <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
  1239. and they contain no U+003A COLON characters (:). <a href=#refsXML>[XML]</a></p>
  1240. <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
  1241. 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>
  1242. whose subtype ends with the four characters "<code>+xml</code>". <a href=#refsRFC3023>[RFC3023]</a></p>
  1243. <h4 id=dom-trees>2.1.3 DOM trees</h4>
  1244. <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
  1245. 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
  1246. element.</p>
  1247. <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
  1248. element, means the furthest ancestor element node of whatever node is being discussed, or the node
  1249. 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
  1250. element</a> is indeed the document's root element; however, if the node is not currently part
  1251. of the document tree, the root element will be an orphaned node.</p>
  1252. <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
  1253. <code>Document</code> object</a>, it is said to be <dfn id=in-a-document>in a <code>Document</code></dfn>. An
  1254. element is said to have been <dfn id=insert-an-element-into-a-document>inserted into a
  1255. 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
  1256. 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
  1257. document's <a href=#root-element id=dom-trees:root-element-6>root element</a> to being another element.</p>
  1258. <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
  1259. 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
  1260. subtree</a> is that <code id=dom-trees:document-4><a href=#document>Document</a></code>'s tree.</p>
  1261. <p>The term <dfn id=tree-order>tree order</dfn> means a pre-order, depth-first traversal of DOM nodes involved
  1262. (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>
  1263. <p>When it is stated that some element or attribute is <dfn id=ignore>ignored</dfn>, or
  1264. treated as some other value, or handled as if it was something else, this refers only to the
  1265. processing of the node after it is in the DOM. A user agent must not mutate the
  1266. DOM in such situations.</p>
  1267. <p>A content attribute is said to <dfn>change</dfn> value only if its new value is
  1268. different than its previous value; setting an attribute to a value it already has does not change
  1269. it.</p>
  1270. <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
  1271. 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
  1272. characters</a>).</p>
  1273. <h4 id=scripting-2>2.1.4 Scripting</h4>
  1274. <p>The construction "a <code>Foo</code> object", where <code>Foo</code> is
  1275. actually an interface, is sometimes used instead of the more accurate "an object implementing the
  1276. interface <code>Foo</code>".</p>
  1277. <p>An IDL attribute is said to be <dfn>getting</dfn> when its value is being retrieved
  1278. (e.g. by author script), and is said to be <dfn>setting</dfn> when a new value is
  1279. assigned to it.</p>
  1280. <p>If a DOM object is said to be <dfn id=live>live</dfn>, then the attributes and methods on that object
  1281. must operate on the actual underlying data, not a snapshot of the
  1282. data.</p>
  1283. <p>In the contexts of events, the terms <i>fire</i> and <i>dispatch</i> are used as defined in the
  1284. 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
  1285. the event through the tree. The term <dfn id=concept-events-trusted>trusted event</dfn> is
  1286. used to refer to events whose <code id=scripting-2:dom-event-istrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute is
  1287. initialised to true. <a href=#refsDOM>[DOM]</a></p>
  1288. <h4 id=plugins>2.1.5 Plugins</h4>
  1289. <p>The term <dfn id=plugin>plugin</dfn> refers to a user-agent defined set of content handlers used by the
  1290. 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
  1291. that neither act as <a href=#child-browsing-context id=plugins:child-browsing-context>child browsing contexts</a> of the
  1292. <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
  1293. DOM.</p>
  1294. <p>Typically such content handlers are provided by third parties, though a user agent can also
  1295. designate built-in content handlers as plugins.</p>
  1296. <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
  1297. <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>
  1298. <p class=example>One example of a plugin would be a PDF viewer that is instantiated in a
  1299. <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
  1300. regardless of whether the party that implemented the PDF viewer component was the same as that
  1301. which implemented the user agent itself. However, a PDF viewer application that launches separate
  1302. from the user agent (as opposed to using the same interface) is not a plugin by this
  1303. definition.</p>
  1304. <p class=note>This specification does not define a mechanism for interacting with plugins, as it
  1305. is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin
  1306. mechanism such as the Netscape Plugin API; others might use remote content converters or have
  1307. built-in support for certain types. Indeed, this specification doesn't require user agents to
  1308. support plugins at all. <a href=#refsNPAPI>[NPAPI]</a></p>
  1309. <p>A plugin can be <dfn id=concept-plugin-secure>secured</dfn> if it honors the semantics of
  1310. the <code id=plugins:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>
  1311. <p class=example>For example, a secured plugin would prevent its contents from creating pop-up
  1312. windows when the plugin is instantiated inside a sandboxed <code id=plugins:the-iframe-element><a href=#the-iframe-element>iframe</a></code>.</p>
  1313. <p class=warning>Browsers should take extreme care when interacting with external content
  1314. intended for <a href=#plugin id=plugins:plugin-2>plugins</a>. When third-party software is run with the same
  1315. privileges as the user agent itself, vulnerabilities in the third-party software become as
  1316. dangerous as those in the user agent.</p>
  1317. <p>Since different users having differents sets of <a href=#plugin id=plugins:plugin-3>plugins</a> provides a
  1318. fingerprinting vector that increases the chances of users being uniquely identified, user agents
  1319. are encouraged to support the exact same set of <a href=#plugin id=plugins:plugin-4>plugins</a> for each
  1320. user.
  1321. <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>
  1322. </p>
  1323. <h4 id=encoding-terminology>2.1.6 Character encodings</h4>
  1324. <p>A <dfn id=encoding>character encoding</dfn>, or just <i>encoding</i> where that is not
  1325. ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the
  1326. 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
  1327. <dfn id=encoding-label>encoding labels</dfn>, referred to as the encoding's <i>name</i> and
  1328. <i>labels</i> in the Encoding standard. <a href=#refsENCODING>[ENCODING]</a></p>
  1329. <p>An <dfn id=ascii-compatible-character-encoding>ASCII-compatible character encoding</dfn> is a single-byte or variable-length
  1330. <a href=#encoding id=encoding-terminology:encoding-2>encoding</a> in which the bytes 0x09, 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C -
  1331. 0x3F, 0x41 - 0x5A, and 0x61 - 0x7A, ignoring bytes that are the second and later bytes of multibyte
  1332. sequences, all correspond to single-byte sequences that map to the same Unicode characters as
  1333. those bytes in Windows-1252. <a href=#refsENCODING>[ENCODING]</a></p>
  1334. <p class=note>This includes such encodings as Shift_JIS, HZ-GB-2312, and variants of ISO-2022,
  1335. even though it is possible in these encodings for bytes like 0x70 to be part of longer sequences
  1336. that are unrelated to their interpretation as ASCII. It excludes UTF-16 variants, as well as
  1337. obsolete legacy encodings such as UTF-7, GSM03.38, and EBCDIC variants.</p>
  1338. <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,
  1339. regardless of the presence or absence of a BOM. <a href=#refsENCODING>[ENCODING]</a></p>
  1340. <p>The term <dfn id=code-unit>code unit</dfn> is used as defined in the Web IDL specification: a 16 bit
  1341. 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
  1342. Unicode, and is not the same as a <i>code point</i>.) <a href=#refsWEBIDL>[WEBIDL]</a></p>
  1343. <p>The term <dfn id=unicode-code-point>Unicode code point</dfn> means a <i>Unicode scalar value</i> where possible, and
  1344. an isolated surrogate code point when not. When a conformance requirement is defined in terms of
  1345. characters or Unicode code points, a pair of <a href=#code-unit id=encoding-terminology:code-unit>code units</a> consisting
  1346. of a high surrogate followed by a low surrogate must be treated as the single code point
  1347. represented by the surrogate pair, but isolated surrogates must each be treated as the single code
  1348. point with the value of the surrogate. <a href=#refsUNICODE>[UNICODE]</a></p>
  1349. <p>In this specification, the term <dfn id=character>character</dfn>, when not qualified as <em>Unicode</em>
  1350. character, is synonymous with the term <a href=#unicode-code-point id=encoding-terminology:unicode-code-point>Unicode code point</a>.</p>
  1351. <p>The term <dfn id=unicode-character>Unicode character</dfn> is used to mean a <i>Unicode scalar value</i> (i.e. any
  1352. Unicode code point that is not a surrogate code point). <a href=#refsUNICODE>[UNICODE]</a></p>
  1353. <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
  1354. units</a> in that string.</p>
  1355. <p class=note>This complexity results from the historical decision to define the DOM API in
  1356. 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>
  1357. <h3 id=conformance-requirements>2.2 Conformance requirements</h3>
  1358. <p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
  1359. explicitly marked non-normative. Everything else in this specification is normative.</p>
  1360. <p>The key words "MUST", "MUST NOT", "SHOULD",
  1361. "SHOULD NOT", "MAY", and "OPTIONAL" in the normative
  1362. parts of this document are to be interpreted as described in RFC2119. The key word "OPTIONALLY" in
  1363. the normative parts of this document is to be interpreted with the same normative meaning as "MAY"
  1364. and "OPTIONAL". For readability, these words do not appear in all uppercase letters in this
  1365. specification. <a href=#refsRFC2119>[RFC2119]</a></p>
  1366. <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space
  1367. characters" or "return false and abort these steps") are to be interpreted with the meaning of the
  1368. key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
  1369. <div class=example>
  1370. <p>For example, were the spec to say:</p>
  1371. <pre>To eat an orange, the user must:
  1372. 1. Peel the orange.
  1373. 2. Separate each slice of the orange.
  1374. 3. Eat the orange slices.</pre>
  1375. <p>...it would be equivalent to the following:</p>
  1376. <pre>To eat an orange:
  1377. 1. The user must peel the orange.
  1378. 2. The user must separate each slice of the orange.
  1379. 3. The user must eat the orange slices.</pre>
  1380. <p>Here the key word is "must".</p>
  1381. <p>The former (imperative) style is generally preferred in this specification for stylistic
  1382. reasons.</p>
  1383. </div>
  1384. <p>Conformance requirements phrased as algorithms or specific steps may be implemented in any
  1385. manner, so long as the end result is equivalent. (In particular, the algorithms defined in this
  1386. specification are intended to be easy to follow, and not intended to be performant.)</p>
  1387. <h4 id=conformance-classes>2.2.1 Conformance classes</h4>
  1388. <p>This specification describes the conformance criteria for user agents
  1389. (relevant to implementors) and documents (relevant to authors and
  1390. authoring tool implementors).</p>
  1391. <p><dfn id=conforming-documents>Conforming documents</dfn> are those that comply with all the conformance criteria for
  1392. documents. For readability, some of these conformance requirements are phrased as conformance
  1393. requirements on authors; such requirements are implicitly requirements on documents: by
  1394. definition, all documents are assumed to have had an author. (In some cases, that author may
  1395. itself be a user agent — such user agents are subject to additional rules, as explained
  1396. below.)</p>
  1397. <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
  1398. elements named <code>foobar</code>.</p>
  1399. <p class="note impl">There is no implied relationship between document conformance requirements
  1400. and implementation conformance requirements. User agents are not free to handle non-conformant
  1401. documents as they please; the processing model described in this specification applies to
  1402. implementations regardless of the conformity of the input documents.</p>
  1403. <p>User agents fall into several (overlapping) categories with different conformance
  1404. requirements.</p>
  1405. <dl><dt id=interactive>Web browsers and other interactive user agents<dd>
  1406. <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
  1407. 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,
  1408. so that users can interact with them, unless the semantics of those elements have been
  1409. overridden by other specifications.</p>
  1410. <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>
  1411. element in an XML document, execute the script contained in that element. However, if the
  1412. element is found within a transformation expressed in XSLT (assuming the user agent also
  1413. 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
  1414. opaque element that forms part of the transform.</p>
  1415. <p>Web browsers that support <a href=#syntax id=conformance-classes:syntax>the HTML syntax</a> must process documents labeled with an
  1416. <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
  1417. them.</p>
  1418. <p>User agents that support scripting must also be conforming implementations of the IDL
  1419. fragments in this specification, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  1420. <p class=note>Unless explicitly stated, specifications that override the semantics of HTML
  1421. elements do not override the requirements on DOM objects representing those elements. For
  1422. 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
  1423. <code id=conformance-classes:htmlscriptelement><a href=#htmlscriptelement>HTMLScriptElement</a></code> interface.</p>
  1424. <dt id=non-interactive>Non-interactive presentation user agents<dd>
  1425. <p>User agents that process HTML and XHTML documents purely to render non-interactive versions
  1426. of them must comply to the same conformance criteria as Web browsers, except that they are
  1427. exempt from requirements regarding user interaction.</p>
  1428. <p class=note>Typical examples of non-interactive presentation user agents are printers
  1429. (static UAs) and overhead displays (dynamic UAs). It is expected that most static
  1430. non-interactive presentation user agents will also opt to <a href=#non-scripted>lack scripting
  1431. support</a>.</p>
  1432. <p class=example>A non-interactive but dynamic presentation UA would still execute scripts,
  1433. allowing forms to be dynamically submitted, and so forth. However, since the concept of "focus"
  1434. is irrelevant when the user cannot interact with the document, the UA would not need to support
  1435. any of the focus-related DOM APIs.</p>
  1436. <dt id=renderingUA>Visual user agents that support the suggested default rendering<dd>
  1437. <p>User agents, whether interactive or not, may be designated (possibly as a user option) as
  1438. supporting the suggested default rendering defined by this specification.</p>
  1439. <p>This is not required. In particular, even user agents that do implement the suggested default
  1440. rendering are encouraged to offer settings that override this default to improve the experience
  1441. for the user, e.g. changing the colour contrast, using different focus styles, or otherwise
  1442. making the experience more accessible and usable to the user.</p>
  1443. <p>User agents that are designated as supporting the suggested default rendering must, while so
  1444. designated, implement the rules in <a href=#rendering>the rendering section</a> that that
  1445. section defines as the behavior that user agents are <em>expected</em> to implement.</p>
  1446. <dt id=non-scripted>User agents with no scripting support<dd>
  1447. <p>Implementations that do not support scripting (or which have their scripting features
  1448. disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this
  1449. specification. For the parts of this specification that are defined in terms of an events model
  1450. or in terms of the DOM, such user agents must still act as if events and the DOM were
  1451. supported.</p>
  1452. <p class=note>Scripting can form an integral part of an application. Web browsers that do not
  1453. support scripting, or that have scripting disabled, might be unable to fully convey the author's
  1454. intent.</p>
  1455. <dt>Conformance checkers<dd id=conformance-checkers>
  1456. <p>Conformance checkers must verify that a document conforms to the applicable conformance
  1457. criteria described in this specification. Automated conformance checkers are exempt from
  1458. detecting errors that require interpretation of the author's intent (for example, while a
  1459. 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,
  1460. conformance checkers running without the input of human judgement do not have to check that
  1461. <code id=conformance-classes:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code> elements only contain quoted material).</p>
  1462. <p>Conformance checkers must check that the input document conforms when parsed without a
  1463. <a href=#browsing-context id=conformance-classes:browsing-context>browsing context</a> (meaning that no scripts are run, and that the parser's
  1464. <a href=#scripting-flag id=conformance-classes:scripting-flag>scripting flag</a> is disabled), and should also check that the input document conforms
  1465. 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
  1466. never cause non-conforming states to occur other than transiently during script execution
  1467. itself. (This is only a "SHOULD" and not a "MUST" requirement because it has been proven to be
  1468. impossible. <a href=#refsCOMPUTABLE>[COMPUTABLE]</a>)</p>
  1469. <p>The term "HTML validator" can be used to refer to a conformance checker that itself conforms
  1470. to the applicable requirements of this specification.</p>
  1471. <div class=note>
  1472. <p>XML DTDs cannot express all the conformance requirements of this specification. Therefore, a
  1473. validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither
  1474. of the two authoring formats defined in this specification are applications of SGML, a
  1475. validating SGML system cannot constitute a conformance checker either.</p>
  1476. <p>To put it another way, there are three types of conformance criteria:</p>
  1477. <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>
  1478. <p>A conformance checker must check for the first two. A simple DTD-based validator only checks
  1479. for the first class of errors and is therefore not a conforming conformance checker according
  1480. to this specification.</p>
  1481. </div>
  1482. <dt>Data mining tools<dd id=data-mining>
  1483. <p>Applications and tools that process HTML and XHTML documents for reasons other than to either
  1484. render the documents or check them for conformance should act in accordance with the semantics
  1485. of the documents that they process.</p>
  1486. <p class=example>A tool that generates <a href=#outline id=conformance-classes:outline>document outlines</a> but
  1487. increases the nesting level for each paragraph and does not increase the nesting level for each
  1488. section would not be conforming.</p>
  1489. <dt id=editors>Authoring tools and markup generators<dd>
  1490. <p>Authoring tools and markup generators must generate <a href=#conforming-documents id=conformance-classes:conforming-documents>conforming documents</a>.
  1491. Conformance criteria that apply to authors also apply to authoring tools, where appropriate.</p>
  1492. <p>Authoring tools are exempt from the strict requirements of using elements only for their
  1493. specified purpose, but only to the extent that authoring tools are not yet able to determine
  1494. author intent. However, authoring tools must not automatically misuse elements or encourage
  1495. their users to do so.</p>
  1496. <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
  1497. arbitrary contact information; that element can only be used for marking up contact information
  1498. for the author of the document or section. However, since an authoring tool is likely unable to
  1499. determine the difference, an authoring tool is exempt from that requirement. This does not mean,
  1500. 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
  1501. (for instance); it just means that the authoring tool doesn't have to verify that when the user
  1502. uses a tool for inserting contact information for a section, that the user really is doing that
  1503. and not inserting something else instead.</p>
  1504. <p class=note>In terms of conformance checking, an editor has to output documents that conform
  1505. to the same extent that a conformance checker will verify.</p>
  1506. <p>When an authoring tool is used to edit a non-conforming document, it may preserve the
  1507. conformance errors in sections of the document that were not edited during the editing session
  1508. (i.e. an editing tool is allowed to round-trip erroneous content). However, an authoring tool
  1509. must not claim that the output is conformant if errors have been so preserved.</p>
  1510. <p>Authoring tools are expected to come in two broad varieties: tools that work from structure
  1511. or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing
  1512. basis (WYSIWYG).</p>
  1513. <p>The former is the preferred mechanism for tools that author HTML, since the structure in the
  1514. source information can be used to make informed choices regarding which HTML elements and
  1515. attributes are most appropriate.</p>
  1516. <p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are
  1517. appropriate, and should not use elements that they do not know to be appropriate. This might in
  1518. certain extreme cases mean limiting the use of flow elements to just a few elements, like
  1519. <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
  1520. of the <code id=conformance-classes:the-style-attribute><a href=#the-style-attribute>style</a></code> attribute.</p>
  1521. <p>All authoring tools, whether WYSIWYG or not, should make a best effort attempt at enabling
  1522. users to create well-structured, semantically rich, media-independent content.</p>
  1523. </dl>
  1524. <p id=hardwareLimitations>User agents may impose implementation-specific limits on otherwise
  1525. unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of
  1526. memory, or to work around platform-specific limitations.
  1527. <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>
  1528. </p>
  1529. <p>For compatibility with existing content and prior specifications, this specification describes
  1530. 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
  1531. using a <a href=#writing>custom format</a> inspired by SGML (referred to as <a href=#syntax id=conformance-classes:syntax-2>the HTML
  1532. syntax</a>). Implementations must support at least one of these two formats, although
  1533. supporting both is encouraged.</p>
  1534. <p>Some conformance requirements are phrased as requirements on elements, attributes, methods or
  1535. objects. Such requirements fall into two categories: those describing content model restrictions,
  1536. and those describing implementation behavior. Those in the former category are requirements on
  1537. documents and authoring tools. Those in the second category are requirements on user agents.
  1538. Similarly, some conformance requirements are phrased as requirements on authors; such requirements
  1539. are to be interpreted as conformance requirements on the documents that authors produce. (In other
  1540. words, this specification does not distinguish between conformance criteria on authors and
  1541. conformance criteria on documents.)</p>
  1542. <h4 id=dependencies>2.2.2 Dependencies</h4>
  1543. <p>This specification relies on several other underlying specifications.</p>
  1544. <dl><dt>Unicode and Encoding<dd>
  1545. <p>The Unicode character set is used to represent textual data, and the WHATWG Encoding standard
  1546. defines requirements around <a href=#encoding id=dependencies:encoding>character encodings</a>. <a href=#refsUNICODE>[UNICODE]</a></p>
  1547. <p class=note>This specification <a href=#encoding-terminology>introduces terminology</a>
  1548. based on the terms defined in those specifications, as described earlier.</p>
  1549. <p>The following terms are used as defined in the WHATWG Encoding standard: <a href=#refsENCODING>[ENCODING]</a></p>
  1550. <ul class=brief><li><dfn id=getting-an-encoding><a href=http://encoding.spec.whatwg.org/#concept-encoding-get>Getting an encoding</a></dfn>
  1551. <li>The <dfn id=encoder>encoder</dfn> and <dfn id=decoder>decoder</dfn> algorithms for various encodings, including
  1552. the <dfn id=utf-8-encoder>UTF-8 encoder</dfn> and <dfn id=utf-8-decoder>UTF-8 decoder</dfn>
  1553. <li>The generic <dfn id=decode>decode</dfn> algorithm which takes a byte stream and an encoding and
  1554. returns a character stream
  1555. <li>The <dfn id=utf-8-decode>UTF-8 decode</dfn> algorithm which takes a byte stream and returns a character
  1556. stream, additionally stripping one leading UTF-8 Byte Order Mark (BOM), if any
  1557. </ul>
  1558. <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
  1559. then invokes the former.</p>
  1560. <p>For readability, character encodings are sometimes referenced in this specification with a
  1561. case that differs from the canonical case given in the WHATWG Encoding standard. (For example,
  1562. "UTF-16LE" instead of "utf-16le".)</p>
  1563. <dt>XML and related specifications<dd>
  1564. <p>Implementations that support <a href=#the-xhtml-syntax id=dependencies:the-xhtml-syntax>the XHTML syntax</a> must support some version of XML,
  1565. as well as its corresponding namespaces specification, because that syntax uses an XML
  1566. serialisation with namespaces. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
  1567. <p>The attribute with the tag name <dfn id=attr-xml-space><code>xml:space</code></dfn> in
  1568. the <a href=#xml-namespace id=dependencies:xml-namespace>XML namespace</a> is defined by the XML specification. <a href=#refsXML>[XML]</a></p>
  1569. <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>&lt;?xml-stylesheet?></code></a></dfn>
  1570. processing instruction, defined in the <cite>Associating Style Sheets with XML documents</cite>
  1571. specification. <a href=#refsXMLSSPI>[XMLSSPI]</a></p>
  1572. <p>This specification also non-normatively mentions the <dfn id=xsltprocessor><code>XSLTProcessor</code></dfn>
  1573. interface and its <dfn id=dom-xsltprocessor-transformtofragment><code>transformToFragment()</code></dfn> and <dfn id=dom-xsltprocessor-transformtodocument><code>transformToDocument()</code></dfn> methods.</p>
  1574. <dt>URLs<dd>
  1575. <p>The following terms are defined in the WHATWG URL standard: <a href=#refsURL>[URL]</a></p>
  1576. <ul class=brief><li><dfn id=url>URL</dfn>
  1577. <li><dfn id=absolute-url>Absolute URL</dfn>
  1578. <li><dfn id=relative-url>Relative URL</dfn>
  1579. <li><dfn id=concept-url-scheme-relative>Relative schemes</dfn>
  1580. <li>The <dfn id=url-parser>URL parser</dfn>
  1581. <li><dfn id=parsed-url>Parsed URL</dfn>
  1582. <li>The <dfn id=concept-url-scheme>scheme</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url>parsed URL</a>
  1583. <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>
  1584. <li>The <dfn id=concept-url-username>username</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-3>parsed URL</a>
  1585. <li>The <dfn id=concept-url-password>password</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-4>parsed URL</a>
  1586. <li>The <dfn id=concept-url-host>host</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-5>parsed URL</a>
  1587. <li>The <dfn id=concept-url-port>port</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-6>parsed URL</a>
  1588. <li>The <dfn id=concept-url-path>path</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-7>parsed URL</a>
  1589. <li>The <dfn id=concept-url-query>query</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-8>parsed URL</a>
  1590. <li>The <dfn id=concept-url-fragment>fragment</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-9>parsed URL</a>
  1591. <li><dfn id=concept-url-parse-error>Parse errors</dfn> from the <a href=#url-parser id=dependencies:url-parser>URL parser</a>
  1592. <li>The <dfn id=concept-url-serialiser>URL serialiser</dfn>
  1593. <li><dfn id=default-encode-set>Default encode set</dfn>
  1594. <li><dfn id=percent-encode>Percent encode</dfn>
  1595. <li><dfn id=utf-8-percent-encode>UTF-8 percent encode</dfn>
  1596. <li><dfn id=percent-decode>Percent decode</dfn>
  1597. <li><dfn id=decoder-error>Decoder error</dfn>
  1598. <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
  1599. <li><dfn id=urlutilsreadonly><code>URLUtilsReadOnly</code></dfn> interface
  1600. <li><dfn id=dom-url-href><code>href</code></dfn> IDL attribute
  1601. <li><dfn id=dom-url-protocol><code>protocol</code></dfn> IDL attribute
  1602. <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>
  1603. <li>The <dfn id=concept-uu-update>update steps</dfn> hook for <code id=dependencies:urlutils-2><a href=#urlutils>URLUtils</a></code>
  1604. <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>
  1605. <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
  1606. <li>The <dfn id=concept-uu-input>input</dfn> of an <code id=dependencies:urlutils-5><a href=#urlutils>URLUtils</a></code> object
  1607. <li>The <dfn id=concept-uu-url>url</dfn> of an <code id=dependencies:urlutils-6><a href=#urlutils>URLUtils</a></code> object
  1608. </ul>
  1609. <p>A number of schemes and protocols are referenced by this specification also:</p>
  1610. <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>
  1611. <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>
  1612. <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>
  1613. <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>
  1614. <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>
  1615. <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>
  1616. <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>
  1617. <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>
  1618. </ul>
  1619. <dt>HTTP and related specifications<dd>
  1620. <p>The following terms are defined in the HTTP specifications: <a href=#refsHTTP>[HTTP]</a></p>
  1621. <ul class=brief><li><dfn id=http-accept><code>Accept</code></dfn> header
  1622. <li><dfn id=http-accept-language><code>Accept-Language</code></dfn> header
  1623. <li><dfn id=http-cache-control><code>Cache-Control</code></dfn> header
  1624. <li><dfn id=http-content-disposition><code>Content-Disposition</code></dfn> header
  1625. <li><dfn id=http-content-language><code>Content-Language</code></dfn> header
  1626. <li><dfn id=http-content-length><code>Content-Length</code></dfn> header
  1627. <li><dfn id=http-host><code>Host</code></dfn> header
  1628. <li><dfn id=http-last-modified><code>Last-Modified</code></dfn> header
  1629. <li><dfn id=http-referer><code>Referer</code></dfn> header
  1630. </ul>
  1631. <p>The following term is defined in the Web Origin specification: <a href=#refsORIGIN>[ORIGIN]</a></p>
  1632. <ul class=brief><li><dfn id=http-origin><code>Origin</code></dfn> header
  1633. </ul>
  1634. <p>The following terms are defined in the Cookie specification: <a href=#refsCOOKIES>[COOKIES]</a></p>
  1635. <ul class=brief><li><dfn id=cookie-string>cookie-string</dfn>
  1636. <li><dfn id=receives-a-set-cookie-string>receives a set-cookie-string</dfn>
  1637. <li><dfn id=http-cookie><code>Cookie</code></dfn> header
  1638. </ul>
  1639. <p>The following term is defined in the Web Linking specification: <a href=#refsWEBLINK>[WEBLINK]</a></p>
  1640. <ul class=brief><li><dfn id=http-link><code>Link</code></dfn> header
  1641. </ul>
  1642. <dt>Fetch<dd>
  1643. <p>The following terms are defined in the WHATWG Fetch specification: <a href=#refsFETCH>[FETCH]</a></p>
  1644. <ul class=brief><li><dfn id=cross-origin-request>cross-origin request</dfn>
  1645. <li><dfn id=cross-origin-request-status>cross-origin request status</dfn>
  1646. <li><dfn id=custom-request-headers>custom request headers</dfn>
  1647. <li><dfn id=simple-cross-origin-request>simple cross-origin request</dfn>
  1648. <li><dfn id=redirect-steps>redirect steps</dfn>
  1649. <li><dfn id=omit-credentials-flag>omit credentials flag</dfn>
  1650. <li><dfn id=resource-sharing-check>resource sharing check</dfn>
  1651. </ul>
  1652. <p class=critical>This specification does not yet use the "fetch" algorithm from the WHATWG
  1653. Fetch specification. It will be updated to do so in due course. Some of the terms mentioned
  1654. above are obsolete; this will be fixed when the spec is updated to use the new algorithm.</p>
  1655. <dt>Web IDL<dd>
  1656. <p>The IDL fragments in this specification must be interpreted as required for conforming IDL
  1657. fragments, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  1658. <p>The following terms are defined in the Web IDL specification:</p>
  1659. <ul class=brief><li><dfn id=supported-property-indices>Supported property indices</dfn>
  1660. <li><dfn id=determine-the-value-of-an-indexed-property>Determine the value of an indexed property</dfn>
  1661. <li><dfn id=support-named-properties>Support named properties</dfn>
  1662. <li><dfn id=supported-property-names>Supported property names</dfn>
  1663. <li><dfn id=unenumerable>Unenumerable</dfn>
  1664. <li><dfn id=determine-the-value-of-a-named-property>Determine the value of a named property</dfn>
  1665. <li><dfn id=platform-array-objects>Platform array objects</dfn>
  1666. <li><dfn id=dfn-read-only-array>Read only</dfn> (when applied to arrays)
  1667. <li><dfn id=dfn-callback-this-value>Callback this value</dfn>
  1668. <li><dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>Convert a <code>DOMString</code> to a sequence of Unicode characters</dfn>
  1669. </ul>
  1670. <p>The Web IDL specification also defines the following types that are used in Web IDL fragments
  1671. in this specification:</p>
  1672. <ul class=brief><li><dfn id=idl-array><code>Array</code></dfn>
  1673. <li><dfn id=idl-boolean><code>boolean</code></dfn>
  1674. <li><dfn id=idl-boolean-wrapper><code>Boolean</code></dfn>
  1675. <li><dfn id=idl-date><code>Date</code></dfn>
  1676. <li><dfn id=idl-domstring><code>DOMString</code></dfn>
  1677. <li><dfn id=idl-double><code>double</code></dfn>
  1678. <li><dfn id=idl-error><code>Error</code></dfn>
  1679. <li><dfn id=idl-function><code>Function</code></dfn>
  1680. <li><dfn id=idl-long><code>long</code></dfn>
  1681. <li><dfn id=idl-map><code>Map</code></dfn>
  1682. <li><dfn id=idl-number-wrapper><code>Number</code></dfn>
  1683. <li><dfn id=idl-object><code>Object</code></dfn>
  1684. <li><dfn id=idl-regexp><code>RegExp</code></dfn>
  1685. <li><dfn id=idl-set><code>Set</code></dfn>
  1686. <li><dfn id=idl-string-wrapper><code>String</code></dfn>
  1687. <li><dfn id=idl-unrestricted-double><code>unrestricted double</code></dfn>
  1688. <li><dfn id=idl-unsigned-long><code>unsigned long</code></dfn>
  1689. </ul>
  1690. <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
  1691. special value Not-a-Number), the milliseconds component of that time, if any, must be truncated
  1692. to an integer, and the time value of the newly created <code id=dependencies:idl-date><a href=#idl-date>Date</a></code>
  1693. object must represent the resulting truncated time.</p>
  1694. <p class=example>For instance, given the time 23045 millionths of a second after 01:00 UTC on
  1695. 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
  1696. time as that created representing the time 2000-01-01T00:00:00.023Z, 45 millionths earlier. If
  1697. 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
  1698. represents a time value NaN (indicating that the object does not represent a specific instant of
  1699. time).</p>
  1700. <dt>JavaScript<dd>
  1701. <p>Some parts of the language described by this specification only support JavaScript as the
  1702. underlying scripting language. <a href=#refsECMA262>[ECMA262]</a></p>
  1703. <p class=note>The term "JavaScript" is used to refer to ECMA262, rather than the official term
  1704. ECMAScript, since the term JavaScript is more widely known. Similarly, the <a href=#mime-type id=dependencies:mime-type>MIME
  1705. 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
  1706. 4329. <a href=#refsRFC4329>[RFC4329]</a></p>
  1707. <p>The term <dfn id=javascript-global-environment>JavaScript global environment</dfn> refers to the <i>global
  1708. environment</i> concept defined in the ECMAScript specification.</p>
  1709. <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
  1710. specification. <a href=#refsECMA262>[ECMA262]</a></p>
  1711. <p>The <dfn id=arraybuffer>ArrayBuffer</dfn> and related object types and underlying concepts from the
  1712. ECMAScript Specification are used for several features in this specification. <a href=#refsECMA262>[ECMA262]</a></p>
  1713. <p>The following helper IDL is used for referring to <code id=dependencies:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code>-related types:</p>
  1714. <pre class=idl>typedef (<dfn id=int8array>Int8Array</dfn> or <dfn id=uint8array>Uint8Array</dfn> or <dfn id=uint8clampedarray>Uint8ClampedArray</dfn> or
  1715. <dfn id=int16array>Int16Array</dfn> or <dfn id=uint16array>Uint16Array</dfn> or
  1716. <dfn id=int32array>Int32Array</dfn> or <dfn id=uint32array>Uint32Array</dfn> or
  1717. <dfn id=float32array>Float32Array</dfn> or <dfn id=float64array>Float64Array</dfn> or
  1718. <dfn id=dataview>DataView</dfn>) <dfn id=arraybufferview>ArrayBufferView</dfn>;</pre>
  1719. <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>
  1720. API</a> uses <code id=dependencies:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> objects for handling binary frames.</p>
  1721. <dt>DOM<dd>
  1722. <p>The Document Object Model (DOM) is a representation — a model — of a document and
  1723. its content. The DOM is not just an API; the conformance criteria of HTML implementations are
  1724. defined, in this specification, in terms of operations on the DOM. <a href=#refsDOM>[DOM]</a></p>
  1725. <p>Implementations must support DOM and the events defined in DOM Events, because this
  1726. specification is defined in terms of the DOM, and some of the features are defined as extensions
  1727. to the DOM interfaces. <a href=#refsDOM>[DOM]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
  1728. <p>In particular, the following features are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>
  1729. <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>
  1730. <p>The term <dfn id=throw>throw</dfn> in this specification is used as defined in the DOM specification.
  1731. 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>
  1732. <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>
  1733. <p class=example>For example, to <i>throw a <code id=dependencies:timeouterror><a href=#timeouterror>TimeoutError</a></code> exception</i>, a user
  1734. 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
  1735. actually throw that object as an exception.</p>
  1736. <p>The following features are defined in the DOM Events specification: <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
  1737. <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>
  1738. <p>The following features are defined in the Touch Events specification: <a href=#refsTOUCH>[TOUCH]</a></p>
  1739. <ul class=brief><li><dfn id=touch><code>Touch</code></dfn> interface<li><dfn id=touch-point>Touch point</dfn> concept</ul>
  1740. <p>This specification sometimes uses the term <dfn>name</dfn> to refer to the event's
  1741. <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
  1742. "name" and "type" for events are synonymous.</p>
  1743. <p>The following features are defined in the <cite lang=en-US>DOM Parsing and
  1744. Serialization</cite> specification: <a href=#refsDOMPARSING>[DOMPARSING]</a></p>
  1745. <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>
  1746. <p>The <dfn id=selection><code>Selection</code></dfn> interface is defined in the <cite>HTML Editing
  1747. APIs</cite> specification. <a href=#refsEDITING>[EDITING]</a></p>
  1748. <p class=note>User agents are encouraged to implement the features described in the <cite>HTML
  1749. Editing APIs</cite>
  1750. specification. <a href=#refsEDITING>[EDITING]</a> </p>
  1751. <p>The following parts of the Fullscreen specification are referenced from this specification,
  1752. 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
  1753. Fullscreen API interacts with the sandboxing features in HTML: <a href=#refsFULLSCREEN>[FULLSCREEN]</a></p>
  1754. <ul class=brief><li>The <dfn id=top-layer>top layer</dfn> concept<li><dfn id=dom-element-requestfullscreen><code>requestFullscreen()</code></dfn>
  1755. <li>The <dfn id=fullscreen-enabled-flag>fullscreen enabled flag</dfn><li>The <dfn id=fully-exit-fullscreen>fully exit fullscreen</dfn> algorithm</ul>
  1756. <dt>File API<dd>
  1757. <p>This specification uses the following features defined in the File API specification: <a href=#refsFILEAPI>[FILEAPI]</a></p>
  1758. <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>
  1759. <dt>Media Providers<dd>
  1760. <p>This specification references the following interfaces:</p>
  1761. <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>
  1762. <dt>XMLHttpRequest<dd>
  1763. <p>This specification references the XMLHttpRequest specification to describe how the two
  1764. specifications interact and to use its <code id=dependencies:progressevent><a href=#progressevent>ProgressEvent</a></code> features. The following
  1765. features and terms are defined in the XMLHttpRequest specification: <a href=#refsXHR>[XHR]</a></p>
  1766. <ul class=brief><li><dfn id=xmlhttprequest><code>XMLHttpRequest</code></dfn> interface
  1767. <li><dfn id=dom-xmlhttprequest-responsexml><code>XMLHttpRequest.responseXML</code></dfn> attribute
  1768. <li><dfn id=progressevent><code>ProgressEvent</code></dfn> interface
  1769. <li><dfn id=dom-progressevent-lengthcomputable><code>ProgressEvent.lengthComputable</code></dfn> attribute
  1770. <li><dfn id=dom-progressevent-loaded><code>ProgressEvent.loaded</code></dfn> attribute
  1771. <li><dfn id=dom-progressevent-total><code>ProgressEvent.total</code></dfn> attribute
  1772. <li><dfn id=fire-a-progress-event>Fire a progress event named <var>e</var></dfn>
  1773. </ul>
  1774. <dt>Media Queries<dd>
  1775. <p>Implementations must support the Media Queries language. <a href=#refsMQ>[MQ]</a></p>
  1776. <dt>CSS modules<dd>
  1777. <p>While support for CSS as a whole is not required of implementations of this specification
  1778. (though it is encouraged, at least for Web browsers), some features are defined in terms of
  1779. specific CSS requirements.</p>
  1780. <p>In particular, some features require that a string be <dfn id=parsed-as-a-css-color-value>parsed as a CSS &lt;color>
  1781. value</dfn>. When parsing a CSS value, user agents are required by the CSS specifications to
  1782. apply some error handling rules. These apply to this specification also. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> <a href=#refsCSS>[CSS]</a></p>
  1783. <p class=example>For example, user agents are required to close all open constructs upon
  1784. 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
  1785. parenthesis is implied by this error handling rule, and a value is obtained (the colour 'black').
  1786. However, the similar construct "<code>rgb(0,0,</code>" (with both a missing parenthesis
  1787. and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a
  1788. viable value.</p>
  1789. <p>The term <dfn id=css-element-reference-identifier>CSS element reference identifier</dfn> is used as defined in the <cite>CSS
  1790. Image Values and Replaced Content</cite> specification to define the API that declares
  1791. identifiers for use with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  1792. <p>Similarly, the term <dfn id=provides-a-paint-source>provides a paint source</dfn> is used as defined in the <cite>CSS
  1793. Image Values and Replaced Content</cite> specification to define the interaction of certain HTML
  1794. elements with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  1795. <p>The term <dfn id=default-object-size>default object size</dfn> is also defined in the <cite>CSS Image Values and
  1796. Replaced Content</cite> specification. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  1797. <p>Implementations that support scripting must support the CSS Object Model. The following
  1798. features and terms are defined in the CSSOM specifications: <a href=#refsCSSOM>[CSSOM]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a>
  1799. <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:
  1800. <dfn id=concept-css-style-sheet-type>type</dfn>,
  1801. <dfn id=concept-css-style-sheet-location>location</dfn>,
  1802. <dfn id=concept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet</dfn>,
  1803. <dfn id=concept-css-style-sheet-owner-node>owner node</dfn>,
  1804. <dfn id=concept-css-style-sheet-owner-css-rule>owner CSS rule</dfn>,
  1805. <dfn id=concept-css-style-sheet-media>media</dfn>,
  1806. <dfn id=concept-css-style-sheet-title>title</dfn>,
  1807. <dfn id=concept-css-style-sheet-alternate-flag>alternate flag</dfn>,
  1808. <dfn id=concept-css-style-sheet-disabeld-flag>disabled flag</dfn>,
  1809. <dfn id=concept-css-style-sheet-css-rules>CSS rules</dfn>,
  1810. <dfn id=concept-css-style-sheet-origin-clean-flag>origin-clean flag</dfn>
  1811. <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>
  1812. </ul>
  1813. <p>The term <dfn id=environment-encoding>environment encoding</dfn> is defined in the <cite>CSS Syntax</cite>
  1814. specifications. <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a></p>
  1815. <p>The term <dfn id=css-styling-attribute>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
  1816. specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>
  1817. <p>The <code id=dependencies:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's use of fonts depends on the features
  1818. described in the CSS <cite>Fonts</cite> and <cite>Font Loading</cite> specifications, including
  1819. 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.
  1820. <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
  1821. <dt>SVG<dd>
  1822. <p>The following interface is defined in the SVG specification: <a href=#refsSVG>[SVG]</a></p>
  1823. <ul class=brief><li><dfn id=svgmatrix><code>SVGMatrix</code></dfn> interface
  1824. </ul>
  1825. <dt>WebGL<dd>
  1826. <p>The following interface is defined in the WebGL specification: <a href=#refsWEBGL>[WEBGL]</a></p>
  1827. <ul class=brief><li><dfn id=webglrenderingcontext><code>WebGLRenderingContext</code></dfn> interface
  1828. </ul>
  1829. <dt>WebVTT<dd>
  1830. <p>Implementations may support WebVTT as a text track format for subtitles, captions, chapter
  1831. titles, metadata, etc, for media resources. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  1832. <p>The following terms, used in this specification, are defined in the WebVTT specification:</p>
  1833. <ul class=brief><li><dfn id=webvtt-file>WebVTT file</dfn>
  1834. <li><dfn id=webvtt-file-using-cue-text>WebVTT file using cue text</dfn>
  1835. <li><dfn id=webvtt-file-using-chapter-title-text>WebVTT file using chapter title text</dfn>
  1836. <li><dfn id=webvtt-file-using-only-nested-cues>WebVTT file using only nested cues</dfn>
  1837. <li><dfn id=webvtt-parser>WebVTT parser</dfn>
  1838. <li>The <dfn id=rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</dfn>
  1839. <li>The <dfn id=rules-for-interpreting-webvtt-cue-text>rules for interpreting WebVTT cue text</dfn>
  1840. <li>The WebVTT <dfn id=text-track-cue-writing-direction>text track cue writing direction</dfn>
  1841. <li><dfn id=vttcue><code>VTTCue</code></dfn> interface
  1842. </ul>
  1843. <dt>The WebSocket protocol<dd>
  1844. <p>The following terms are defined in the WebSocket protocol specification: <a href=#refsWSP>[WSP]</a></p>
  1845. <ul class=brief><li><dfn id=concept-websocket-establish>establish a WebSocket connection</dfn>
  1846. <li><dfn id=concept-websocket-established>the WebSocket connection is established</dfn>
  1847. <li><dfn id=concept-websocket-validate>validate the server's response</dfn>
  1848. <li><dfn id=concept-websockets-active-extensions>extensions in use</dfn>
  1849. <li><dfn id=concept-websocket-subprotocol>subprotocol in use</dfn>
  1850. <li><dfn id=concept-websocket-cookie-headers>headers to send appropriate cookies</dfn>
  1851. <li><dfn id=concept-websocket-handshake-cookies>cookies set during the server's opening handshake</dfn>
  1852. <li><dfn id=concept-websocket-message-received>a WebSocket message has been received</dfn>
  1853. <li><dfn id=concept-websocket-send>send a WebSocket Message</dfn>
  1854. <li><dfn id=concept-websocket-fail>fail the WebSocket connection</dfn>
  1855. <li><dfn id=concept-websocket-close>close the WebSocket connection</dfn>
  1856. <li><dfn id=concept-websocket-start-closing-handshake>start the WebSocket closing handshake</dfn>
  1857. <li><dfn id=concept-websocket-closing-handshake>the WebSocket closing handshake is started</dfn>
  1858. <li><dfn id=concept-websocket-closed>the WebSocket connection is closed</dfn> (possibly <i>cleanly</i>)
  1859. <li><dfn id=concept-websocket-close-code>the WebSocket connection close code</dfn>
  1860. <li><dfn id=concept-websocket-close-reason>the WebSocket connection close reason</dfn>
  1861. <li><dfn id=http-sec-websocket-protocol><code>Sec-WebSocket-Protocol</code></dfn> field
  1862. </ul>
  1863. <dt>ARIA<dd>
  1864. <p>The terms <dfn id=strong-native-semantics><a href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header>strong
  1865. 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
  1866. ARIA semantics</a></dfn> has the same meaning as the term <i>implicit WAI-ARIA semantics</i> as used
  1867. in the ARIA specification. <a href=#refsARIA>[ARIA]</a></p>
  1868. <p>The <dfn id=attr-aria-role><code>role</code></dfn> attribute is defined in the ARIA
  1869. specification, as are the following roles: <a href=#refsARIA>[ARIA]</a></p>
  1870. <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>
  1871. <p>In addition, the following <dfn id=attr-aria-*><code>aria-*</code></dfn> content
  1872. attributes are defined in the ARIA specification: <a href=#refsARIA>[ARIA]</a></p>
  1873. <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>
  1874. </dl>
  1875. <p>This specification does not <em>require</em> support of any particular network protocol, style
  1876. sheet language, scripting language, or any of the DOM specifications beyond those required in the
  1877. list above. However, the language described by this specification is biased towards CSS as the
  1878. styling language, JavaScript as the scripting language, and HTTP as the network protocol, and
  1879. several features assume that those languages and protocols are in use.</p>
  1880. <p>A user agent that implements the HTTP protocol must implement the Web Origin Concept
  1881. 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>
  1882. <p class=note>This specification might have certain additional requirements on character
  1883. encodings, image formats, audio formats, and video formats in the respective sections.</p>
  1884. <h4 id=extensibility-2>2.2.3 Extensibility</h4>
  1885. <p>Vendor-specific proprietary user agent extensions to this specification are strongly
  1886. discouraged. Documents must not use such extensions, as doing so reduces interoperability and
  1887. fragments the user base, allowing only users of specific user agents to access the content in
  1888. question.</p>
  1889. <p>If such extensions are nonetheless needed, e.g. for experimental purposes, then vendors are
  1890. strongly urged to use one of the following extension mechanisms:</p>
  1891. <ul><li><p>For markup-level features that can be limited to the XML serialisation and need not be
  1892. supported in the HTML serialisation, vendors should use the namespace mechanism to define custom
  1893. namespaces in which the non-standard elements and attributes are supported.</p>
  1894. <li>
  1895. <p>For markup-level features that are intended for use with <a href=#syntax id=extensibility-2:syntax>the HTML syntax</a>,
  1896. 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
  1897. string that identifies the vendor responsible for the extension, and <var>feature</var> is the
  1898. name of the feature. New element names should not be created. Using attributes for such
  1899. extensions exclusively allows extensions from multiple vendors to co-exist on the same element,
  1900. which would not be possible with elements. Using the "<code>x-<var>vendor</var>-<var>feature</var></code>" form allows extensions to be made
  1901. without risk of conflicting with future additions to the specification.</p>
  1902. <div class=example>
  1903. <p>For instance, a browser named "FerretBrowser" could use "ferret" as a vendor prefix, while a
  1904. browser named "Mellblom Browser" could use "mb". If both of these browsers invented extensions
  1905. that turned elements into scratch-and-sniff areas, an author experimenting with these features
  1906. could write:</p>
  1907. <pre>&lt;p>This smells of lemons!
  1908. &lt;span x-ferret-smellovision x-ferret-smellcode="LEM01"
  1909. x-mb-outputsmell x-mb-smell="lemon juice">&lt;/span>&lt;/p></pre>
  1910. </div>
  1911. </ul>
  1912. <p>Attribute names beginning with the two characters "<code>x-</code>" are reserved for
  1913. user agent use and are guaranteed to never be formally added to the HTML language. For
  1914. flexibility, attributes names containing underscores (the U+005F LOW LINE character) are also
  1915. reserved for experimental purposes and are guaranteed to never be formally added to the HTML
  1916. language.</p>
  1917. <p class=note>Pages that use such attributes are by definition non-conforming.</p>
  1918. <p>For DOM extensions, e.g. new methods and IDL attributes, the new members should be prefixed by
  1919. vendor-specific strings to prevent clashes with future versions of this specification.</p>
  1920. <p>For events, experimental event types should be prefixed with vendor-specific strings.</p>
  1921. <div class=example>
  1922. <p>For example, if a user agent called "Pleasold" were to add an event to indicate when
  1923. the user is going up in an elevator, it could use the prefix "<code>pleasold</code>" and
  1924. thus name the event "<code>pleasoldgoingup</code>", possibly with an event handler
  1925. attribute named "<code>onpleasoldgoingup</code>".</p>
  1926. </div>
  1927. <p>All extensions must be defined so that the use of extensions neither contradicts nor causes the
  1928. non-conformance of functionality defined in the specification.</p>
  1929. <div class=example>
  1930. <p>For example, while strongly discouraged from doing so, an implementation "Foo Browser" could
  1931. add a new IDL attribute "<code>fooTypeTime</code>" to a control's DOM interface that
  1932. returned the time it took the user to select the current value of a control (say). On the other
  1933. 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,
  1934. 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
  1935. this specification.</p>
  1936. </div>
  1937. <p>When adding new <a href=#reflect id=extensibility-2:reflect>reflecting</a> IDL attributes corresponding to
  1938. content attributes of the form "<code>x-<var>vendor</var>-<var>feature</var></code>",
  1939. the IDL attribute should be named "<code><var>vendor</var><var>Feature</var></code>"
  1940. (i.e. the "<code>x</code>" is dropped from the IDL attribute's name).</p>
  1941. <hr>
  1942. <p>When vendor-neutral extensions to this specification are needed, either this specification can
  1943. be updated accordingly, or an extension specification can be written that overrides the
  1944. requirements in this specification. When someone applying this specification to their activities
  1945. decides that they will recognise the requirements of such an extension specification, it becomes
  1946. an <dfn id=other-applicable-specifications>applicable specification</dfn> for the purposes of
  1947. conformance requirements in this specification.</p>
  1948. <p class=note>Someone could write a specification that defines any arbitrary byte stream as
  1949. conforming, and then claim that their random junk is conforming. However, that does not mean that
  1950. their random junk actually is conforming for everyone's purposes: if someone else decides that
  1951. that specification does not apply to their work, then they can quite legitimately say that the
  1952. aforementioned random junk is just that, junk, and not conforming at all. As far as conformance
  1953. goes, what matters in a particular community is what that community <em>agrees</em> is
  1954. applicable.</p>
  1955. <hr>
  1956. <p>User agents must treat elements and attributes that they do not understand as semantically
  1957. neutral; leaving them in the DOM (for DOM processors), and styling them according to CSS (for CSS
  1958. processors), but not inferring any meaning from them.</p>
  1959. <p>When support for a feature is disabled (e.g. as an emergency measure to mitigate a security
  1960. problem, or to aid in development, or for performance reasons), user agents must act as if they
  1961. had no support for the feature whatsoever, and as if the feature was not mentioned in this
  1962. specification. For example, if a particular feature is accessed via an attribute in a Web IDL
  1963. interface, the attribute itself would be omitted from the objects that implement that interface
  1964. — leaving the attribute on the object but making it return null or throw an exception is
  1965. insufficient.</p>
  1966. <h4 id=interactions-with-xpath-and-xslt>2.2.4 Interactions with XPath and XSLT</h4>
  1967. <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
  1968. documents</a> parsed or created in the manners described in this specification (e.g. as part of
  1969. the <code>document.evaluate()</code> API) must act as if the following edit was applied
  1970. to the XPath 1.0 specification.</p>
  1971. <p>First, remove this paragraph:</p>
  1972. <blockquote cite=http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests>
  1973. <p>A <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> in the node test is expanded
  1974. into an <a href=http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name>expanded-name</a>
  1975. using the namespace declarations from the expression context. This is the same way expansion is
  1976. done for element type names in start and end-tags except that the default namespace declared with
  1977. <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
  1978. namespace URI is null (this is the same way attribute names are expanded). It is an error if the
  1979. <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> has a prefix for which there is
  1980. no namespace declaration in the expression context.</p>
  1981. </blockquote>
  1982. <p>Then, insert in its place the following:</p>
  1983. <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">
  1984. <p>A QName in the node test is expanded into an expanded-name using the namespace declarations
  1985. from the expression context. If the QName has a prefix, then there must be a namespace declaration for this prefix in
  1986. the expression context, and the corresponding namespace URI is the one that is
  1987. associated with this prefix. It is an error if the QName has a prefix for which there is no
  1988. namespace declaration in the expression context. </p>
  1989. <p>If the QName has no prefix and the principal node type of the axis is element, then the
  1990. default element namespace is used. Otherwise if the QName has no prefix, the namespace URI is
  1991. null. The default element namespace is a member of the context for the XPath expression. The
  1992. value of the default element namespace when executing an XPath expression through the DOM3 XPath
  1993. API is determined in the following way:</p>
  1994. <ol><li>If the context node is from an HTML DOM, the default element namespace is
  1995. "http://www.w3.org/1999/xhtml".<li>Otherwise, the default element namespace URI is null.</ol>
  1996. <p class=note>This is equivalent to adding the default element namespace feature of XPath 2.0
  1997. to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents.
  1998. It is motivated by the desire to have implementations be compatible with legacy HTML content
  1999. while still supporting the changes that this specification introduces to HTML regarding the
  2000. namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0.</p>
  2001. </blockquote>
  2002. <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,
  2003. motivated by desire to have implementations be compatible with legacy content while still
  2004. supporting the changes that this specification introduces to HTML regarding which namespace is
  2005. used for HTML elements. <a href=#refsXPATH10>[XPATH10]</a></p>
  2006. <hr>
  2007. <p id=dom-based-xslt-1.0-processors>XSLT 1.0 processors outputting to a DOM when the output
  2008. method is "html" (either explicitly or via the defaulting rule in XSLT 1.0) are affected as
  2009. follows:</p>
  2010. <p>If the transformation program outputs an element in no namespace, the processor must, prior to
  2011. constructing the corresponding DOM element node, change the namespace of the element to the
  2012. <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
  2013. 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
  2014. names of any non-namespaced attributes on the element.</p>
  2015. <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
  2016. specification, required because this specification changes the namespaces and case-sensitivity
  2017. rules of HTML in a manner that would otherwise be incompatible with DOM-based XSLT
  2018. transformations. (Processors that serialise the output are unaffected.) <a href=#refsXSLT10>[XSLT10]</a></p>
  2019. <hr>
  2020. <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
  2021. parser</a> infrastructure (for example, whether an XSLT processor acts as if it puts any
  2022. 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
  2023. 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
  2024. readiness</a> first to "<code>interactive</code>" and then to "<code>complete</code>" if they are aborted.</p>
  2025. <hr>
  2026. <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
  2027. how error pages are to be handled (e.g. whether XSLT errors are to replace an incremental XSLT
  2028. output, or are rendered inline, etc).</p>
  2029. <p class=note>There are also additional non-normative comments regarding the interaction of XSLT
  2030. and HTML <a href=#scriptTagXSLT>in the <code>script</code> element section</a>, and of
  2031. XSLT, XPath, and HTML <a href=#template-XSLT-XPath>in the <code>template</code> element
  2032. section</a>.</p>
  2033. <h3 id=case-sensitivity-and-string-comparison>2.3 Case-sensitivity and string comparison</h3>
  2034. <p>Comparing two strings in a <dfn id=case-sensitive>case-sensitive</dfn> manner means comparing them exactly, code
  2035. point for code point.</p>
  2036. <p>Comparing two strings in an <dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn> manner means comparing them
  2037. exactly, code point for code point, except that the characters in the range U+0041 to U+005A (i.e.
  2038. LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding characters in the range
  2039. U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z) are considered to also
  2040. match.</p>
  2041. <p>Comparing two strings in a <dfn id=compatibility-caseless>compatibility caseless</dfn> manner means using the Unicode
  2042. <i>compatibility caseless match</i> operation to compare the two strings, with no
  2043. language-specific tailoirings. <a href=#refsUNICODE>[UNICODE]</a></p>
  2044. <p>Except where otherwise stated, string comparisons must be performed in a
  2045. <a href=#case-sensitive id=case-sensitivity-and-string-comparison:case-sensitive>case-sensitive</a> manner.</p>
  2046. <p><dfn id=converted-to-ascii-uppercase>Converting a string to ASCII uppercase</dfn> means
  2047. replacing all characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL
  2048. LETTER Z) with the corresponding characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL
  2049. LETTER A to LATIN CAPITAL LETTER Z).</p>
  2050. <p><dfn id=converted-to-ascii-lowercase>Converting a string to ASCII lowercase</dfn> means
  2051. replacing all characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN
  2052. CAPITAL LETTER Z) with the corresponding characters in the range U+0061 to U+007A (i.e. LATIN
  2053. SMALL LETTER A to LATIN SMALL LETTER Z).</p>
  2054. <p>A string <var>pattern</var> is a <dfn id=prefix-match>prefix match</dfn> for a string <var>s</var> when
  2055. <var>pattern</var> is not longer than <var>s</var> and truncating <var>s</var> to
  2056. <var>pattern</var>'s length leaves the two strings as matches of each other.</p>
  2057. <h3 id=common-microsyntaxes>2.4 Common microsyntaxes</h3>
  2058. <p>There are various places in HTML that accept particular data types, such as dates or numbers.
  2059. This section describes what the conformance criteria for content in those formats is, and how to
  2060. parse them.</p>
  2061. <p class=note>Implementors are strongly urged to carefully examine any third-party libraries
  2062. they might consider using to implement the parsing of syntaxes described below. For example, date
  2063. libraries are likely to implement error handling behavior that differs from what is required in
  2064. this specification, since error-handling behavior is often not defined in specifications that
  2065. describe date syntaxes similar to those used in this specification, and thus implementations tend
  2066. to vary greatly in how they handle errors.</p>
  2067. <h4 id=common-parser-idioms>2.4.1 Common parser idioms</h4>
  2068. <p>The <dfn id=space-character>space characters</dfn>, for the purposes of this
  2069. specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C
  2070. FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).</p>
  2071. <p>The <dfn id=white_space>White_Space characters</dfn> are those that have the Unicode
  2072. property "White_Space" in the Unicode <code>PropList.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>
  2073. <p class=note>This should not be confused with the "White_Space" value (abbreviated "WS") of the
  2074. "Bidi_Class" property in the <code>Unicode.txt</code> data file.</p>
  2075. <p>The <dfn id=control-characters>control characters</dfn> are those whose Unicode "General_Category" property has the
  2076. value "Cc" in the Unicode <code>UnicodeData.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>
  2077. <p>The <dfn id=uppercase-ascii-letters>uppercase ASCII letters</dfn> are the characters in the range U+0041 LATIN CAPITAL
  2078. LETTER A to U+005A LATIN CAPITAL LETTER Z.</p>
  2079. <p>The <dfn id=lowercase-ascii-letters>lowercase ASCII letters</dfn> are the characters in the range U+0061 LATIN SMALL
  2080. LETTER A to U+007A LATIN SMALL LETTER Z.</p>
  2081. <p>The <dfn id=ascii-digits>ASCII digits</dfn> are the characters in the range U+0030 DIGIT ZERO (0) to U+0039
  2082. DIGIT NINE (9).</p>
  2083. <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
  2084. 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>
  2085. <p>The <dfn id=ascii-hex-digits>ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
  2086. U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061
  2087. LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F.</p>
  2088. <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
  2089. U+0039 DIGIT NINE (9) and U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F only.</p>
  2090. <p>The <dfn id=lowercase-ascii-hex-digits>lowercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO
  2091. (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F
  2092. only.</p>
  2093. <p>Some of the micro-parsers described below follow the pattern of having an <var>input</var>
  2094. variable that holds the string being parsed, and having a <var>position</var> variable pointing at
  2095. the next character to parse in <var>input</var>.</p>
  2096. <p>For parsers based on this pattern, a step that requires the user agent to <dfn id=collect-a-sequence-of-characters>collect a
  2097. sequence of characters</dfn> means that the following algorithm must be run, with
  2098. <var>characters</var> being the set of characters that can be collected:</p>
  2099. <ol><li><p>Let <var>input</var> and <var>position</var> be the same variables as
  2100. 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
  2101. at <var>position</var> is one of the <var>characters</var>, append that character to the end of
  2102. <var>result</var> and advance <var>position</var> to the next character in
  2103. <var>input</var>.<li><p>Return <var>result</var>.</ol>
  2104. <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
  2105. characters</a> that are <a href=#space-character id=common-parser-idioms:space-character>space characters</a>. The collected
  2106. characters are not used. </p>
  2107. <p>When a user agent is to <dfn id=strip-line-breaks>strip line breaks</dfn> from a string, the user agent must remove
  2108. any U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters from that string.</p>
  2109. <p>When a user agent is to <dfn id=strip-leading-and-trailing-whitespace>strip leading and trailing whitespace</dfn> from a string, the
  2110. user agent must remove all <a href=#space-character id=common-parser-idioms:space-character-2>space characters</a> that are at the
  2111. start or end of the string.</p>
  2112. <p>When a user agent is to <dfn id=strip-and-collapse-whitespace>strip and collapse whitespace</dfn> in a string, it must replace
  2113. any sequence of one or more consecutive <a href=#space-character id=common-parser-idioms:space-character-3>space characters</a> in
  2114. 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
  2115. whitespace</a> from that string.</p>
  2116. <p>When a user agent has to <dfn id=strictly-split-a-string>strictly split a string</dfn> on a particular delimiter character
  2117. <var>delimiter</var>, it must use the following algorithm:</p>
  2118. <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
  2119. 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>
  2120. <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>
  2121. 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>
  2122. <li><p>Return <var>tokens</var>.</ol>
  2123. <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
  2124. 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>
  2125. <h4 id=boolean-attributes>2.4.2 Boolean attributes</h4>
  2126. <p>A number of attributes are <dfn id=boolean-attribute>boolean attributes</dfn>. The
  2127. presence of a boolean attribute on an element represents the true value, and the absence of the
  2128. attribute represents the false value.</p>
  2129. <p>If the attribute is present, its value must either be the empty string or a value that is an
  2130. <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
  2131. trailing whitespace.</p>
  2132. <p class=note>The values "true" and "false" are not allowed on boolean attributes. To represent
  2133. a false value, the attribute has to be omitted altogether.</p>
  2134. <div class=example>
  2135. <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>
  2136. attributes are the boolean attributes.</p>
  2137. <pre>&lt;label>&lt;input type=checkbox checked name=cheese disabled> Cheese&lt;/label></pre>
  2138. <p>This could be equivalently written as this:
  2139. <pre>&lt;label>&lt;input type=checkbox checked=checked name=cheese disabled=disabled> Cheese&lt;/label></pre>
  2140. <p>You can also mix styles; the following is still equivalent:</p>
  2141. <pre>&lt;label>&lt;input type='checkbox' checked name=cheese disabled=""> Cheese&lt;/label></pre>
  2142. </div>
  2143. <h4 id=keywords-and-enumerated-attributes>2.4.3 Keywords and enumerated attributes</h4>
  2144. <p>Some attributes are defined as taking one of a finite set of keywords. Such attributes are
  2145. called <dfn id=enumerated-attribute>enumerated attributes</dfn>. The keywords are each
  2146. defined to map to a particular <em>state</em> (several keywords might map to the same state, in
  2147. which case some of the keywords are synonyms of each other; additionally, some of the keywords can
  2148. be said to be non-conforming, and are only in the specification for historical reasons). In
  2149. addition, two default states can be given. The first is the <dfn id=invalid-value-default><i>invalid value default</i></dfn>, the
  2150. second is the <dfn id=missing-value-default><i>missing value default</i></dfn>.</p>
  2151. <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
  2152. case-insensitive</a> match for one of the given keywords that are not said to be
  2153. non-conforming, with no leading or trailing whitespace.</p>
  2154. <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
  2155. for one of the given keywords then that keyword's state is the state that the attribute
  2156. represents. If the attribute value matches none of the given keywords, but the attribute has an
  2157. <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
  2158. 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
  2159. defined, then <em>that</em> is the state represented by the attribute. Otherwise, there is no
  2160. default, and invalid values mean that there is no state represented.</p>
  2161. <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
  2162. defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of
  2163. the attribute means that there is no state represented.</p>
  2164. <p class=note>The empty string can be a valid keyword.</p>
  2165. <h4 id=numbers>2.4.4 Numbers</h4>
  2166. <h5 id=signed-integers>2.4.4.1 Signed integers</h5>
  2167. <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>,
  2168. optionally prefixed with a U+002D HYPHEN-MINUS character (-).</p>
  2169. <p>A <a href=#valid-integer id=signed-integers:valid-integer>valid integer</a> without a U+002D HYPHEN-MINUS (-) prefix represents the number
  2170. 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>
  2171. <em>with</em> a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by
  2172. the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero.</p>
  2173. <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are as given in the following algorithm. When
  2174. invoked, the steps must be followed in the order given, aborting at the first step that returns a
  2175. value. This algorithm will return either an integer or an error.</p>
  2176. <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
  2177. 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>
  2178. <p>If the character indicated by <var>position</var> (the first character) is a U+002D
  2179. HYPHEN-MINUS character (-):</p>
  2180. <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>
  2181. <p>Otherwise, if the character indicated by <var>position</var> (the first character) is a
  2182. U+002B PLUS SIGN character (+):</p>
  2183. <ol><li>Advance <var>position</var> to the next character. (The "<code>+</code>" is
  2184. ignored, but it is not conforming.)<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
  2185. <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
  2186. interpret the resulting sequence as a base-ten integer. Let <var>value</var> be that
  2187. integer.<li><p>If <var>sign</var> is "positive", return <var>value</var>, otherwise return the result of
  2188. subtracting <var>value</var> from zero.</ol>
  2189. <h5 id=non-negative-integers>2.4.4.2 Non-negative integers</h5>
  2190. <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
  2191. digits</a>.</p>
  2192. <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
  2193. by that string of digits.</p>
  2194. <p>The <dfn id=rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</dfn> are as given in the following algorithm.
  2195. When invoked, the steps must be followed in the order given, aborting at the first step that
  2196. returns a value. This algorithm will return either zero, a positive integer, or an error.</p>
  2197. <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
  2198. <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>
  2199. <h5 id=floating-point-numbers>2.4.4.3 Floating-point numbers</h5>
  2200. <p>A string is a <dfn id=valid-floating-point-number>valid floating-point number</dfn> if it consists of:</p>
  2201. <ol class=brief><li>Optionally, a U+002D HYPHEN-MINUS character (-).<li>One or both of the following, in the given order:
  2202. <ol><li>A series of one or more <a href=#ascii-digits id=floating-point-numbers:ascii-digits>ASCII digits</a>.<li>
  2203. <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>
  2204. </ol>
  2205. <li>Optionally:
  2206. <ol><li>Either a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E
  2207. 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>
  2208. </ol>
  2209. <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
  2210. significand by ten raised to the power of the exponent, where the significand is the first number,
  2211. interpreted as base ten (including the decimal point and the number after the decimal point, if
  2212. any, and interpreting the significand as a negative number if the whole string starts with a
  2213. U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the
  2214. number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS
  2215. character (-) between the E and the number and the number is not zero, or else ignoring a U+002B
  2216. PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the
  2217. exponent is treated as zero.</p>
  2218. <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>
  2219. <p>The <dfn id=best-representation-of-the-number-as-a-floating-point-number>best
  2220. representation of the number <var>n</var> as a floating-point number</dfn> is the string
  2221. obtained from applying the JavaScript operator ToString to <var>n</var>. The JavaScript
  2222. operator ToString is not uniquely determined. When there are multiple possible strings that could
  2223. be obtained from the JavaScript operator ToString for a particular value, the user agent must
  2224. always return the same string for that value (though it may differ from the value used by other
  2225. user agents).</p>
  2226. <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
  2227. algorithm. This algorithm must be aborted at the first step that returns something. This algorithm
  2228. will return either a number or an error.</p>
  2229. <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
  2230. 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>
  2231. <p>If the character indicated by <var>position</var> is a U+002D HYPHEN-MINUS character (-):</p>
  2232. <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>
  2233. <p>Otherwise, if the character indicated by <var>position</var> (the first character) is a
  2234. U+002B PLUS SIGN character (+):</p>
  2235. <ol><li>Advance <var>position</var> to the next character. (The "<code>+</code>"
  2236. is ignored, but it is not conforming.)<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
  2237. <li><p>If the character indicated by <var>position</var> is a U+002E FULL STOP (.), and that is
  2238. not the last character in <var>input</var>, and the character after the character indicated by
  2239. <var>position</var> is an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-4>ASCII digit</a>, then set
  2240. <var>value</var> to zero and jump to the step labeled <i>fraction</i>.</p>
  2241. <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
  2242. interpret the resulting sequence as a base-ten integer. Multiply <var>value</var> by that
  2243. integer.<li>If <var>position</var> is past the end of <var>input</var>, jump to the step labeled
  2244. <i>conversion</i>.<li><p><i>Fraction</i>: If the character indicated by <var>position</var> is a U+002E
  2245. FULL STOP (.), run these substeps:</p>
  2246. <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
  2247. indicated by <var>position</var> is not an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-7>ASCII digit</a>,
  2248. U+0065 LATIN SMALL LETTER E (e), or U+0045 LATIN CAPITAL LETTER E (E), then jump to the step
  2249. labeled <i>conversion</i>.<li><p>If the character indicated by <var>position</var> is a U+0065 LATIN SMALL
  2250. LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), skip the remainder of
  2251. these substeps.</p>
  2252. <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
  2253. 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
  2254. 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
  2255. substeps.</ol>
  2256. <li><p>If the character indicated by <var>position</var> is a U+0065 LATIN SMALL LETTER
  2257. E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), run these substeps:</p>
  2258. <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
  2259. labeled <i>conversion</i>.<li>
  2260. <p>If the character indicated by <var>position</var> is a U+002D HYPHEN-MINUS character
  2261. (-):</p>
  2262. <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
  2263. labeled <i>conversion</i>.</ol>
  2264. <p>Otherwise, if the character indicated by <var>position</var> is a U+002B PLUS SIGN
  2265. character (+):</p>
  2266. <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
  2267. labeled <i>conversion</i>.</ol>
  2268. <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
  2269. interpret the resulting sequence as a base-ten integer. Multiply <var>exponent</var>
  2270. by that integer.<li><p>Multiply <var>value</var> by ten raised to the <var>exponent</var>th power.</ol>
  2271. <li><p><i>Conversion</i>: Let <var>S</var> be the set of finite IEEE 754 double-precision
  2272. 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
  2273. <var>value</var>, selecting the number with an even significand if there are two equally close
  2274. values. (The two special values 2<sup>1024</sup> and −2<sup>1024</sup>
  2275. 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>
  2276. <h5 id=percentages-and-dimensions>2.4.4.4 Percentages and lengths</h5>
  2277. <p>The <dfn id=rules-for-parsing-dimension-values>rules for parsing dimension values</dfn> are as given in the following algorithm. When
  2278. invoked, the steps must be followed in the order given, aborting at the first step that returns a
  2279. value. This algorithm will return either a number greater than or equal to 1.0, or an error; if a
  2280. number is returned, then it is further categorised as either a percentage or a length.</p>
  2281. <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
  2282. 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 (+),
  2283. 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,
  2284. 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
  2285. 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
  2286. 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
  2287. length.<li>
  2288. <p>If the character indicated by <var>position</var> is a U+002E FULL STOP character (.):</p>
  2289. <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
  2290. indicated by <var>position</var> is not an <a href=#ascii-digits id=percentages-and-dimensions:ascii-digits-2>ASCII digit</a>, then
  2291. 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
  2292. 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>
  2293. 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
  2294. substeps.</ol>
  2295. <li><p>If <var>position</var> is past the end of <var>input</var>, return <var>value</var> as a
  2296. length.<li><p>If the character indicated by <var>position</var> is a U+0025 PERCENT SIGN character (%),
  2297. return <var>value</var> as a percentage.<li><p>Return <var>value</var> as a length.</ol>
  2298. <h5 id=lists-of-integers>2.4.4.5 Lists of integers</h5>
  2299. <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
  2300. 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
  2301. number of integers that can be given, or on the range of values allowed.</p>
  2302. <p>The <dfn id=rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</dfn> are as follows:</p>
  2303. <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
  2304. start of the string.<li><p>Let <var>numbers</var> be an initially empty list of integers. This list will be the
  2305. result of this algorithm.<li><p>If there is a character in the string <var>input</var> at position <var>position</var>,
  2306. and it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then advance
  2307. <var>position</var> to the next character in <var>input</var>, or to beyond the end of the string
  2308. if there are no more characters.<li><p>If <var>position</var> points to beyond the end of <var>input</var>, return
  2309. <var>numbers</var> and abort.<li><p>If the character in the string <var>input</var> at position <var>position</var> is a
  2310. 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
  2311. 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
  2312. number.<li><p>Let <var>finished</var> be false. This variable is set to true to switch parser into a
  2313. 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
  2314. <var>position</var> is:</p>
  2315. <dl class=switch><dt>A U+002D HYPHEN-MINUS character<dd>
  2316. <p>Follow these substeps:</p>
  2317. <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
  2318. <var>negated</var> be true.<li>Let <var>started</var> be true.</ol>
  2319. <dt>An <a href=#ascii-digits id=lists-of-integers:ascii-digits>ASCII digit</a><dd>
  2320. <p>Follow these substeps:</p>
  2321. <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>
  2322. <dt>A U+0020 SPACE character<dt>A U+002C COMMA character<dt>A U+003B SEMICOLON character<dd>
  2323. <p>Follow these substeps:</p>
  2324. <ol><li>If <var>got number</var> is false, return the <var>numbers</var> list and abort. This
  2325. 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>
  2326. <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
  2327. (i.e. any other non-alphabetic ASCII character)<dd>
  2328. <p>Follow these substeps:</p>
  2329. <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>
  2330. <dt>Any other character<dd>
  2331. <p>Follow these substeps:</p>
  2332. <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
  2333. value in <var>value</var> is not appended to the list first; it is dropped.)</ol>
  2334. </dl>
  2335. <li><p>Advance <var>position</var> to the next character in <var>input</var>, or to beyond the
  2336. 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
  2337. <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>
  2338. list.<li><p>Return the <var>numbers</var> list and abort.</ol>
  2339. <h5 id=lists-of-dimensions>2.4.4.6 Lists of dimensions</h5>
  2340. <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
  2341. of zero or more pairs consisting of a number and a unit, the unit being one of <i>percentage</i>,
  2342. <i>relative</i>, and <i>absolute</i>.</p>
  2343. <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 (,),
  2344. 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
  2345. 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>
  2346. <p>For each token in <var>raw tokens</var>, run the following substeps:</p>
  2347. <ol><li><p>Let <var>input</var> be the token.<li><p>Let <var>position</var> be a pointer into <var>input</var>,
  2348. 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
  2349. digits</a>, interpret the resulting sequence as an integer in base ten, and increment <var>value</var> by that integer.<li>
  2350. <p>If the character at <var>position</var> is a U+002E FULL STOP character (.), run
  2351. these substeps:</p>
  2352. <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>
  2353. 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>
  2354. <p>If <var>s</var> is not the empty string, run these subsubsteps:</p>
  2355. <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>
  2356. </ol>
  2357. <li><p><a href=#skip-whitespace id=lists-of-dimensions:skip-whitespace>Skip whitespace</a>.<li>
  2358. <p>If the character at <var>position</var> is a U+0025 PERCENT SIGN character (%),
  2359. then set <var>unit</var> to <i>percentage</i>.</p>
  2360. <p>Otherwise, if the character at <var>position</var> is a U+002A ASTERISK character
  2361. (*), then set <var>unit</var> to <i>relative</i>.</p>
  2362. <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>
  2363. <li><p>Return the list <var>result</var>.</ol>
  2364. <h4 id=dates-and-times>2.4.5 Dates and times</h4>
  2365. <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
  2366. <var>year</var></dfn> is: <em>31</em> if <var>month</var> is 1, 3, 5, 7, 8,
  2367. 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
  2368. takes into account leap years in the Gregorian calendar. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2369. <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,
  2370. they express numbers in base ten.</p>
  2371. <p class=note>While the formats described here are intended to be subsets of the corresponding
  2372. ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601.
  2373. Implementors are therefore encouraged to carefully examine any date parsing libraries before using
  2374. them to implement the parsing rules described below; ISO8601 libraries might not parse dates and
  2375. times in exactly the same manner. <a href=#refsISO8601>[ISO8601]</a></p>
  2376. <p>Where this specification refers to the <dfn id=proleptic-gregorian-calendar>proleptic Gregorian calendar</dfn>, it means the
  2377. 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
  2378. Gregorian calendar</a>, sometimes explicitly referred to as a <dfn id=proleptic-gregorian-date>proleptic-Gregorian
  2379. date</dfn>, is one that is described using that calendar even if that calendar was not in use at
  2380. the time (or place) in question. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2381. <p class=note>The use of the Gregorian calendar as the wire format in this specification is an
  2382. arbitrary choice resulting from the cultural biases of those involved in the decision. See also
  2383. the section discussing <a href=#input-author-notes>date, time, and number formats</a> in forms
  2384. (for authors), <a href=#input-impl-notes>implemention notes regarding
  2385. 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>
  2386. <h5 id=months>2.4.5.1 Months</h5>
  2387. <p>A <dfn id=concept-month>month</dfn> consists of a specific <a href=#proleptic-gregorian-date id=months:proleptic-gregorian-date>proleptic-Gregorian
  2388. date</a> with no time-zone information and no date information beyond a year and a month. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2389. <p>A string is a <dfn id=valid-month-string>valid month string</dfn> representing a year <var>year</var> and
  2390. month <var>month</var> if it consists of the following components in the given order:</p>
  2391. <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
  2392. 1 ≤ <var>month</var> ≤ 12</ol>
  2393. <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
  2394. month, or nothing. If at any point the algorithm says that it "fails", this means that it is
  2395. aborted at that point and returns nothing.</p>
  2396. <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
  2397. 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>
  2398. <li><p>If <var>position</var> is <em>not</em> beyond the
  2399. end of <var>input</var>, then fail.<li><p>Return <var>year</var> and <var>month</var>.</ol>
  2400. <p>The rules to <dfn id=parse-a-month-component>parse a month component</dfn>, given an <var>input</var> string and
  2401. a <var>position</var>, are as follows. This will return either a year and a month, or
  2402. nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  2403. point and returns nothing.</p>
  2404. <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
  2405. collected sequence is not at least four characters long, then fail. Otherwise, interpret the
  2406. 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
  2407. character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
  2408. 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
  2409. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2410. 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>
  2411. <h5 id=dates>2.4.5.2 Dates</h5>
  2412. <p>A <dfn id=concept-date>date</dfn> consists of a specific <a href=#proleptic-gregorian-date id=dates:proleptic-gregorian-date>proleptic-Gregorian
  2413. date</a> with no time-zone information, consisting of a year, a month, and a day. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2414. <p>A string is a <dfn id=valid-date-string>valid date string</dfn> representing a year <var>year</var>, month
  2415. <var>month</var>, and day <var>day</var> if it consists of the following
  2416. components in the given order:</p>
  2417. <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
  2418. 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
  2419. days in the month <var>month</var> and year <var>year</var></a></ol>
  2420. <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
  2421. nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  2422. point and returns nothing.</p>
  2423. <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
  2424. 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>
  2425. <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>
  2426. <p>The rules to <dfn id=parse-a-date-component>parse a date component</dfn>, given an <var>input</var> string and a
  2427. <var>position</var>, are as follows. This will return either a year, a month, and a day,
  2428. or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at
  2429. that point and returns nothing.</p>
  2430. <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
  2431. character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
  2432. 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
  2433. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2434. 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>
  2435. <h5 id=yearless-dates>2.4.5.3 Yearless dates</h5>
  2436. <p>A <dfn id=concept-yearless-date>yearless date</dfn> consists of a Gregorian month and a
  2437. day within that month, but with no associated year. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2438. <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
  2439. in the given order:</p>
  2440. <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
  2441. 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
  2442. 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
  2443. days</a> in the month <var>month</var> and any arbitrary leap year (e.g. 4 or
  2444. 2000)</ol>
  2445. <p class=note>In other words, if the <var>month</var> is "<code>02</code>",
  2446. meaning February, then the day can be 29, as if the year was a leap year.</p>
  2447. <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
  2448. month and a day, or nothing. If at any point the algorithm says that it "fails", this means that
  2449. it is aborted at that point and returns nothing.</p>
  2450. <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
  2451. 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>
  2452. <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>
  2453. <p>The rules to <dfn id=parse-a-yearless-date-component>parse a yearless date component</dfn>, given an <var>input</var>
  2454. string and a <var>position</var>, are as follows. This will return either a month and a
  2455. day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted
  2456. at that point and returns nothing.</p>
  2457. <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 (-).
  2458. 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
  2459. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2460. 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
  2461. or 2000).<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
  2462. character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
  2463. 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
  2464. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2465. 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>
  2466. <h5 id=times>2.4.5.4 Times</h5>
  2467. <p>A <dfn id=concept-time>time</dfn> consists of a specific time with no time-zone
  2468. information, consisting of an hour, a minute, a second, and a fraction of a second.</p>
  2469. <p>A string is a <dfn id=valid-time-string>valid time string</dfn> representing an hour <var>hour</var>, a
  2470. minute <var>minute</var>, and a second <var>second</var> if it consists of the
  2471. following components in the given order:</p>
  2472. <ol><li>Two <a href=#ascii-digits id=times:ascii-digits>ASCII digits</a>, representing <var>hour</var>, in the range
  2473. 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
  2474. 0 ≤ <var>minute</var> ≤ 59<li>If <var>second</var> is non-zero, or optionally if <var>second</var> is
  2475. zero:
  2476. <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>,
  2477. 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:
  2478. <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>
  2479. </ol>
  2480. </ol>
  2481. <p class=note>The <var>second</var> component cannot be 60 or 61; leap seconds cannot
  2482. be represented.</p>
  2483. <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
  2484. nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
  2485. point and returns nothing.</p>
  2486. <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
  2487. 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>
  2488. <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>
  2489. <p>The rules to <dfn id=parse-a-time-component>parse a time component</dfn>, given an <var>input</var> string and a
  2490. <var>position</var>, are as follows. This will return either an hour, a minute, and a
  2491. second, or nothing. If at any point the algorithm says that it "fails", this means that it is
  2492. aborted at that point and returns nothing.</p>
  2493. <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
  2494. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2495. 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
  2496. character at <var>position</var> is not a U+003A COLON character, then fail. Otherwise,
  2497. 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
  2498. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2499. 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>
  2500. <p>If <var>position</var> is not beyond the end of <var>input</var> and the
  2501. character at <var>position</var> is a U+003A COLON, then run these substeps:</p>
  2502. <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
  2503. 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
  2504. 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>
  2505. or U+002E FULL STOP characters. If the collected sequence is three characters long, or if it is
  2506. longer than three characters long and the third character is not a U+002E FULL STOP character,
  2507. or if it has more than one U+002E FULL STOP character, then fail. Otherwise, let the collected
  2508. string be <var>second</var> instead of its previous value.</ol>
  2509. <li><p>Interpret <var>second</var> as a base-ten number (possibly with a fractional
  2510. 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> &lt; 60, then fail.<li><p>Return <var>hour</var>, <var>minute</var>, and <var>second</var>.</ol>
  2511. <h5 id=local-dates-and-times>2.4.5.5 Local dates and times</h5>
  2512. <p>A <dfn id=concept-datetime-local>local date and time</dfn> consists of a specific
  2513. <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,
  2514. consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a
  2515. time zone. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2516. <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
  2517. consists of the following components in the given order:</p>
  2518. <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>
  2519. <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
  2520. time if it consists of the following components in the given order:</p>
  2521. <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
  2522. string for the given time (e.g. omitting the seconds component entirely if the given time is zero
  2523. seconds past the minute)</ol>
  2524. <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
  2525. either a date and time, or nothing. If at any point the algorithm says that it "fails", this means
  2526. that it is aborted at that point and returns nothing.</p>
  2527. <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
  2528. 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>
  2529. <li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
  2530. character at <var>position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
  2531. (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var>position</var>
  2532. 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>
  2533. <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>
  2534. <h5 id=time-zones>2.4.5.6 Time zones</h5>
  2535. <p>A <dfn id=concept-timezone>time-zone offset</dfn> consists of a signed number of hours and
  2536. minutes.</p>
  2537. <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
  2538. consists of either:</p>
  2539. <ul><li><p>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only if the time zone is
  2540. UTC<li>
  2541. <p>Or, the following components, in the given order:</p>
  2542. <ol><li>Either a U+002B PLUS SIGN character (+) or, if the time-zone offset is not zero, a U+002D
  2543. 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
  2544. 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>
  2545. </ul>
  2546. <p class=note>This format allows for time-zone offsets from -23:59 to +23:59. Right now, in
  2547. practice, the range of offsets of actual time zones is -12:00 to +14:00, and the minutes component
  2548. of offsets of actual time zones is always either 00, 30, or 45. There is no guarantee that this
  2549. will remain so forever, however, since time zones are used as political footballs and are thus
  2550. subject to very whimsical policy decisions.</p>
  2551. <p class=note>See also the usage notes and examples in the <a href=#concept-datetime id=time-zones:concept-datetime>global
  2552. date and time</a> section below for details on using time-zone offsets with historical times
  2553. that predate the formation of formal time zones.</p>
  2554. <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
  2555. a time-zone offset, or nothing. If at any point the algorithm says that it "fails", this means
  2556. that it is aborted at that point and returns nothing.</p>
  2557. <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
  2558. 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
  2559. returns nothing, then fail.</p>
  2560. <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>
  2561. hours and <var>timezone<sub>minutes</sub></var> minutes from UTC.</ol>
  2562. <p>The rules to <dfn id=parse-a-time-zone-offset-component>parse a time-zone offset component</dfn>, given an <var>input</var>
  2563. string and a <var>position</var>, are as follows. This will return either time-zone hours
  2564. and time-zone minutes, or nothing. If at any point the algorithm says that it "fails", this means
  2565. that it is aborted at that point and returns nothing.</p>
  2566. <ol><li>
  2567. <p>If the character at <var>position</var> is a U+005A LATIN CAPITAL LETTER Z character
  2568. (Z), then:</p>
  2569. <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>
  2570. <p>Otherwise, if the character at <var>position</var> is either a U+002B PLUS SIGN (+)
  2571. or a U+002D HYPHEN-MINUS (-), then:</p>
  2572. <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
  2573. <var>s</var> be the collected sequence.<li>
  2574. <p>If <var>s</var> is exactly two characters long, then run these substeps:</p>
  2575. <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
  2576. the character at <var>position</var> is not a U+003A COLON character, then fail.
  2577. 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
  2578. the collected sequence is not exactly two characters long, then fail. Otherwise, interpret
  2579. the resulting sequence as a base-ten integer. Let that number be the <var>timezone<sub>minutes</sub></var>.</ol>
  2580. <p>If <var>s</var> is exactly four characters long, then run these substeps:</p>
  2581. <ol><li><p>Interpret the first two characters of <var>s</var> as a base-ten integer. Let
  2582. 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
  2583. that number be the <var>timezone<sub>minutes</sub></var>.</ol>
  2584. <p>Otherwise, fail.</p>
  2585. <li>If <var>timezone<sub>hours</sub></var> is not a number in the range
  2586. 0 ≤ <var>timezone<sub>hours</sub></var> ≤ 23, then
  2587. 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
  2588. 0 ≤ <var>timezone<sub>minutes</sub></var> ≤ 59,
  2589. then fail.<li>If <var>sign</var> is "negative", then negate <var>timezone<sub>minutes</sub></var>.</ol>
  2590. <p>Otherwise, fail.</p>
  2591. <li><p>Return <var>timezone<sub>hours</sub></var> and <var>timezone<sub>minutes</sub></var>.</ol>
  2592. <h5 id=global-dates-and-times>2.4.5.7 Global dates and times</h5>
  2593. <p>A <dfn id=concept-datetime>global date and time</dfn> consists of a specific
  2594. <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,
  2595. consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone
  2596. offset, consisting of a signed number of hours and minutes. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2597. <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
  2598. time-zone offset if it consists of the following components in the given order:</p>
  2599. <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>
  2600. <p>Times in dates before the formation of UTC in the mid twentieth century must be expressed and
  2601. interpreted in terms of UT1 (contemporary Earth solar time at the 0° longitude), not UTC (the
  2602. approximation of UT1 that ticks in SI seconds). Time before the formation of time zones must be
  2603. expressed and interpeted as UT1 times with explicit time zones that approximate the contemporary
  2604. difference between the appropriate local time and the time observed at the location of Greenwich,
  2605. London.</p>
  2606. <div class=example>
  2607. <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>
  2608. <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
  2609. 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
  2610. 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
  2611. hours and nine minutes ahead of UTC, which is not currently a real time zone, but is nonetheless
  2612. allowed.</dl>
  2613. <p>Several things are notable about these dates:</p>
  2614. <ul><li>Years with fewer than four digits have to be zero-padded. The date "37-12-13" would not be a
  2615. valid date.<li>If the "<code>T</code>" is replaced by a space, it must be a single space
  2616. character. The string "<code>2001-12-21  12:00Z</code>" (with two spaces
  2617. between the components) would not be parsed successfully.<li>To unambiguously identify a moment in time prior to the introduction of the Gregorian
  2618. calendar (insofar as moments in time before the formation of UTC can be unambiguously
  2619. identified), the date has to be first converted to the Gregorian calendar from the calendar in
  2620. use at the time (e.g. from the Julian calendar). The date of Nero's birth is the 15th of
  2621. 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
  2622. 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
  2623. well coordinated or measured until relatively recent decades.<li>Time-zone offsets differ based on daylight savings time.</ul>
  2624. </div>
  2625. <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
  2626. date, time, and a time-zone offset if it consists of the following components in the given
  2627. order:</p>
  2628. <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
  2629. expressed as the shortest possible string for the given time (e.g. omitting the seconds component
  2630. entirely if the given time is zero seconds past the minute)<li>A U+005A LATIN CAPITAL LETTER Z character (Z)</ol>
  2631. <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
  2632. either a time in UTC, with associated time-zone offset information for round-tripping or display
  2633. purposes, or nothing. If at any point the algorithm says that it "fails", this means that it is
  2634. aborted at that point and returns nothing.</p>
  2635. <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
  2636. 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>
  2637. <li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
  2638. character at <var>position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
  2639. (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var>position</var>
  2640. 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>
  2641. <li><p>If <var>position</var> is beyond the end of <var>input</var>, then
  2642. 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
  2643. returns nothing, then fail.</p>
  2644. <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
  2645. <var>month</var>, day <var>day</var>, hours <var>hour</var>, minute
  2646. <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
  2647. zone.<li><p>Let <var>timezone</var> be <var>timezone<sub>hours</sub></var>
  2648. hours and <var>timezone<sub>minutes</sub></var> minutes from UTC.<li><p>Return <var>time</var> and <var>timezone</var>.</ol>
  2649. <h5 id=weeks>2.4.5.8 Weeks</h5>
  2650. <p>A <dfn id=concept-week>week</dfn> consists of a week-year number and a week number
  2651. representing a seven-day period starting on a Monday. Each week-year in this calendaring system
  2652. has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the
  2653. Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year
  2654. 1970. Consecutive weeks are numbered sequentially. The week before the number 1 week in a
  2655. week-year is the last week in the previous week-year, and vice versa. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
  2656. <p>A week-year with a number <var>year</var> has 53 weeks if it corresponds to either a
  2657. year <var>year</var> in the <a href=#proleptic-gregorian-calendar id=weeks:proleptic-gregorian-calendar>proleptic Gregorian calendar</a> that has a Thursday
  2658. 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
  2659. 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
  2660. other week-years have 52 weeks.</p>
  2661. <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
  2662. of the last day of a week-year with 52 weeks is 52.</p>
  2663. <p class=note>The week-year number of a particular day can be different than the number of the
  2664. 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
  2665. week-year <var>y</var> is the week that contains the first Thursday of the Gregorian year
  2666. <var>y</var>.</p>
  2667. <p class=note>For modern purposes, a <a href=#concept-week id=weeks:concept-week>week</a> as defined here is
  2668. equivalent to ISO weeks as defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>
  2669. <p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a week-year <var>year</var>
  2670. and week <var>week</var> if it consists of the following components in the given
  2671. order:</p>
  2672. <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
  2673. 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>
  2674. <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
  2675. number and week number, or nothing. If at any point the algorithm says that it "fails", this means
  2676. that it is aborted at that point and returns nothing.</p>
  2677. <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
  2678. 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
  2679. collected sequence is not at least four characters long, then fail. Otherwise, interpret the
  2680. 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
  2681. character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
  2682. 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
  2683. character at <var>position</var> is not a U+0057 LATIN CAPITAL LETTER W character (W),
  2684. 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
  2685. collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
  2686. 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
  2687. <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>
  2688. <h5 id=durations>2.4.5.9 Durations</h5>
  2689. <p>A <dfn id=concept-duration>duration</dfn> consists of a number of seconds.</p>
  2690. <p class=note>Since months and seconds are not comparable (a month is not a precise number of
  2691. seconds, but is instead a period whose exact length depends on the precise day from which it is
  2692. measured) a <a href=#concept-duration id=durations:concept-duration>duration</a> as defined in this specification cannot
  2693. include months (or years, which are equivalent to
  2694. twelve months). Only durations that describe a specific number of seconds can be described.</p>
  2695. <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
  2696. following:</p>
  2697. <ul><li>
  2698. <p>A literal U+0050 LATIN CAPITAL LETTER P character followed by one or more of the following
  2699. subcomponents, in the order given, where the number of days, hours, minutes, and
  2700. seconds corresponds to the same number of seconds as in <var>t</var>:</p>
  2701. <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
  2702. character, representing a number of days.<li>
  2703. <p>A U+0054 LATIN CAPITAL LETTER T character followed by one or more of the following
  2704. subcomponents, in the order given:</p>
  2705. <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
  2706. 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
  2707. character, representing a number of minutes.<li>
  2708. <p>The following components:</p>
  2709. <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
  2710. <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>
  2711. </ol>
  2712. </ol>
  2713. <p class=note>This, as with a number of other date- and time-related microsyntaxes defined in
  2714. this specification, is based on one of the formats defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>
  2715. <li>
  2716. <p>One or more <a href=#duration-time-component id=durations:duration-time-component>duration time components</a>, each with
  2717. 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
  2718. seconds being equal to the number of seconds in <var>t</var>.</p>
  2719. <p>A <dfn id=duration-time-component>duration time component</dfn> is a string consisting of the following components:</p>
  2720. <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
  2721. 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
  2722. 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
  2723. seconds), then, optionally, a U+002E FULL STOP character (.) followed by one, two, or three
  2724. <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>
  2725. <p>One of the following characters, representing the <dfn id=duration-time-component-scale>duration time component scale</dfn>
  2726. 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>
  2727. <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>
  2728. <li><p>Zero or more <a href=#space-character id=durations:space-character-3>space
  2729. characters</a>.</ol>
  2730. <p class=note>This is not based on any of the formats in ISO 8601. It is intended to be a more
  2731. human-readable alternative to the ISO 8601 duration format.</p>
  2732. </ul>
  2733. <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
  2734. "fails", this means that it is aborted at that point and returns nothing.</p>
  2735. <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
  2736. pointing at the start of the string.<li><p>Let <var>months</var>, <var>seconds</var>, and <var>component
  2737. count</var> all be zero.<li>
  2738. <p>Let <var>M-disambiguator</var> be <i>minutes</i>.</p>
  2739. <p class=note>This flag's other value is <i>months</i>. It is used to disambiguate the "M"
  2740. unit in ISO8601 durations, which use the same unit for months and minutes. Months are not
  2741. allowed, but are parsed for future compatibility and to avoid misinterpreting ISO8601 durations
  2742. that would be valid in other contexts.</p>
  2743. <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
  2744. fail.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
  2745. is a U+0050 LATIN CAPITAL LETTER P character, then advance <var>position</var> to the
  2746. next character, set <var>M-disambiguator</var> to <i>months</i>, and <a href=#skip-whitespace id=durations:skip-whitespace-2>skip
  2747. whitespace</a>.<li>
  2748. <p>Run the following substeps in a loop, until a step requiring the loop to be broken or the
  2749. entire algorithm to fail is reached:</p>
  2750. <ol><li><p>Let <var>units</var> be undefined. It will be assigned one of the following
  2751. values: <i>years</i>, <i>months</i>, <i>weeks</i>, <i>days</i>, <i>hours</i>, <i>minutes</i>,
  2752. and <i>seconds</i>.<li><p>Let <var>next character</var> be undefined. It is used to process characters
  2753. from the <var>input</var>.<li><p>If <var>position</var> is past the end of <var>input</var>, then break
  2754. the loop.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
  2755. is a U+0054 LATIN CAPITAL LETTER T character, then advance <var>position</var> to the
  2756. next character, set <var>M-disambiguator</var> to <i>minutes</i>, <a href=#skip-whitespace id=durations:skip-whitespace-3>skip
  2757. whitespace</a>, and return to the top of the loop.<li><p>Set <var>next character</var> to the character in <var>input</var>
  2758. pointed to by <var>position</var>.<li>
  2759. <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
  2760. of below.)</p>
  2761. <p>Otherwise, if <var>next character</var> is an <a href=#ascii-digits id=durations:ascii-digits-8>ASCII
  2762. 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
  2763. digits</a>, interpret the resulting sequence as a base-ten integer, and let <var>N</var> be that number.</p>
  2764. <p>Otherwise <var>next character</var> is not part of a number; fail.</p>
  2765. <li><p>If <var>position</var> is past the end of <var>input</var>, then
  2766. fail.<li><p>Set <var>next character</var> to the character in <var>input</var>
  2767. pointed to by <var>position</var>, and this time advance <var>position</var>
  2768. to the next character. (If <var>next character</var> was a U+002E FULL STOP character
  2769. (.) before, it will still be that character this time.)<li>
  2770. <p>If <var>next character</var> is a U+002E FULL STOP character (.), then run these
  2771. substeps:</p>
  2772. <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
  2773. <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>
  2774. 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
  2775. fail.<li><p>Set <var>next character</var> to the character in <var>input</var>
  2776. pointed to by <var>position</var>, and advance <var>position</var> to the
  2777. next character.<li><p>If <var>next character</var> is neither a U+0053 LATIN CAPITAL LETTER S
  2778. character nor a U+0073 LATIN SMALL LETTER S character, then fail.<li><p>Set <var>units</var> to <i>seconds</i>.</ol>
  2779. <p>Otherwise, run these substeps:</p>
  2780. <ol><li><p>If <var>next character</var> is a <a href=#space-character id=durations:space-character-4>space character</a>, then
  2781. <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>
  2782. <p>If <var>next character</var> is a U+0059 LATIN CAPITAL LETTER Y character, or a
  2783. U+0079 LATIN SMALL LETTER Y character, set <var>units</var> to <i>years</i> and set
  2784. <var>M-disambiguator</var> to <i>months</i>.</p>
  2785. <p>If <var>next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
  2786. U+006D LATIN SMALL LETTER M character, and <var>M-disambiguator</var> is
  2787. <i>months</i>, then set <var>units</var> to <i>months</i>.</p>
  2788. <p>If <var>next character</var> is a U+0057 LATIN CAPITAL LETTER W character or a
  2789. U+0077 LATIN SMALL LETTER W character, set <var>units</var> to <i>weeks</i> and set
  2790. <var>M-disambiguator</var> to <i>minutes</i>.</p>
  2791. <p>If <var>next character</var> is a U+0044 LATIN CAPITAL LETTER D character or a
  2792. U+0064 LATIN SMALL LETTER D character, set <var>units</var> to <i>days</i> and set
  2793. <var>M-disambiguator</var> to <i>minutes</i>.</p>
  2794. <p>If <var>next character</var> is a U+0048 LATIN CAPITAL LETTER H character or a
  2795. U+0068 LATIN SMALL LETTER H character, set <var>units</var> to <i>hours</i> and set
  2796. <var>M-disambiguator</var> to <i>minutes</i>.</p>
  2797. <p>If <var>next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
  2798. U+006D LATIN SMALL LETTER M character, and <var>M-disambiguator</var> is
  2799. <i>minutes</i>, then set <var>units</var> to <i>minutes</i>.</p>
  2800. <p>If <var>next character</var> is a U+0053 LATIN CAPITAL LETTER S character or a
  2801. U+0073 LATIN SMALL LETTER S character, set <var>units</var> to <i>seconds</i> and
  2802. set <var>M-disambiguator</var> to <i>minutes</i>.</p>
  2803. <p>Otherwise if <var>next character</var> is none of the above characters, then
  2804. fail.</p>
  2805. </ol>
  2806. <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
  2807. 12 and set <var>units</var> to <i>months</i>.<li>
  2808. <p>If <var>units</var> is <i>months</i>, add the product of <var>N</var> and
  2809. <var>multiplier</var> to <var>months</var>.</p>
  2810. <p>Otherwise, run these substeps:</p>
  2811. <ol><li><p>If <var>units</var> is <i>weeks</i>, multiply <var>multiplier</var>
  2812. 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>
  2813. 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>
  2814. 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>
  2815. <li><p><a href=#skip-whitespace id=durations:skip-whitespace-6>Skip whitespace</a>.</ol>
  2816. <li><p>If <var>component count</var> is zero,
  2817. 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>
  2818. <h5 id=vaguer-moments-in-time>2.4.5.10 Vaguer moments in time</h5>
  2819. <p>A string is a <dfn id=valid-date-string-with-optional-time>valid date string with optional time</dfn> if
  2820. it is also one of the following:</p>
  2821. <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>
  2822. <hr>
  2823. <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
  2824. 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
  2825. says that it "fails", this means that it is aborted at that point and returns nothing.</p>
  2826. <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
  2827. 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
  2828. 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
  2829. present</var> flag to false.</p>
  2830. <li>
  2831. <p>If <var>date present</var> is true, and <var>position</var> is not beyond
  2832. the end of <var>input</var>, and the character at <var>position</var> is
  2833. either a U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character, then advance
  2834. <var>position</var> to the next character in <var>input</var>.</p>
  2835. <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
  2836. SPACE character, then set <var>time present</var> to false.</p>
  2837. <p>Otherwise, if <var>date present</var> is false, set <var>position</var>
  2838. back to the same position as <var>start position</var>.</p>
  2839. <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
  2840. 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
  2841. both true, but <var>position</var> is beyond the end of <var>input</var>, then
  2842. fail.<li><p>If the <var>date present</var> and <var>time present</var> flags are
  2843. 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
  2844. returns nothing, then fail.</p>
  2845. <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li>
  2846. <p>If the <var>date present</var> flag is true and the <var>time present</var>
  2847. flag is false, then let <var>date</var> be the date with year <var>year</var>,
  2848. month <var>month</var>, and day <var>day</var>, and return <var>date</var>.</p>
  2849. <p>Otherwise, if the <var>time present</var> flag is true and the <var>date
  2850. 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>,
  2851. and return <var>time</var>.</p>
  2852. <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>,
  2853. subtracting <var>timezone<sub>hours</sub></var> hours and <var>timezone<sub>minutes</sub></var> minutes, that moment in time being a moment
  2854. in the UTC time zone; let <var>timezone</var> be <var>timezone<sub>hours</sub></var> hours and <var>timezone<sub>minutes</sub></var>
  2855. minutes from UTC; and return <var>time</var> and <var>timezone</var>.</p>
  2856. </ol>
  2857. <h4 id=colours>2.4.6 Colours</h4>
  2858. <p>A <dfn id=simple-colour>simple colour</dfn> consists of three 8-bit numbers in the range 0..255, representing the
  2859. red, green, and blue components of the colour respectively, in the sRGB colour space. <a href=#refsSRGB>[SRGB]</a></p>
  2860. <p>A string is a <dfn id=valid-simple-colour>valid simple colour</dfn> if it is exactly seven characters long, and the
  2861. first character is a U+0023 NUMBER SIGN character (#), and the remaining six characters are all
  2862. <a href=#ascii-hex-digits id=colours:ascii-hex-digits>ASCII hex digits</a>, with the first two digits representing the red component, the
  2863. middle two digits representing the green component, and the last two digits representing the blue
  2864. component, in hexadecimal.</p>
  2865. <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
  2866. colour</a> and doesn't use any characters in the range U+0041 LATIN CAPITAL LETTER A to U+0046
  2867. LATIN CAPITAL LETTER F.</p>
  2868. <p>The <dfn id=rules-for-parsing-simple-colour-values>rules for parsing simple colour values</dfn> are as given in the following algorithm.
  2869. When invoked, the steps must be followed in the order given, aborting at the first step that
  2870. returns a value. This algorithm will return either a <a href=#simple-colour id=colours:simple-colour>simple colour</a> or an error.</p>
  2871. <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
  2872. error.<li><p>If the first character in <var>input</var> is not a U+0023 NUMBER SIGN character
  2873. (#), 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
  2874. 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>
  2875. <li><p>Interpret the second and third characters as a hexadecimal number and let the result be
  2876. the red component of <var>result</var>.</p>
  2877. <li><p>Interpret the fourth and fifth characters as a hexadecimal number and let the result be
  2878. the green component of <var>result</var>.</p>
  2879. <li><p>Interpret the sixth and seventh characters as a hexadecimal number and let the result be
  2880. the blue component of <var>result</var>.</p>
  2881. <li><p>Return <var>result</var>.</p>
  2882. </ol>
  2883. <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
  2884. as given in the following algorithm:</p>
  2885. <ol><li><p>Let <var>result</var> be a string consisting of a single U+0023 NUMBER SIGN
  2886. character (#).<li><p>Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using
  2887. <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
  2888. <var>result</var>, in the order red, green, blue.</p>
  2889. <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
  2890. colour</a>.</ol>
  2891. <hr>
  2892. <p>Some obsolete legacy attributes parse colours in a more complicated manner, using the <dfn id=rules-for-parsing-a-legacy-colour-value>rules
  2893. for parsing a legacy colour value</dfn>, which are given in the following algorithm. When invoked,
  2894. the steps must be followed in the order given, aborting at the first step that returns a value.
  2895. This algorithm will return either a <a href=#simple-colour id=colours:simple-colour-4>simple colour</a> or an error.</p>
  2896. <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
  2897. string "<code>transparent</code>", then return an error.<li>
  2898. <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
  2899. keywords listed in the <a href=http://www.w3.org/TR/css3-color/#svg-color>SVG color
  2900. keywords</a> section of the CSS3 Color specification, then return the <a href=#simple-colour id=colours:simple-colour-5>simple
  2901. colour</a> corresponding to that keyword. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
  2902. <p class=note><a href=http://www.w3.org/TR/css3-color/#css2-system>CSS2 System
  2903. Colors</a> are not recognised.</p>
  2904. <li>
  2905. <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
  2906. <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>
  2907. <ol><li><p>Let <var>result</var> be a <a href=#simple-colour id=colours:simple-colour-6>simple colour</a>.</p>
  2908. <li><p>Interpret the second character of <var>input</var> as a hexadecimal digit; let
  2909. the red component of <var>result</var> be the resulting number multiplied by 17.</p>
  2910. <li><p>Interpret the third character of <var>input</var> as a hexadecimal digit; let
  2911. the green component of <var>result</var> be the resulting number multiplied by 17.</p>
  2912. <li><p>Interpret the fourth character of <var>input</var> as a hexadecimal digit; let
  2913. the blue component of <var>result</var> be the resulting number multiplied by 17.</p>
  2914. <li><p>Return <var>result</var>.</p>
  2915. </ol>
  2916. <li><p>Replace any characters in <var>input</var> that have a Unicode code point greater
  2917. than U+FFFF (i.e. any characters that are not in the basic multilingual plane) with the
  2918. 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 (#),
  2919. 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
  2920. 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
  2921. components. Let <var>length</var> be the length of those components (one third the
  2922. 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
  2923. 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,
  2924. 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>
  2925. <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>
  2926. </ol>
  2927. <hr>
  2928. <p class=note>The <a href=#canvas-context-2d id=colours:canvas-context-2d>2D graphics context</a> has a separate
  2929. colour syntax that also handles opacity.</p>
  2930. <h4 id=space-separated-tokens>2.4.7 Space-separated tokens</h4>
  2931. <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
  2932. tokens) separated by one or more <a href=#space-character id=space-separated-tokens:space-character>space characters</a>, where
  2933. 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>
  2934. <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
  2935. <a href=#space-character id=space-separated-tokens:space-character-3>space characters</a>.</p>
  2936. <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
  2937. tokens</a> where none of the tokens are duplicated.</p>
  2938. <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
  2939. tokens</a> where none of the tokens are duplicated but where the order of the tokens is
  2940. meaningful.</p>
  2941. <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
  2942. have a defined set of allowed values. When a set of allowed values is defined, the tokens must all
  2943. be from that list of allowed values; other values are non-conforming. If no such set of allowed
  2944. values is provided, then all values are conforming.</p>
  2945. <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
  2946. (e.g. case-sensitively or not) is defined on a per-set basis.</p>
  2947. <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
  2948. algorithm:</p>
  2949. <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
  2950. 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>
  2951. <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>
  2952. <li><p>Return <var>tokens</var>.</ol>
  2953. <h4 id=comma-separated-tokens>2.4.8 Comma-separated tokens</h4>
  2954. <p>A <dfn id=set-of-comma-separated-tokens>set of comma-separated tokens</dfn> is a string containing zero or more tokens each
  2955. separated from the next by a single U+002C COMMA character (,), where tokens consist of any string
  2956. of zero or more characters, neither beginning nor ending with <a href=#space-character id=comma-separated-tokens:space-character>space
  2957. characters</a>, nor containing any U+002C COMMA characters (,), and optionally surrounded by
  2958. <a href=#space-character id=comma-separated-tokens:space-character-2>space characters</a>.</p>
  2959. <p class=example>For instance, the string "<code> a ,b,,d d </code>" consists of four tokens: "a", "b", the empty
  2960. string, and "d d". Leading and trailing whitespace around each token doesn't count as part of
  2961. the token, and the empty string can be a token.</p>
  2962. <p><a href=#set-of-comma-separated-tokens id=comma-separated-tokens:set-of-comma-separated-tokens>Sets of comma-separated tokens</a> sometimes
  2963. have further restrictions on what consists a valid token. When such restrictions are defined, the
  2964. tokens must all fit within those restrictions; other values are non-conforming. If no such
  2965. restrictions are specified, then all values are conforming.</p>
  2966. <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
  2967. algorithm:</p>
  2968. <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
  2969. 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 (,).
  2970. 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
  2971. 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>
  2972. <h4 id=syntax-references>2.4.9 References</h4>
  2973. <p>A <dfn id=valid-hash-name-reference>valid hash-name reference</dfn> to an element of type <var>type</var> is a
  2974. string consisting of a U+0023 NUMBER SIGN character (#) followed by a string which exactly matches
  2975. the value of the <code>name</code> attribute of an element with type <var>type</var> in the document.</p>
  2976. <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>
  2977. <ol><li><p>If the string being parsed does not contain a U+0023 NUMBER SIGN character, or if the
  2978. first such character in the string is the last character in the string, then return null and
  2979. abort these steps.<li><p>Let <var>s</var> be the string from the character immediately after the first
  2980. 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
  2981. caseless</a> match for <var>s</var>.</ol>
  2982. <h4 id=mq>2.4.10 Media queries</h4>
  2983. <p>A string is a <dfn id=valid-media-query-list>valid media query list</dfn> if it matches the <code>&lt;media-query-list></code> production of the Media Queries specification. <a href=#refsMQ>[MQ]</a></p>
  2984. <p>A string <dfn id=matches-the-environment>matches the environment</dfn> of the user if it is the empty string, a string
  2985. consisting of only <a href=#space-character id=mq:space-character>space characters</a>, or is a media query list
  2986. that matches the user's environment according to the definitions given in the Media Queries
  2987. specification. <a href=#refsMQ>[MQ]</a></p>
  2988. <h3 id=urls>2.5 URLs</h3>
  2989. <h4 id=terminology-2>2.5.1 Terminology</h4>
  2990. <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
  2991. requirements in the WHATWG URL standard. <a href=#refsURL>[URL]</a></p>
  2992. <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
  2993. the empty string.</p>
  2994. <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>
  2995. from it, it is a <a href=#valid-url id=terminology-2:valid-url-2>valid URL</a>.</p>
  2996. <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>
  2997. from it, it is a <a href=#valid-non-empty-url id=terminology-2:valid-non-empty-url>valid non-empty URL</a>.</p>
  2998. <p>This specification defines the URL <dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved,
  2999. 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
  3000. compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>
  3001. <p>This specification defines the URL <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
  3002. 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
  3003. 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>
  3004. <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
  3005. URL</a> obtained by running these substeps:</p>
  3006. <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
  3007. 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
  3008. 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>
  3009. <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
  3010. <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
  3011. 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
  3012. <code>Document</code></a>, and abort these steps.</p>
  3013. <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>
  3014. <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
  3015. URL</a> obtained by running these substeps:</p>
  3016. <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
  3017. <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>;
  3018. 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
  3019. 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>
  3020. <h4 id=resolving-urls>2.5.2 Resolving URLs</h4>
  3021. <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
  3022. <a href=#absolute-url id=resolving-urls:absolute-url>absolute URL</a> that it implies.</p>
  3023. <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
  3024. <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
  3025. URL can result in an error, in which case the URL is not resolvable.</p>
  3026. <ol><li><p>Let <var>url</var> be the <a href=#url id=resolving-urls:url>URL</a> being resolved.<li>
  3027. <p>Let <var>encoding</var> be determined as follows:</p>
  3028. <dl class=switch><dt>If the URL had a character encoding defined when the URL was created or defined or when
  3029. 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
  3030. 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
  3031. <a href="#document's-character-encoding" id="resolving-urls:document's-character-encoding">document's character encoding</a>.</dl>
  3032. <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
  3033. of <var>encoding</var> to UTF-8.<li>
  3034. <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
  3035. <var>base</var> be that <a href=#absolute-url id=resolving-urls:absolute-url-5>absolute URL</a>.</p>
  3036. <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>
  3037. <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
  3038. URL</var> as the <dfn id=resulting-parsed-url>resulting parsed URL</dfn>.</ol>
  3039. <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
  3040. defined by the XML Base specification, with <i>the base URI of the document entity</i> being
  3041. 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.
  3042. <a href=#refsXMLBASE>[XMLBASE]</a></p>
  3043. <p>For the purposes of the XML Base specification, user agents must act as if all
  3044. <code id=resolving-urls:document-3><a href=#document>Document</a></code> objects represented XML documents.</p>
  3045. <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
  3046. present even in HTML fragments, as such attributes can be added dynamically using script. (Such
  3047. 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>
  3048. attributes are not allowed in <a href=#html-documents id=resolving-urls:html-documents>HTML documents</a>.)</p>
  3049. <h4 id=dynamic-changes-to-base-urls>2.5.3 Dynamic changes to base URLs</h4>
  3050. <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
  3051. 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
  3052. change</a>.</p>
  3053. <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
  3054. <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>
  3055. <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
  3056. <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>
  3057. <dl class=switch><dt>If the element creates a <a href=#hyperlink id=dynamic-changes-to-base-urls:hyperlink>hyperlink</a><dd>
  3058. <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
  3059. 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>
  3060. <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>
  3061. <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>
  3062. <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
  3063. <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>
  3064. <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
  3065. being shown to the user, or if any data derived from that URL is affecting the display, then the
  3066. <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
  3067. element and the UI updated appropriately.</p>
  3068. <dt>Otherwise<dd>
  3069. <p>The element is not directly affected.</p>
  3070. <p class=example>For instance, changing the base URL doesn't affect the image displayed by
  3071. <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
  3072. URL</a> that might no longer correspond to the image being shown.</p>
  3073. </dl>
  3074. <h3 id=fetching-resources>2.6 Fetching resources</h3>
  3075. <h4 id=terminology-3>2.6.1 Terminology</h4>
  3076. <p id=concept-http-equivalent>User agents can implement a variety of transfer protocols, but
  3077. this specification mostly defines behavior in terms of HTTP. <a href=#refsHTTP>[HTTP]</a></p>
  3078. <p>The <dfn id=concept-http-equivalent-get>HTTP GET method</dfn> is equivalent to the default
  3079. retrieval action of the protocol. For example, RETR in FTP. Such actions are idempotent and safe,
  3080. in HTTP terms.</p>
  3081. <p>The <dfn id=concept-http-equivalent-codes>HTTP response codes</dfn> are equivalent to
  3082. statuses in other protocols that have the same basic meanings. For example, a "file not found"
  3083. error is equivalent to a 404 code, a server error is equivalent to a 5xx code, and so on.</p>
  3084. <p>The <dfn id=concept-http-equivalent-headers>HTTP headers</dfn> are equivalent to fields in
  3085. other protocols that have the same basic meaning. For example, the HTTP authentication headers are
  3086. equivalent to the authentication aspects of the FTP protocol.</p>
  3087. <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>
  3088. <h4 id=processing-model>2.6.2 Processing model</h4>
  3089. <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
  3090. <strong>from</strong> an origin <i>origin</i>, optionally <strong>using</strong> a
  3091. specific <a href=#referrer-source id=processing-model:referrer-source>referrer source</a> as an <i>override referrer source</i>, and optionally with
  3092. any of a <i>synchronous flag</i>, a <i>manual redirect flag</i>, a <i>force same-origin flag</i>,
  3093. and a <i>block cookies flag</i>, the following steps must be run. (When a
  3094. <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>
  3095. <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
  3096. let <var>referrer</var> be the <i>override referrer source</i>, and jump to the step
  3097. labeled <i>clean referrer</i>.<li>
  3098. <p>Let <var>document</var> be the appropriate <code id=processing-model:document><a href=#document>Document</a></code> as given by the
  3099. following list:</p>
  3100. <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>
  3101. <li>
  3102. <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
  3103. <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
  3104. 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>
  3105. <li>
  3106. <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,
  3107. then set <var>referrer</var> to the empty string and jump to the step labeled <i>clean
  3108. referrer</i>.</p>
  3109. <li>
  3110. <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>
  3111. <li>
  3112. <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>
  3113. <li>
  3114. <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
  3115. <i>exclude fragment flag</i> set.</p>
  3116. <li>
  3117. <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>
  3118. "<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
  3119. are obtained</i> as required by HTTP for the <code id=processing-model:http-referer><a href=#http-referer>Referer</a></code> (sic)
  3120. header from <var>referrer</var>. <a href=#refsHTTP>[HTTP]</a></p>
  3121. <p>Otherwise, the <code id=processing-model:http-referer-2><a href=#http-referer>Referer</a></code> (sic) header must be omitted,
  3122. regardless of its value.</p>
  3123. <li><p>If the algorithm was not invoked with the <i>synchronous flag</i>, perform the remaining
  3124. 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
  3125. associated <a href=#browsing-context id=processing-model:browsing-context-2>browsing context</a>, then abort these steps.<li>
  3126. <p>This is the <i>main step</i>.</p>
  3127. <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
  3128. 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
  3129. given its <a href=#url id=processing-model:url-5>URL</a>.</p>
  3130. <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
  3131. 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
  3132. for other reasons (e.g. another invocation of this algorithm), and this request would be
  3133. 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
  3134. reuse the data from the existing download instead of initiating a new one, then use the results
  3135. of the existing download instead of starting a new one.</p>
  3136. <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
  3137. 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
  3138. resource was an HTTP 204 No Content response with no other metadata.</p>
  3139. <p>Otherwise, if the resource is identified by the <a href=#url id=processing-model:url-6>URL</a>
  3140. <dfn id=about:blank><code>about:blank</code></dfn>, then the resource is immediately available and consists of
  3141. the empty string, with no metadata.</p>
  3142. <p>Otherwise, at a time convenient to the user and the user agent, download (or otherwise
  3143. obtain) the resource, applying the semantics of the relevant specifications (e.g. performing an
  3144. 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>
  3145. <p>For the purposes of the <code id=processing-model:http-referer-3><a href=#http-referer>Referer</a></code> (sic) header, use the
  3146. <i>address of the resource from which Request-URIs are obtained</i> generated in the earlier
  3147. step.</p>
  3148. <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
  3149. <i>the origin that initiated the HTTP request</i> is <i>origin</i>. Otherwise, this is <i>a
  3150. request from a "privacy-sensitive" context</i>. <a href=#refsORIGIN>[ORIGIN]</a></p>
  3151. <li>
  3152. <p>If the algorithm was not invoked with the <i>block cookies flag</i>, and there are cookies to
  3153. be set, then the user agent must run the following substeps:</p>
  3154. <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
  3155. 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>
  3156. <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>
  3157. <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>
  3158. <li>
  3159. <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes id=processing-model:concept-http-equivalent-codes>or
  3160. equivalent</a>, then:</p>
  3161. <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
  3162. 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
  3163. <a href=#fetch id=processing-model:fetch-3>fetch</a> algorithm was invoked<dd>
  3164. <p>Abort these steps and return failure from this algorithm, as if the remote host could not
  3165. be contacted.</p>
  3166. <dt>If the <i>manual redirect flag</i> is set<dd>
  3167. <p>Continue, using the fetched resource (the redirect) as the result of the algorithm. If the
  3168. calling algorithm subsequently requires the user agent to <dfn id=transparently-follow-the-redirect>transparently follow the
  3169. redirect</dfn>, then the user agent must resume this algorithm from the <i>main step</i>, but
  3170. using the target of the redirect as the resource to fetch, rather than the original
  3171. resource.</p>
  3172. <dt>Otherwise<dd>
  3173. <p>First, apply any relevant requirements for redirects (such as showing any appropriate
  3174. prompts). Then, redo <i>main step</i>, but using the target of the redirect as the resource to
  3175. fetch, rather than the original resource. For HTTP requests, the new request must include the
  3176. same headers as the original request, except for headers for which other requirements are
  3177. specified (such as the <code id=processing-model:http-host><a href=#http-host>Host</a></code> header). <a href=#refsHTTP>[HTTP]</a></p>
  3178. <p class=note>The HTTP specification requires that 301, 302, and 307 redirects, when applied
  3179. to methods other than the safe methods, not be followed without user confirmation. That would
  3180. be an appropriate prompt for the purposes of the requirement in the paragraph above. <a href=#refsHTTP>[HTTP]</a></p>
  3181. </dl>
  3182. <li>
  3183. <p>If the algorithm was not invoked with the <i>synchronous flag</i>: When the resource is
  3184. 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
  3185. resource as appropriate. If the resource can be processed incrementally, as, for instance, with
  3186. a progressively interlaced JPEG or an HTML file, additional tasks may be queued to process the
  3187. 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>
  3188. <p>Otherwise, return the resource or error information to the calling algorithm.</p>
  3189. </ol>
  3190. <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
  3191. that length is the file's <dfn id=concept-fetch-total>size</dfn>. Otherwise, the subject of
  3192. 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>
  3193. <p>The user agent must also keep track of the <dfn id=concept-fetch-loaded>number of bytes
  3194. downloaded</dfn> for each instance of this algorithm. This number must exclude any out-of-band
  3195. metadata, such as HTTP headers.</p>
  3196. <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
  3197. cached resources.</p>
  3198. <p class=note>The <a href=#navigate id=processing-model:navigate-2>navigation</a> processing model handles redirects
  3199. itself, overriding the redirection handling that would be done by the fetching algorithm.</p>
  3200. <p class=note>Whether the <a href=#content-type-sniffing>type sniffing rules</a> apply to the
  3201. fetched resource depends on the algorithm that invokes the rules — they are not always
  3202. applicable.</p>
  3203. <h4 id=encrypted-http-and-related-security-concerns>2.6.3 Encrypted HTTP and related security concerns</h4>
  3204. <p>Anything in this specification that refers to HTTP also applies to HTTP-over-TLS, as
  3205. 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>
  3206. <p class=warning>User agents should report certificate errors to the user and must either refuse
  3207. to download resources sent with erroneous certificates or must act as if such resources were in
  3208. fact served with no encryption.</p>
  3209. <p>User agents should warn the user that there is a potential problem whenever the user visits a
  3210. page that the user has previously visited, if the page uses less secure encryption on the second
  3211. visit.</p>
  3212. <p>Not doing so can result in users not noticing man-in-the-middle attacks.</p>
  3213. <div class=example>
  3214. <p>If a user connects to a server with a self-signed certificate, the user agent could allow the
  3215. connection but just act as if there had been no encryption. If the user agent instead allowed the
  3216. user to override the problem and then displayed the page as if it was fully and safely encrypted,
  3217. the user could be easily tricked into accepting man-in-the-middle connections.</p>
  3218. <p>If a user connects to a server with full encryption, but the page then refers to an external
  3219. resource that has an expired certificate, then the user agent will act as if the resource was
  3220. unavailable, possibly also reporting the problem to the user. If the user agent instead allowed
  3221. the resource to be used, then an attacker could just look for "secure" sites that used resources
  3222. from a different host and only apply man-in-the-middle attacks to that host, for example taking
  3223. over scripts in the page.</p>
  3224. <p>If a user bookmarks a site that uses a CA-signed certificate, and then later revisits that
  3225. site directly but the site has started using a self-signed certificate, the user agent could warn
  3226. the user that a man-in-the-middle attack is likely underway, instead of simply acting as if the
  3227. page was not encrypted.</p>
  3228. </div>
  3229. <h4 id=content-type-sniffing>2.6.4 Determining the type of a resource</h4>
  3230. <p>The <dfn id=content-type>Content-Type metadata</dfn> of a resource must be obtained and
  3231. interpreted in a manner consistent with the requirements of the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
  3232. <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>
  3233. must be found in a manner consistent with the requirements given in the MIME Sniffing
  3234. specification for finding the <i>sniffed media type</i> of the relevant sequence of octets. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
  3235. <p>The <dfn id=content-type-sniffing:-image><a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically>rules for
  3236. 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
  3237. 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
  3238. for sniffing audio and video specifically</a></dfn> are also defined in the MIME Sniffing
  3239. 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>
  3240. <p class=warning>It is imperative that the rules in the MIME Sniffing specification be followed
  3241. exactly. When a user agent uses different heuristics for content type detection than the server
  3242. expects, security problems can occur. For more details, see the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
  3243. <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>
  3244. <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>,
  3245. given a string <var>s</var>, is as follows. It either returns a character encoding or
  3246. nothing.</p>
  3247. <ol><li><p>Let <var>position</var> be a pointer into <var>s</var>, initially
  3248. 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
  3249. 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
  3250. 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
  3251. 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
  3252. equals sign (there might not be any).<li>
  3253. <p>Process the next character as follows:</p>
  3254. <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
  3255. 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
  3256. 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
  3257. SEMICOLON character (;), or the end of <var>s</var>, whichever comes first.</dl>
  3258. </ol>
  3259. <p class=note>This algorithm is distinct from those in the HTTP specification (for example, HTTP
  3260. doesn't allow the use of single quotes and requires supporting a backslash-escape mechanism that
  3261. is not supported by this algorithm). While the algorithm is used in
  3262. contexts that, historically, were related to HTTP, the syntax as supported by implementations
  3263. diverged some time ago. <a href=#refsHTTP>[HTTP]</a></p>
  3264. <h4 id=cors-settings-attributes>2.6.6 CORS settings attributes</h4>
  3265. <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
  3266. table lists the keywords and states for the attribute — the keywords in the left column map
  3267. to the states in the cell in the second column on the same row as the keyword.</p>
  3268. <table><thead><tr><th> Keyword
  3269. <th> State
  3270. <th> Brief description
  3271. <tbody><tr><td><dfn id=attr-crossorigin-anonymous-keyword><code>anonymous</code></dfn>
  3272. <td><dfn id=attr-crossorigin-anonymous>Anonymous</dfn>
  3273. <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.
  3274. <tr><td><dfn id=attr-crossorigin-use-credentials-keyword><code>use-credentials</code></dfn>
  3275. <td><dfn id=attr-crossorigin-use-credentials>Use Credentials</dfn>
  3276. <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.
  3277. </table>
  3278. <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
  3279. 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
  3280. CORS</dfn> state.</p>
  3281. <h4 id=cors-enabled-fetch>2.6.7 CORS-enabled fetch</h4>
  3282. <p>When the user agent is required to perform a <dfn id=potentially-cors-enabled-fetch>potentially CORS-enabled fetch</dfn> of an
  3283. <a href=#absolute-url id=cors-enabled-fetch:absolute-url>absolute URL</a> <var>URL</var> with a mode <var>mode</var> that is
  3284. 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
  3285. <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>
  3286. <var>origin</var>, and with a default origin behaviour <var>default</var>
  3287. which is either "<i>taint</i>" or "<i>fail</i>", it must run the first applicable set of steps
  3288. from the following list. The default origin behaviour is only used if <var>mode</var> is
  3289. "<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>
  3290. algorithm above, and labels the obtained resource as either <dfn id=cors-same-origin>CORS-same-origin</dfn> or
  3291. <dfn id=cors-cross-origin>CORS-cross-origin</dfn>, or blocks the resource entirely.</p>
  3292. <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>
  3293. <p>Run these substeps:</p>
  3294. <ol><li><p><a href=#fetch id=cors-enabled-fetch:fetch-2>Fetch</a> <var>URL</var>, using <var>referrer
  3295. 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
  3296. redirect or not.<li>
  3297. <p>Follow the first appropriate steps from the following list:</p>
  3298. <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
  3299. 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>
  3300. <p>Set <var>URL</var> to the target URL of the redirect and return to the top of
  3301. 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
  3302. branches below might be taken, based on the value of <var>mode</var>).</p>
  3303. <dt>If the result of the <a href=#fetch id=cors-enabled-fetch:fetch-5>fetch</a> is a redirect<dd>
  3304. <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
  3305. origin</a> as <var>origin</var>.</p>
  3306. <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>
  3307. above.</p>
  3308. <dt>Otherwise<dd>
  3309. <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>
  3310. is the <a href=#same-origin id=cors-enabled-fetch:same-origin-4>same origin</a> as <var>origin</var>.</p>
  3311. <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
  3312. <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task>queued</a> normally, and for the purposes of the calling
  3313. algorithm, the obtained resource is <a href=#cors-same-origin id=cors-enabled-fetch:cors-same-origin>CORS-same-origin</a>.</p>
  3314. </dl>
  3315. </ol>
  3316. <dt>If <var>mode</var> is "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none-3>No CORS</a>" and
  3317. <var>default</var> is <i>taint</i><dd>
  3318. <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>
  3319. <p><a href=#fetch id=cors-enabled-fetch:fetch-7>Fetch</a> <var>URL</var>, using <var>referrer
  3320. source</var> if one was specified.</p>
  3321. <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
  3322. 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
  3323. resource access failure to the user (e.g. in a debugging console).</p>
  3324. <dt>If <var>mode</var> is "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none-4>No CORS</a>"<dd>
  3325. <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>
  3326. <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
  3327. from being <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-3>queued</a>.
  3328. For the purposes of the calling algorithm, the user agent must act as if there was a fatal
  3329. network error and no resource was obtained. The user agent may report a cross-origin resource
  3330. access failure to the user (e.g. in a debugging console).</p>
  3331. <dt>If <var>mode</var> is "<a href=#attr-crossorigin-anonymous id=cors-enabled-fetch:attr-crossorigin-anonymous-2>Anonymous</a>"
  3332. or "<a href=#attr-crossorigin-use-credentials id=cors-enabled-fetch:attr-crossorigin-use-credentials-2>Use Credentials</a>"<dd>
  3333. <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>
  3334. <p>Run these steps:</p>
  3335. <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
  3336. to <var>URL</var>, with the CORS <i>referrer source</i> set to <var>referrer source</var> if
  3337. 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>
  3338. <p>Jump to the appropriate step from the following list:</p>
  3339. <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>
  3340. <p>Discard all fetched data and prevent any <a href=#concept-task id=cors-enabled-fetch:concept-task-4>tasks</a> from
  3341. 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
  3342. the purposes of the calling algorithm, the user agent must act as if there was a fatal
  3343. 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>
  3344. failed, the user agent may report a cross-origin resource access failure to the user (e.g.
  3345. in a debugging console).</p>
  3346. <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>
  3347. <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
  3348. <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-5>queued</a> normally, and for the purposes of the calling
  3349. algorithm, the obtained resource is <a href=#cors-same-origin id=cors-enabled-fetch:cors-same-origin-2>CORS-same-origin</a>.</p>
  3350. </dl>
  3351. </ol>
  3352. </dl>
  3353. <h3 id=common-dom-interfaces>2.7 Common DOM interfaces</h3>
  3354. <h4 id=reflecting-content-attributes-in-idl-attributes>2.7.1 Reflecting content attributes in IDL attributes</h4>
  3355. <p>Some IDL attributes are defined to <dfn id=reflect>reflect</dfn> a particular content attribute. This
  3356. means that on getting, the IDL attribute returns the current value of the content attribute, and
  3357. on setting, the IDL attribute changes the value of the content attribute to the given value.</p>
  3358. <p>In general, on getting, if the content attribute is not present, the IDL attribute must act as
  3359. if the content attribute's value is the empty string; and on setting, if the content attribute is
  3360. not present, it must first be added.</p>
  3361. <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
  3362. 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
  3363. 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
  3364. otherwise; and on setting, must set the content attribute to the specified literal value. If the
  3365. content attribute is absent, the IDL attribute must return the default value, if the content
  3366. attribute has one, or else the empty string.</p>
  3367. <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
  3368. 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
  3369. 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
  3370. 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
  3371. <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
  3372. each URL, ignoring any tokens that did not resolve successfully. If the content attribute is
  3373. absent, the IDL attribute must return the default value, if the content attribute has one, or else
  3374. the empty string. On setting, the IDL attribute must set the content attribute to the specified
  3375. literal value.</p>
  3376. <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
  3377. 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
  3378. values</dfn>, then, on getting, the IDL attribute must return the conforming value associated with
  3379. the state the attribute is in (in its canonical case), if any, or the empty string if the
  3380. attribute is in a state that has no associated keyword value or if the attribute is not in a defined state
  3381. (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
  3382. content attribute must be set to the specified new value.</p>
  3383. <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>
  3384. 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
  3385. the corresponding content attribute is in its <i>missing value default</i> then the IDL attribute
  3386. must return null, otherwise, the IDL attribute must return the conforming value associated with
  3387. the state the attribute is in (in its canonical case); and on setting, if the new value is null,
  3388. the content attribute must be removed, and otherwise, the content attribute must be set to the
  3389. specified new value.</p>
  3390. <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
  3391. of the above categories, then the getting and setting must be done in a transparent,
  3392. case-preserving manner.</p>
  3393. <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
  3394. getting the IDL attribute must return true if the content attribute is set, and false if it is
  3395. absent. On setting, the content attribute must be removed if the IDL attribute is set to false,
  3396. and must be set to the empty string if the IDL attribute is set to true. (This corresponds to the
  3397. rules for <a href=#boolean-attribute id=reflecting-content-attributes-in-idl-attributes:boolean-attribute>boolean content attributes</a>.)</p>
  3398. <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>)
  3399. 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
  3400. value is in the range of the IDL attribute's type, the resulting value must be returned. If, on
  3401. the other hand, it fails or returns an out of range value, or if the attribute is absent, then the
  3402. default value must be returned instead, or 0 if there is no default value. On setting, the given
  3403. 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
  3404. integer</a> and then that string must be used as the new content attribute value.</p>
  3405. <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>)
  3406. that is <dfn id=limited-to-only-non-negative-numbers>limited to only non-negative numbers</dfn> then, on getting, the content attribute
  3407. 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
  3408. is successful, and the value is in the range of the IDL attribute's type, the resulting value must
  3409. be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute
  3410. is absent, the default value must be returned instead, or −1 if there is no default value.
  3411. 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>
  3412. exception. Otherwise, the given value must be converted to the shortest possible string
  3413. 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
  3414. used as the new content attribute value.</p>
  3415. <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
  3416. 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
  3417. successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be
  3418. returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is
  3419. absent, the default value must be returned instead, or 0 if there is no default value. On setting,
  3420. first, if the new value is in the range 0 to 2147483647, then let <var>n</var> be the new value,
  3421. otherwise let <var>n</var> be the default value, or 0 if there is no default value; then,
  3422. <var>n</var> must be converted to the shortest possible string representing the number as a
  3423. <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
  3424. value.</p>
  3425. <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
  3426. greater than zero</dfn>, then the behavior is similar to the previous case, but zero is not
  3427. 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
  3428. parsing non-negative integers</a>, and if that is successful, and the value is in the range 1
  3429. to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or
  3430. returns an out of range value, or if the attribute is absent, the default value must be returned
  3431. instead, or 1 if there is no default value. On setting, if the value is zero, the user agent must
  3432. 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
  3433. 1 to 2147483647, then let <var>n</var> be the new value, otherwise let <var>n</var> be the default
  3434. value, or 1 if there is no default value; then, <var>n</var> must be converted to the shortest
  3435. 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
  3436. string must be used as the new content attribute value.</p>
  3437. <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
  3438. double</a></code>), then, on getting, the content attribute must be parsed according to the
  3439. <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
  3440. resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent,
  3441. the default value must be returned instead, or 0.0 if there is no default value. On setting, the
  3442. 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
  3443. number</a> and then that string must be used as the new content attribute value.</p>
  3444. <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
  3445. double</a></code>) that is <dfn id=limited-to-numbers-greater-than-zero>limited to numbers greater than zero</dfn>, then the behavior is
  3446. similar to the previous case, but zero and negative values are not allowed. On getting, the
  3447. 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
  3448. values</a>, and if that is successful and the value is greater than 0.0, the resulting value
  3449. must be returned. If, on the other hand, it fails or returns an out of range value, or if the
  3450. attribute is absent, the default value must be returned instead, or 0.0 if there is no default
  3451. value. On setting, if the value is less than or equal to zero, then the value must be ignored.
  3452. 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
  3453. floating-point number</a> and then that string must be used as the new content attribute
  3454. value.</p>
  3455. <p class=note>The values Infinity and Not-a-Number (NaN) values throw an exception on setting,
  3456. as defined in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  3457. <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
  3458. <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
  3459. <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
  3460. in question and whose associated attribute's local name is the name of the attribute in question.
  3461. 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
  3462. every time for each attribute.</p>
  3463. <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
  3464. 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
  3465. (stopping at the first point where a value is returned):</p>
  3466. <ol><li>If the corresponding content attribute is absent, then the IDL attribute must return
  3467. 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
  3468. 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
  3469. the corresponding content attribute.<li>If <var>candidate</var> is null, or if it is not type-compatible with the IDL
  3470. attribute, then the IDL attribute must return null.<li>Otherwise, it must return <var>candidate</var>.</ol>
  3471. <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
  3472. 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
  3473. 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
  3474. 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
  3475. 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
  3476. attribute must be set to the empty string.</p>
  3477. <h4 id=collections-2>2.7.2 Collections</h4>
  3478. <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>,
  3479. <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
  3480. <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>
  3481. <h5 id=htmlallcollection>2.7.2.1 HTMLAllCollection</h5>
  3482. <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
  3483. <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
  3484. <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>
  3485. <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>
  3486. 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
  3487. collection</a> of an <code id=htmlallcollection:htmlallcollection-2-3><a href=#htmlallcollection-2>HTMLAllCollection</a></code> object consist of all the descendant
  3488. elements of the root <code id=htmlallcollection:document-2><a href=#document>Document</a></code>.</p>
  3489. <pre class=idl>interface <dfn id=htmlallcollection-2>HTMLAllCollection</dfn> : <a href=#htmlcollection id=htmlallcollection:htmlcollection-3>HTMLCollection</a> {
  3490. // inherits <a href=#dom-htmlcollection-length id=htmlallcollection:dom-htmlcollection-length>length</a> and 'getter'
  3491. <a href=#element id=htmlallcollection:element>Element</a>? <a href=#dom-htmlallcollection-item id=htmlallcollection:dom-htmlallcollection-item-2>item</a>(unsigned long index);
  3492. (<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);
  3493. 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()
  3494. };</pre>
  3495. <dl class=domintro><dt><var>collection</var> . <code id=htmlallcollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
  3496. <p>Returns the number of elements in the collection.</p>
  3497. <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>
  3498. <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>
  3499. <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>
  3500. <p>Returns the item with <a href=#concept-id id=htmlallcollection:concept-id>ID</a> or name <var>name</var> from the collection.</p>
  3501. <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>
  3502. <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>,
  3503. <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>,
  3504. <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
  3505. method; their name is given by the value of their <code>name</code> attribute.</p>
  3506. </dl>
  3507. <p>The object's <a href=#supported-property-indices id=htmlallcollection:supported-property-indices>supported property indices</a> are as defined for
  3508. <code id=htmlallcollection:htmlcollection-7><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
  3509. <p>The <dfn id=dom-htmlallcollection-item><code>item()</code></dfn> method, when invoked
  3510. with a numeric argument, must act like the <a href=#dom-htmlcollection-item id=htmlallcollection:dom-htmlcollection-item>item()</a>
  3511. method inherited from <code id=htmlallcollection:htmlcollection-8><a href=#htmlcollection>HTMLCollection</a></code>.</p>
  3512. <p>The following elements are <dfn id=all-named-elements>"all"-named elements</dfn>:
  3513. <code id=htmlallcollection:the-a-element><a href=#the-a-element>a</a></code>,
  3514. <code id=htmlallcollection:the-applet-element><a href=#the-applet-element>applet</a></code>,
  3515. <code id=htmlallcollection:the-button-element-2><a href=#the-button-element>button</a></code>,
  3516. <code id=htmlallcollection:the-embed-element><a href=#the-embed-element>embed</a></code>,
  3517. <code id=htmlallcollection:the-form-element-2><a href=#the-form-element>form</a></code>,
  3518. <code id=htmlallcollection:frame><a href=#frame>frame</a></code>,
  3519. <code id=htmlallcollection:frameset><a href=#frameset>frameset</a></code>,
  3520. <code id=htmlallcollection:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>,
  3521. <code id=htmlallcollection:the-img-element><a href=#the-img-element>img</a></code>,
  3522. <code id=htmlallcollection:the-input-element-2><a href=#the-input-element>input</a></code>,
  3523. <code id=htmlallcollection:the-map-element-2><a href=#the-map-element>map</a></code>,
  3524. <code id=htmlallcollection:the-meta-element-2><a href=#the-meta-element>meta</a></code>,
  3525. <code id=htmlallcollection:the-object-element-2><a href=#the-object-element>object</a></code>,
  3526. <code id=htmlallcollection:the-select-element-2><a href=#the-select-element>select</a></code>, and
  3527. <code id=htmlallcollection:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>
  3528. </p>
  3529. <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
  3530. collection</a>, and the non-empty values of all the <code>name</code> attributes of
  3531. 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
  3532. <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
  3533. an element preceding its <code>name</code> if it contributes both, they differ from each
  3534. other, and neither is the duplicate of an earlier entry.</p>
  3535. <p>The properties exposed in this way must be <a href=#unenumerable id=htmlallcollection:unenumerable>unenumerable</a>.</p>
  3536. <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>
  3537. methods must act according to the following algorithm:</p>
  3538. <ol><li>If <var>name</var> is the empty string, return null and stop the algorithm.<li>
  3539. <p>Let <var>collection</var> be an <code id=htmlallcollection:htmlcollection-9><a href=#htmlcollection>HTMLCollection</a></code> object rooted at the
  3540. 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
  3541. invoked, whose filter matches only elements that are either:</p>
  3542. <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
  3543. <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>
  3544. <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,
  3545. return null and stop the algorithm.<li>Otherwise, return <var>collection</var>.</ol>
  3546. <h5 id=htmlformcontrolscollection>2.7.2.2 HTMLFormControlsCollection</h5>
  3547. <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
  3548. <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
  3549. <code id=htmlformcontrolscollection:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> elements.</p>
  3550. <pre class=idl>interface <dfn id=htmlformcontrolscollection-2>HTMLFormControlsCollection</dfn> : <a href=#htmlcollection id=htmlformcontrolscollection:htmlcollection>HTMLCollection</a> {
  3551. // 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>()
  3552. 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()
  3553. };
  3554. interface <dfn id=radionodelist>RadioNodeList</dfn> : <a href=#nodelist id=htmlformcontrolscollection:nodelist>NodeList</a> {
  3555. attribute DOMString <a href=#dom-radionodelist-value id=htmlformcontrolscollection:dom-radionodelist-value>value</a>;
  3556. };</pre>
  3557. <dl class=domintro><dt><var>collection</var> . <code id=htmlformcontrolscollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
  3558. <p>Returns the number of elements in the collection.</p>
  3559. <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>
  3560. <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>
  3561. <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>
  3562. <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>
  3563. <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>
  3564. <dt><var>radioNodeList</var> . <var>value</var> [ = <var>value</var> ]<dd>
  3565. <p>Returns the value of the first checked radio button represented by the object.</p>
  3566. <p>Can be set, to check the first radio button with the given value represented by the object.</p>
  3567. </dl>
  3568. <p>The object's <a href=#supported-property-indices id=htmlformcontrolscollection:supported-property-indices>supported property indices</a> are as defined for
  3569. <code id=htmlformcontrolscollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
  3570. <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
  3571. 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
  3572. 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
  3573. duplicate of an earlier entry.</p>
  3574. <p>The properties exposed in this way must be <a href=#unenumerable id=htmlformcontrolscollection:unenumerable>unenumerable</a>.</p>
  3575. <p>The <dfn id=dom-htmlformcontrolscollection-nameditem><code>namedItem(<var>name</var>)</code></dfn> method must act according to the following algorithm:</p>
  3576. <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
  3577. 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>
  3578. 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
  3579. 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>
  3580. view of the <code id=htmlformcontrolscollection:htmlformcontrolscollection-2-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> object, further filtered so that the only
  3581. 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
  3582. to <var>name</var>. The nodes in the <code id=htmlformcontrolscollection:radionodelist-5><a href=#radionodelist>RadioNodeList</a></code> object must be sorted in
  3583. <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>
  3584. <hr>
  3585. <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>
  3586. interface must behave as they would on a <code id=htmlformcontrolscollection:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
  3587. <p>The <dfn id=dom-radionodelist-value><code>value</code></dfn> IDL attribute on the
  3588. <code id=htmlformcontrolscollection:radionodelist-8><a href=#radionodelist>RadioNodeList</a></code> object, on getting, must return the value returned by running the
  3589. following steps:</p>
  3590. <ol><li><p>Let <var>element</var> be the first element in <a href=#tree-order id=htmlformcontrolscollection:tree-order-4>tree order</a>
  3591. 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
  3592. <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>
  3593. <p>On setting, the <code id=htmlformcontrolscollection:dom-radionodelist-value-2><a href=#dom-radionodelist-value>value</a></code> IDL attribute must run the
  3594. following steps:</p>
  3595. <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>
  3596. 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
  3597. <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>
  3598. <p>Otherwise: let <var>element</var> be the first element in <a href=#tree-order id=htmlformcontrolscollection:tree-order-6>tree order</a>
  3599. 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
  3600. <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
  3601. 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>
  3602. </ol>
  3603. <h5 id=htmloptionscollection>2.7.2.3 HTMLOptionsCollection</h5>
  3604. <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
  3605. <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
  3606. attributes and methods that manipulate that element's descendants.</p>
  3607. <pre class=idl>interface <dfn id=htmloptionscollection-2>HTMLOptionsCollection</dfn> : <a href=#htmlcollection id=htmloptionscollection:htmlcollection>HTMLCollection</a> {
  3608. // inherits <a href=#dom-htmlcollection-item id=htmloptionscollection:dom-htmlcollection-item>item</a>()
  3609. attribute unsigned long <a href=#dom-htmloptionscollection-length id=htmloptionscollection:dom-htmloptionscollection-length>length</a>; // shadows inherited length
  3610. <a href=#dom-htmloptionscollection-nameditem id=htmloptionscollection:dom-htmloptionscollection-nameditem>legacycaller</a> <a href=#htmloptionelement id=htmloptionscollection:htmloptionelement>HTMLOptionElement</a>? (DOMString name);
  3611. <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);
  3612. 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);
  3613. void <a href=#dom-htmloptionscollection-remove id=htmloptionscollection:dom-htmloptionscollection-remove>remove</a>(long index);
  3614. attribute long <a href=#dom-htmloptionscollection-selectedindex id=htmloptionscollection:dom-htmloptionscollection-selectedindex>selectedIndex</a>;
  3615. };</pre>
  3616. <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>
  3617. <p>Returns the number of elements in the collection.</p>
  3618. <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>
  3619. <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>
  3620. <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>
  3621. <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>
  3622. <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>
  3623. <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>
  3624. <p>If there are multiple matching items, then the first is returned.</p>
  3625. <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>
  3626. <p>Inserts <var>element</var> before the node given by <var>before</var>.</p>
  3627. <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
  3628. collection, in which case <var>element</var> is inserted before that element.</p>
  3629. <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>
  3630. <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>
  3631. <dt><var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-selectedindex-2><a href=#dom-htmloptionscollection-selectedindex>selectedIndex</a></code> [ = <var>value</var> ]<dd>
  3632. <p>Returns the index of the first selected item, if any, or −1 if there is no selected
  3633. item.</p>
  3634. <p>Can be set, to change the selection.</p>
  3635. </dl>
  3636. <p>The object's <a href=#supported-property-indices id=htmloptionscollection:supported-property-indices>supported property indices</a> are as defined for
  3637. <code id=htmloptionscollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
  3638. <p>On getting, the <dfn id=dom-htmloptionscollection-length><code>length</code></dfn>
  3639. 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>
  3640. <p>On setting, the behavior depends on whether the new value is equal to, greater than, or less
  3641. 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
  3642. 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
  3643. 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
  3644. rooted, where <var>n</var> is the difference between the two numbers (new value minus old
  3645. value). Mutation events must be fired as if a <code id=htmloptionscollection:documentfragment><a href=#documentfragment>DocumentFragment</a></code> containing the new
  3646. <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>
  3647. <p class=note>Setting <code id=htmloptionscollection:dom-htmloptionscollection-length-3><a href=#dom-htmloptionscollection-length>length</a></code> never removes
  3648. 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
  3649. <code id=htmloptionscollection:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> elements (though it can remove children from them).</p>
  3650. <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
  3651. 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
  3652. 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
  3653. the duplicate of an earlier entry.</p>
  3654. <p>The properties exposed in this way must be <a href=#unenumerable id=htmloptionscollection:unenumerable>unenumerable</a>.</p>
  3655. <p>The <dfn id=dom-htmloptionscollection-nameditem>legacy caller</dfn> of the
  3656. <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
  3657. <code id=htmloptionscollection:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>
  3658. <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter>set the value of a new
  3659. indexed property or set the value of an existing indexed property</dfn> for a given property index
  3660. <var>index</var> to a new value <var>value</var>, it must run the following
  3661. algorithm:</p>
  3662. <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
  3663. 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
  3664. 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
  3665. 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>
  3666. 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>
  3667. 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>
  3668. <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>
  3669. <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
  3670. 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>
  3671. exception and abort these steps.<li><p>If <var>before</var> is an element, but that element isn't a descendant of the
  3672. <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
  3673. 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
  3674. return and abort these steps.<li><p>If <var>before</var> is a node, then let <var>reference</var> be that
  3675. 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.
  3676. Otherwise, let <var>reference</var> be null.<li><p>If <var>reference</var> is not null, let <var>parent</var> be the parent
  3677. node of <var>reference</var>. Otherwise, let <var>parent</var> be the
  3678. <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
  3679. invoked on the <var>parent</var> node, with <var>element</var> as the first
  3680. argument and <var>reference</var> as the second argument.</p>
  3681. </ol>
  3682. <p>The <dfn id=dom-htmloptionscollection-remove><code>remove(<var>index</var>)</code></dfn> method must act according to the following algorithm:</p>
  3683. <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
  3684. steps.<li><p>If <var>index</var> is not a number greater than or equal to 0 and less than the
  3685. 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
  3686. collection.<li><p>Remove <var>element</var> from its parent node.</ol>
  3687. <p>The <dfn id=dom-htmloptionscollection-selectedindex><code>selectedIndex</code></dfn> IDL
  3688. 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
  3689. which the <code id=htmloptionscollection:htmloptionscollection-2-8><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is rooted</p>
  3690. <h5 id=htmlpropertiescollection>2.7.2.4 HTMLPropertiesCollection</h5>
  3691. <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
  3692. elements that add <a href=#the-properties-of-an-item id=htmlpropertiescollection:the-properties-of-an-item>name-value pairs</a> to a particular
  3693. <a href=#concept-item id=htmlpropertiescollection:concept-item>item</a> in the <a href=#microdata id=htmlpropertiescollection:microdata>microdata</a> model.</p>
  3694. <pre class=idl>interface <dfn id=htmlpropertiescollection-2>HTMLPropertiesCollection</dfn> : <a href=#htmlcollection id=htmlpropertiescollection:htmlcollection>HTMLCollection</a> {
  3695. // 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>()
  3696. 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()
  3697. readonly attribute DOMString[] <a href=#dom-htmlpropertiescollection-names id=htmlpropertiescollection:dom-htmlpropertiescollection-names>names</a>;
  3698. };
  3699. typedef sequence&lt;any> <dfn id=propertyvaluearray>PropertyValueArray</dfn>;
  3700. interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist id=htmlpropertiescollection:nodelist>NodeList</a> {
  3701. <a href=#propertyvaluearray id=htmlpropertiescollection:propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-getvalues id=htmlpropertiescollection:dom-propertynodelist-getvalues>getValues</a>();
  3702. };</pre>
  3703. <dl class=domintro><dt><var>collection</var> . <code id=htmlpropertiescollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
  3704. <p>Returns the number of elements in the collection.</p>
  3705. <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>
  3706. <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>
  3707. <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>
  3708. <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>
  3709. <dt><var>collection</var>[<var>name</var>]<dd>
  3710. <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>
  3711. <dt><var>collection</var> . <code id=htmlpropertiescollection:dom-htmlpropertiescollection-names-3><a href=#dom-htmlpropertiescollection-names>names</a></code><dd>
  3712. <p>Returns an array with the <a href=#property-names id=htmlpropertiescollection:property-names>property names</a> of the elements in the collection.</p>
  3713. <dt><var>propertyNodeList</var> . <code id=htmlpropertiescollection:dom-propertynodelist-getvalues-2><a href=#dom-propertynodelist-getvalues>getValues</a></code>()<dd>
  3714. <p>Returns an array of the various values that the relevant elements have.</p>
  3715. </dl>
  3716. <p>The object's <a href=#supported-property-indices id=htmlpropertiescollection:supported-property-indices>supported property indices</a> are as defined for
  3717. <code id=htmlpropertiescollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
  3718. <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
  3719. 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
  3720. duplicates.</p>
  3721. <p>The properties exposed in this way must be <a href=#unenumerable id=htmlpropertiescollection:unenumerable>unenumerable</a>.</p>
  3722. <p>The <dfn id=dom-htmlpropertiescollection-names><code>names</code></dfn> attribute must
  3723. 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
  3724. 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>,
  3725. listed in <a href=#tree-order id=htmlpropertiescollection:tree-order-3>tree order</a>, but with duplicates removed, leaving only the first occurrence
  3726. of each name. The same object must be returned each time.</p>
  3727. <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
  3728. 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
  3729. 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
  3730. <a href=#property-names id=htmlpropertiescollection:property-names-4>property name</a> equal to <var>name</var>. The nodes in
  3731. 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
  3732. object must be returned each time a particular <var>name</var> is queried.</p>
  3733. <hr>
  3734. <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>
  3735. interface must behave as they would on a <code id=htmlpropertiescollection:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
  3736. <p>The <dfn id=dom-propertynodelist-getvalues><code>getValues</code></dfn> method the
  3737. <code id=htmlpropertiescollection:propertynodelist-8><a href=#propertynodelist>PropertyNodeList</a></code> object must return a newly constructed array whose values are the
  3738. values obtained from the <code id=htmlpropertiescollection:dom-itemvalue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute of each of the
  3739. elements represented by the object, in <a href=#tree-order id=htmlpropertiescollection:tree-order-5>tree order</a>.</p>
  3740. <h4 id=domstringmap>2.7.3 DOMStringMap</h4>
  3741. <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
  3742. using the scripting language's native mechanisms for property access.</p>
  3743. <p>When a <code id=domstringmap:domstringmap-2-2><a href=#domstringmap-2>DOMStringMap</a></code> object is instantiated, it is associated with three
  3744. algorithms, one for getting the list of name-value pairs, one for setting names to certain values,
  3745. and one for deleting names.</p>
  3746. <pre class=idl>[OverrideBuiltins, Exposed=(Window,Worker)]
  3747. interface <dfn id=domstringmap-2>DOMStringMap</dfn> {
  3748. <a href=#dom-domstringmap-nameditem id=domstringmap:dom-domstringmap-nameditem>getter</a> DOMString (DOMString name);
  3749. <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);
  3750. <a href=#dom-domstringmap-removeitem id=domstringmap:dom-domstringmap-removeitem>deleter</a> void (DOMString name);
  3751. };</pre>
  3752. <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
  3753. are the names of each pair returned from the algorithm for getting the list of name-value pairs at
  3754. that instant, in the order returned.</p>
  3755. <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
  3756. of the name-value pair whose name component is <var>name</var> in the list returned by
  3757. the algorithm for getting the list of name-value pairs.</p>
  3758. <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
  3759. <var>value</var>, the algorithm for setting names to certain values must be run, passing
  3760. <var>name</var> as the name and the result of converting <var>value</var> to a
  3761. <code id=domstringmap:idl-domstring><a href=#idl-domstring>DOMString</a></code> as the value.</p>
  3762. <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>
  3763. <p class=note>The <code id=domstringmap:domstringmap-2-5><a href=#domstringmap-2>DOMStringMap</a></code> interface definition here is only intended for
  3764. JavaScript environments. Other language bindings will need to define how <code id=domstringmap:domstringmap-2-6><a href=#domstringmap-2>DOMStringMap</a></code>
  3765. is to be implemented for those languages.</p>
  3766. <div class=example>
  3767. <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>
  3768. <p>Given the following fragment and elements with similar constructions:</p>
  3769. <pre>&lt;img class="tower" id="tower5" data-x="12" data-y="5"
  3770. data-ai="robotarget" data-hp="46" data-ability="flames"
  3771. src="towers/rocket.png alt="Rocket Tower"></pre>
  3772. <p>...one could imagine a function <code>splashDamage()</code> that takes some arguments, the first
  3773. of which is the element to process:</p>
  3774. <pre>function splashDamage(node, x, y, damage) {
  3775. if (node.classList.contains('tower') &amp;&amp; // checking the 'class' attribute
  3776. node.dataset.x == x &amp;&amp; // reading the 'data-x' attribute
  3777. node.dataset.y == y) { // reading the 'data-y' attribute
  3778. var hp = parseInt(node.dataset.hp); // reading the 'data-hp' attribute
  3779. hp = hp - damage;
  3780. if (hp &lt; 0) {
  3781. hp = 0;
  3782. node.dataset.ai = 'dead'; // setting the 'data-ai' attribute
  3783. delete node.dataset.ability; // removing the 'data-ability' attribute
  3784. }
  3785. node.dataset.hp = hp; // setting the 'data-hp' attribute
  3786. }
  3787. }</pre>
  3788. </div>
  3789. <h4 id=domelementmap>2.7.4 DOMElementMap</h4>
  3790. <p>The <code id=domelementmap:domelementmap-2><a href=#domelementmap-2>DOMElementMap</a></code> interface represents a set of name-element mappings. It exposes
  3791. these using the scripting language's native mechanisms for property access.</p>
  3792. <p>When a <code id=domelementmap:domelementmap-2-2><a href=#domelementmap-2>DOMElementMap</a></code> object is instantiated, it is associated with three
  3793. algorithms, one for getting the list of name-element mappings, one for mapping a name to a certain
  3794. element, and one for deleting mappings by name.</p>
  3795. <pre class=idl>interface <dfn id=domelementmap-2>DOMElementMap</dfn> {
  3796. <a href=#dom-domelementmap-nameditem id=domelementmap:dom-domelementmap-nameditem>getter</a> <a href=#element id=domelementmap:element>Element</a> (DOMString name);
  3797. <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);
  3798. <a href=#dom-domelementmap-removeitem id=domelementmap:dom-domelementmap-removeitem>deleter</a> void (DOMString name);
  3799. };</pre>
  3800. <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
  3801. are the names for each mapping returned from the algorithm for getting the list of name-element
  3802. mappings at that instant, in the order returned.</p>
  3803. <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
  3804. component of the name-element mapping whose name component is <var>name</var> in the list
  3805. returned by the algorithm for getting the list of name-element mappings.</p>
  3806. <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
  3807. <var>value</var>, the algorithm for mapping a name to a certain element must be run,
  3808. passing <var>name</var> as the name <var>value</var> as the element.</p>
  3809. <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>
  3810. <p class=note>The <code id=domelementmap:domelementmap-2-5><a href=#domelementmap-2>DOMElementMap</a></code> interface definition here is only intended for
  3811. JavaScript environments. Other language bindings will need to define how
  3812. <code id=domelementmap:domelementmap-2-6><a href=#domelementmap-2>DOMElementMap</a></code> is to be implemented for those languages.</p>
  3813. <h4 id=transferable-objects>2.7.5 Transferable objects</h4>
  3814. <p>Some objects support being copied and closed in one operation. This is called
  3815. <i>transferring</i> the object, and is used in particular to transfer ownership of unsharable or
  3816. expensive resources across worker boundaries.</p>
  3817. <p>The following <code id=transferable-objects:transferable><a href=#transferable>Transferable</a></code> types exist:</p>
  3818. <ul class=brief><li><code id=transferable-objects:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> <a href=#refsECMA262>[ECMA262]</a>
  3819. <li><code id=transferable-objects:canvasproxy><a href=#canvasproxy>CanvasProxy</a></code> (defined in this specification)
  3820. <li><code id=transferable-objects:messageport><a href=#messageport>MessagePort</a></code> (defined in this specification)
  3821. </ul>
  3822. <p>The following IDL block formalizes this:</p>
  3823. <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>
  3824. <p>To <dfn id=transfer-a-transferable-object>transfer a <code>Transferable</code> object</dfn> to a new owner, the user agent must
  3825. run the steps defined for the type of object in question. The steps will return a new object of
  3826. the same type, and will permanently <dfn id=concept-transferable-neutered>neuter</dfn> the
  3827. original object. (This is an irreversible and non-idempotent operation; once an object has been
  3828. transferred, it cannot be transferred, or indeed used, again.)</p>
  3829. <p id=transferArrayBuffer>To <a href=#transfer-a-transferable-object id=transferable-objects:transfer-a-transferable-object>transfer</a> an
  3830. <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
  3831. the same underlying data as <var>old</var>, thus obtaining <var>new</var>,
  3832. must <a href=#concept-transferable-neutered id=transferable-objects:concept-transferable-neutered>neuter</a> the <var>old</var>
  3833. object, and must finally return <var>new</var>. <a href=#refsECMA262>[ECMA262]</a></p>
  3834. <p class=note>Rules for how to <a href=#transferCanvasProxy>transfer a
  3835. <code>CanvasProxy</code> object</a> and how to <a href=#transferMessagePort>transfer a
  3836. <code>MessagePort</code> object</a> are given in the relevant sections of this specification.</p>
  3837. <h4 id=safe-passing-of-structured-data>2.7.6 Safe passing of structured data</h4>
  3838. <p>When a user agent is required to obtain a <dfn id=structured-clone>structured clone</dfn> of a value, optionally
  3839. with a <i>transfer map</i>, it must run the following algorithm, which either returns a separate
  3840. value, or throws an exception. If a <i>transfer map</i> is provided, it consists of an association
  3841. list of <code id=safe-passing-of-structured-data:transferable><a href=#transferable>Transferable</a></code> objects to placeholder objects.</p>
  3842. <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
  3843. the empty list otherwise.<li><p>Let <var>memory</var> be an association list of pairs of objects, initially empty. This is
  3844. 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
  3845. <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
  3846. 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
  3847. cloning algorithm</a> with <var>input</var> as the "<var>input</var>" argument, and
  3848. <var>memory</var> as the "<var>memory</var>" argument.<li><p>Return <var>output</var>.</ol>
  3849. <p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always called with two arguments,
  3850. <var>input</var> and <var>memory</var>, and its behavior is as follows:</p>
  3851. <ol><li><p>If <var>input</var> is the source object of a pair of objects in <var>memory</var>, then
  3852. 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
  3853. steps.<li><p>Let <var>deep clone</var> be <i>none</i>.<li>
  3854. <p>The <var>input</var> value is an object. Jump to the appropriate step below:</p>
  3855. <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
  3856. <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
  3857. <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
  3858. <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
  3859. 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>
  3860. <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
  3861. pattern and flags as <var>input</var>.</p>
  3862. <p class=note>The value of the <code>lastIndex</code> property is not copied.</p>
  3863. <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
  3864. 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>
  3865. be a newly constructed object of the same class as <var>input</var>, corresponding to the same
  3866. 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
  3867. 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
  3868. 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>
  3869. 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
  3870. <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
  3871. "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
  3872. 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
  3873. 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>
  3874. exception and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-2>structured clone</a> algorithm. Otherwise, let
  3875. <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
  3876. 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>
  3877. <p>Let <var>output</var> be a newly constructed object of the same class as <var>input</var>,
  3878. with its [[DataView]] internal property present, its [[ViewedArrayBuffer]] internal property
  3879. 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>
  3880. recursively with the value of the internal property on <var>input</var> as the new
  3881. "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>" argument, and
  3882. with the [[ByteLength]] and [[ByteOffset]] internal properties set to the same value as their
  3883. counterparts on <var>input</var>.</p>
  3884. <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>
  3885. <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>
  3886. object whose <code>length</code> is equal to the <code>length</code> of
  3887. <var>input</var>, and set <var>deep clone</var> to <i>own</i>.</p>
  3888. <p class=note>This means that the length of sparse arrays is preserved.</p>
  3889. <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>
  3890. 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>
  3891. 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
  3892. 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
  3893. <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
  3894. clone</a> algorithm.</dl>
  3895. <p>For the purposes of the algorithm above, an object is a particular type of object
  3896. <var>class</var> if its [[Class]] internal property is equal to <var>class</var>.</p>
  3897. <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>
  3898. object" if <var>input</var>'s [[Class]] internal property is equal to the string "<code>Object</code>".</p>
  3899. <li><p>Add a mapping from <var>input</var> (the source object) to <var>output</var> (the
  3900. destination object) to <var>memory</var>.<li>
  3901. <p>If <var>deep clone</var> is set to <i>map</i>, then run these substeps. These substeps use
  3902. the terminology and typographic conventions used in the JavaScript specification's definition of
  3903. Maps. <a href=#refsECMA262>[ECMA262]</a></p>
  3904. <ol><li><p>Let <var>source</var> be the List that is the value of <var>input</var>'s [[MapData]]
  3905. internal slot, if any. If there is no such slot, then instead throw a
  3906. <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>
  3907. 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]]
  3908. internal slot.<li>
  3909. <p>For each Record {[[key]], [[value]]} <var>entry</var> that is an element of
  3910. <var>source</var>, run the following substeps:</p>
  3911. <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
  3912. cloning algorithm</a> recursively with <var>entry</var>.[[key]] as the new
  3913. "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
  3914. 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
  3915. structured cloning algorithm</a> recursively with <var>entry</var>.[[value]] as the new
  3916. "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
  3917. argument.<li><p>Let <var>new entry</var> be the Record {[[key]]: <var>key</var>, [[value]]:
  3918. <var>value</var>}.<li><p>Append <var>new entry</var> as the last element of <var>target</var>.</ol>
  3919. <li><p>Set <var>deep clone</var> to <i>own</i>.</ol>
  3920. <li>
  3921. <p>If <var>deep clone</var> is set to <i>set</i>, then run these substeps. These substeps use
  3922. the terminology and typographic conventions used in the JavaScript specification's definition of
  3923. Sets. <a href=#refsECMA262>[ECMA262]</a></p>
  3924. <ol><li><p>Let <var>source</var> be the List that is the value of <var>input</var>'s [[SetData]]
  3925. internal slot, if any. If there is no such slot, then instead throw a
  3926. <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>
  3927. 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]]
  3928. internal slot.<li>
  3929. <p>For each <var>entry</var> that is an element of <var>source</var> that is not <i>empty</i>,
  3930. run the following substeps:</p>
  3931. <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
  3932. structured cloning algorithm</a> recursively with <var>entry</var> as the new
  3933. "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
  3934. argument.<li><p>Append <var>new entry</var> as the last element of <var>target</var>.</ol>
  3935. <li><p>Set <var>deep clone</var> to <i>own</i>.</ol>
  3936. <li>
  3937. <p>If <var>deep clone</var> is set to <i>own</i>, then, for each enumerable own property in
  3938. <var>input</var>, run the following steps:</p>
  3939. <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
  3940. <var>input</var> with the argument <var>name</var>. If the [[Get]] internal method of a
  3941. property involved executing script, and that script threw an uncaught exception, then abort the
  3942. 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
  3943. 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
  3944. cloning algorithm</a> recursively with <var>source value</var> as the "<var>input</var>"
  3945. argument and <var>memory</var> as the "<var>memory</var>" argument. If this results in an
  3946. 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
  3947. 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
  3948. value <var>cloned value</var>.</ol>
  3949. <p>The order of the properties in the <var>input</var> and <var>output</var> objects must be the
  3950. same, and any properties whose [[Get]] internal method involves running script must be processed
  3951. in that same order.</p>
  3952. <p class=note>This does not walk the prototype chain.</p>
  3953. <p class=note>Property descriptors, setters, getters, and analogous features are not copied in
  3954. this process. For example, the property in the input could be marked as read-only, but in the
  3955. output it would just have the default state (typically read-write, though that could depend on
  3956. the scripting environment).</p>
  3957. <p class=note>Properties of Array objects are not treated any differently than those of other
  3958. Objects. In particular, this means that non-index properties of arrays are copied as well.</p>
  3959. <li><p>Return <var>output</var>.</ol>
  3960. <p class=note>This algorithm preserves cycles and preserves the identity of duplicate objects in
  3961. graphs.</p>
  3962. <h4 id=callbacks>2.7.7 Callbacks</h4>
  3963. <p>The following callback function type is used in various APIs that interact with
  3964. <code id=callbacks:file><a href=#file>File</a></code> objects:</p>
  3965. <pre class=idl>callback <dfn id=filecallback>FileCallback</dfn> = void (<a href=#file id=callbacks:file-2>File</a> file);</pre>
  3966. <h4 id=garbage-collection>2.7.8 Garbage collection</h4>
  3967. <p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL attribute that returns a
  3968. pre-existing object to that object.</p>
  3969. <div class=example>
  3970. <p>For example, the <code id=garbage-collection:dom-document-location><a href=#dom-document-location>document.location</a></code> attribute means
  3971. 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>
  3972. object. Similarly, there is always a strong reference from a <code id=garbage-collection:document-2><a href=#document>Document</a></code> to any
  3973. descendant nodes, and from any node to its owner <code id=garbage-collection:document-3><a href=#document>Document</a></code>.</p>
  3974. </div>
  3975. <h3 id=namespaces>2.8 Namespaces</h3>
  3976. <p>The <dfn id=html-namespace-2>HTML namespace</dfn> is: <code>http://www.w3.org/1999/xhtml</code></p>
  3977. <p>The <dfn id=mathml-namespace>MathML namespace</dfn> is: <code>http://www.w3.org/1998/Math/MathML</code></p>
  3978. <p>The <dfn id=svg-namespace>SVG namespace</dfn> is: <code>http://www.w3.org/2000/svg</code></p>
  3979. <p>The <dfn id=xlink-namespace>XLink namespace</dfn> is: <code>http://www.w3.org/1999/xlink</code></p>
  3980. <p>The <dfn id=xml-namespace>XML namespace</dfn> is: <code>http://www.w3.org/XML/1998/namespace</code></p>
  3981. <p>The <dfn id=xmlns-namespace>XMLNS namespace</dfn> is: <code>http://www.w3.org/2000/xmlns/</code></p>
  3982. <hr>
  3983. <p>Data mining tools and other user agents that perform operations
  3984. on content without running scripts, evaluating CSS or XPath
  3985. expressions, or otherwise exposing the resulting DOM to arbitrary
  3986. content, may "support namespaces" by just asserting that their DOM
  3987. node analogues are in certain namespaces, without actually exposing
  3988. the above strings.</p>
  3989. <hr>
  3990. <p class=note>In <a href=#syntax id=namespaces:syntax>the HTML syntax</a>, namespace prefixes
  3991. and namespace declarations do not have the same effect as in XML.
  3992. For instance, the colon has no special meaning in HTML element
  3993. names.</p>
  3994. <h2 id=dom>3 Semantics, structure, and APIs of HTML documents</h2>
  3995. <h3 id=documents>3.1 Documents</h3>
  3996. <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>
  3997. <p><dfn id="the-document's-address"><a href=http://dom.spec.whatwg.org/#concept-document-url>The document's
  3998. 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
  3999. standard). It is initially set when the <code id=documents:document-3><a href=#document>Document</a></code> is created, but that can change
  4000. 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>
  4001. on the page and when the <code id=documents:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code> method is called
  4002. with a new <a href=#url id=documents:url>URL</a>. <a href=#refsDOM>[DOM]</a></p>
  4003. <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
  4004. their user interface. This is the primary mechanism by which a user can tell if a site is
  4005. attempting to impersonate another.</p>
  4006. <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
  4007. 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
  4008. 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
  4009. <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
  4010. <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
  4011. loaded</a> immediately.</p>
  4012. <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
  4013. <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
  4014. string.</p>
  4015. <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
  4016. 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
  4017. 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
  4018. string that is used as the source of the document when it is reloaded.</p>
  4019. <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
  4020. browsing context</a>, it must act as follows:</p>
  4021. <ol><li><p>Let <var>source</var> be the value of the <a href=#browsing-context id=documents:browsing-context>browsing context</a>'s
  4022. <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
  4023. 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>
  4024. <p><a href=#navigate id=documents:navigate-2>Navigate</a> the <a href=#browsing-context id=documents:browsing-context-3>browsing context</a> to
  4025. a resource whose source is <var>source</var>, with <a href=#replacement-enabled id=documents:replacement-enabled>replacement enabled</a>
  4026. 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
  4027. the <a href=#an-overridden-reload id=documents:an-overridden-reload>overridden reload</a> algorithm. When the
  4028. <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
  4029. 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
  4030. buffer</a> to <var>source</var>.</p>
  4031. <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
  4032. <a href=#override-url id=documents:override-url>override URL</a>.</p>
  4033. </ol>
  4034. <h4 id=the-document-object>3.1.1 The <code id=the-document-object:document><a href=#document>Document</a></code> object</h4>
  4035. <p>The DOM specification defines a <code id=the-document-object:dom-document><a href=#dom-document>Document</a></code> interface, which
  4036. this specification extends significantly:</p>
  4037. <pre class=idl>enum <dfn id=documentreadystate>DocumentReadyState</dfn> { "loading", "interactive", "complete" };
  4038. [OverrideBuiltins]
  4039. partial /*sealed*/ interface <dfn id=document>Document</dfn> {
  4040. // <a href=#resource-metadata-management id=the-document-object:resource-metadata-management>resource metadata management</a>
  4041. [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>;
  4042. attribute DOMString <a href=#dom-document-domain id=the-document-object:dom-document-domain>domain</a>;
  4043. readonly attribute DOMString <a href=#dom-document-referrer id=the-document-object:dom-document-referrer>referrer</a>;
  4044. attribute DOMString <a href=#dom-document-cookie id=the-document-object:dom-document-cookie>cookie</a>;
  4045. readonly attribute DOMString <a href=#dom-document-lastmodified id=the-document-object:dom-document-lastmodified>lastModified</a>;
  4046. 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>;
  4047. // <a href=#dom-tree-accessors id=the-document-object:dom-tree-accessors>DOM tree accessors</a>
  4048. <a href=#dom-document-nameditem id=the-document-object:dom-document-nameditem>getter</a> object (DOMString name);
  4049. attribute DOMString <a href=#document.title id=the-document-object:document.title>title</a>;
  4050. attribute DOMString <a href=#dom-document-dir id=the-document-object:dom-document-dir>dir</a>;
  4051. 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>;
  4052. 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>;
  4053. 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>;
  4054. 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>;
  4055. 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>;
  4056. 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>;
  4057. 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>;
  4058. 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>;
  4059. NodeList <a href=#dom-document-getelementsbyname id=the-document-object:dom-document-getelementsbyname>getElementsByName</a>(DOMString elementName);
  4060. 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>
  4061. 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>;
  4062. 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>;
  4063. // <a href=#dynamic-markup-insertion id=the-document-object:dynamic-markup-insertion>dynamic markup insertion</a>
  4064. <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 = "");
  4065. <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);
  4066. void <a href=#dom-document-close id=the-document-object:dom-document-close>close</a>();
  4067. void <a href=#dom-document-write id=the-document-object:dom-document-write>write</a>(DOMString... text);
  4068. void <a href=#dom-document-writeln id=the-document-object:dom-document-writeln>writeln</a>(DOMString... text);
  4069. // <a href=#editing id=the-document-object:editing>user interaction</a>
  4070. 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>;
  4071. 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>;
  4072. boolean <a href=#dom-document-hasfocus id=the-document-object:dom-document-hasfocus>hasFocus</a>();
  4073. attribute DOMString <a href=#designMode id=the-document-object:designMode>designMode</a>;
  4074. boolean <a href=#execCommand id=the-document-object:execCommand>execCommand</a>(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
  4075. boolean <a href=#dom-document-querycommandenabled id=the-document-object:dom-document-querycommandenabled>queryCommandEnabled</a>(DOMString commandId);
  4076. boolean <a href=#dom-document-querycommandindeterm id=the-document-object:dom-document-querycommandindeterm>queryCommandIndeterm</a>(DOMString commandId);
  4077. boolean <a href=#dom-document-querycommandstate id=the-document-object:dom-document-querycommandstate>queryCommandState</a>(DOMString commandId);
  4078. boolean <a href=#dom-document-querycommandsupported id=the-document-object:dom-document-querycommandsupported>queryCommandSupported</a>(DOMString commandId);
  4079. DOMString <a href=#dom-document-querycommandvalue id=the-document-object:dom-document-querycommandvalue>queryCommandValue</a>(DOMString commandId);
  4080. 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>;
  4081. // 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
  4082. [LenientThis] attribute <a href=#eventhandler id=the-document-object:eventhandler>EventHandler</a> <a href=#handler-onreadystatechange id=the-document-object:handler-onreadystatechange>onreadystatechange</a>;
  4083. // <a href="#Document-partial">also has obsolete members</a>
  4084. };
  4085. <a href=#document id=the-document-object:document-3>Document</a> implements <a href=#globaleventhandlers id=the-document-object:globaleventhandlers>GlobalEventHandlers</a>;</pre>
  4086. <h4 id=resource-metadata-management>3.1.2 <dfn>Resource metadata management</dfn></h4>
  4087. <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-referrer><a href=#dom-document-referrer>referrer</a></code><dd>
  4088. <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>
  4089. from which the user navigated to this one, unless it was blocked or there was no such document,
  4090. in which case it returns the empty string.</p>
  4091. <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
  4092. referrer.</p>
  4093. </dl>
  4094. <p>The <dfn id=dom-document-referrer><code>referrer</code></dfn> attribute must return
  4095. <a href="#the-document's-referrer" id="resource-metadata-management:the-document's-referrer">the document's referrer</a>.</p>
  4096. <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
  4097. attribute will match the <code id=resource-metadata-management:http-referer><a href=#http-referer>Referer</a></code> (sic) header that was sent when
  4098. <a href=#fetch id=resource-metadata-management:fetch>fetching</a> the current page.</p>
  4099. <p class=note>Typically user agents are configured to not report referrers in the case where the
  4100. referrer uses an encrypted protocol and the current page does not (e.g. when navigating from an
  4101. <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>
  4102. page).</p>
  4103. <hr>
  4104. <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>
  4105. <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
  4106. cookies can't be applied to this resource, the empty string will be returned.</p>
  4107. <p>Can be set, to add a new cookie to the element's set of HTTP cookies.</p>
  4108. <p>If the contents are <a href=#sandboxed-origin-browsing-context-flag id=resource-metadata-management:sandboxed-origin-browsing-context-flag>sandboxed into a
  4109. 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
  4110. will be thrown on getting and setting.</p>
  4111. </dl>
  4112. <p>The <dfn id=dom-document-cookie><code>cookie</code></dfn> attribute represents the cookies
  4113. 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>
  4114. <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
  4115. <dfn id=cookie-averse-document-object>cookie-averse <code>Document</code> object</dfn>:</p>
  4116. <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
  4117. use a server-based naming authority.</ul>
  4118. <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>
  4119. object</a>, then the user agent must return the empty string. Otherwise, if the
  4120. <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
  4121. 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
  4122. 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>
  4123. 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>
  4124. <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>
  4125. </p>
  4126. <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
  4127. 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
  4128. 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.
  4129. 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
  4130. <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
  4131. 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>
  4132. <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
  4133. across frames, the path restrictions on cookies are only a tool to help manage which cookies are
  4134. sent to which parts of the site, and are not in any way a security feature.</p>
  4135. <hr>
  4136. <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-lastmodified><a href=#dom-document-lastmodified>lastModified</a></code><dd>
  4137. <p>Returns the date of the last modification to the document, as reported by the server, in the
  4138. form "<code>MM/DD/YYYY hh:mm:ss</code>", in the user's local time zone.</p>
  4139. <p>If the last modification date is not known, the current time is returned instead.</p>
  4140. </dl>
  4141. <p>The <dfn id=dom-document-lastmodified><code>lastModified</code></dfn> attribute, on
  4142. 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
  4143. modification, in the user's local time zone, in the following format:</p>
  4144. <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>
  4145. <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
  4146. digits</a> representing the number in base ten, zero-padded if necessary. The year must be
  4147. 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
  4148. number in base ten, zero-padded if necessary.</p>
  4149. <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
  4150. 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
  4151. file system for local files. If the last modification date and time are not known, the attribute
  4152. must return the current date and time in the above format.</p>
  4153. <hr>
  4154. <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-readystate><a href=#dom-document-readystate>readyState</a></code><dd>
  4155. <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
  4156. "<code>complete</code>" once it has loaded.</p>
  4157. <p>The <code id=resource-metadata-management:event-readystatechange><a href=#event-readystatechange>readystatechange</a></code> event fires on the
  4158. <code id=resource-metadata-management:document-11><a href=#document>Document</a></code> object when this value changes.</p>
  4159. </dl>
  4160. <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
  4161. 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
  4162. <a href=#xml-parser id=resource-metadata-management:xml-parser>XML parser</a>, or an XSLT processor, and to the string "<code>complete</code>"
  4163. otherwise. Various algorithms during page loading affect this value. When the value is set, the
  4164. 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>
  4165. <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
  4166. <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>
  4167. <p>The <dfn id=dom-document-readystate><code>readyState</code></dfn> IDL attribute must, on
  4168. getting, return the <a href=#current-document-readiness id=resource-metadata-management:current-document-readiness-2>current document readiness</a>.</p>
  4169. <h4 id=dom-tree-accessors>3.1.3 <dfn>DOM tree accessors</dfn></h4>
  4170. <p><dfn id=the-html-element-2>The <code>html</code> element</dfn> of a document is the document's root element, if there
  4171. 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>
  4172. <hr>
  4173. <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-head><a href=#dom-document-head>head</a></code><dd>
  4174. <p>Returns <a href=#the-head-element-2 id=dom-tree-accessors:the-head-element-2>the <code>head</code> element</a>.</p>
  4175. </dl>
  4176. <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
  4177. 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
  4178. otherwise.</p>
  4179. <p>The <dfn id=dom-document-head><code>head</code></dfn> attribute, on getting, must return
  4180. <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
  4181. null).</p>
  4182. <hr>
  4183. <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>
  4184. <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
  4185. HTML and as given by the SVG <code>title</code> element for SVG.</p>
  4186. <p>Can be set, to update the document's title. If there is no appropriate element to update, the
  4187. new value is ignored.</p>
  4188. </dl>
  4189. <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
  4190. 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>
  4191. <p>The <dfn id=document.title><code>title</code></dfn> attribute
  4192. must, on getting, run the following algorithm:</p>
  4193. <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
  4194. namespace</a>, then let <var>value</var> be a concatenation of the data of all the
  4195. 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
  4196. 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
  4197. <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
  4198. 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
  4199. 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>
  4200. <p>On setting, the steps corresponding to the first matching condition in the following list must
  4201. be run:</p>
  4202. <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
  4203. namespace</a> <a href=#refsSVG>[SVG]</a><dd>
  4204. <ol><li><p>Let <var>element</var> be the first <code>title</code> element in
  4205. 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
  4206. there isn't one, create a <code>title</code> element in the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace-5>SVG
  4207. 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
  4208. set to the new value being assigned.</ol>
  4209. <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>
  4210. <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>
  4211. 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
  4212. <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
  4213. <code>head</code> element</a>, and let <var>element</var> be the newly created
  4214. 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>
  4215. 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
  4216. set to the new value being assigned.</ol>
  4217. <dt>Otherwise<dd>
  4218. <p>Do nothing.</p>
  4219. </dl>
  4220. <hr>
  4221. <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>
  4222. <p>Returns <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2>the body element</a>.</p>
  4223. <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>
  4224. <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
  4225. a <code id=dom-tree-accessors:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
  4226. </dl>
  4227. <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>
  4228. 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
  4229. there is no such element, it is null.</p>
  4230. <p>The <dfn id=dom-document-body><code>body</code></dfn> attribute, on getting, must return
  4231. <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
  4232. <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>
  4233. <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
  4234. <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
  4235. 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
  4236. new value in the DOM, as if the root element's <code>replaceChild()</code> method had
  4237. 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
  4238. 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
  4239. 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
  4240. the new value to the root element.</ol>
  4241. <hr>
  4242. <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-images><a href=#dom-document-images>images</a></code><dd>
  4243. <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>
  4244. <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>
  4245. <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>
  4246. <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-links><a href=#dom-document-links>links</a></code><dd>
  4247. <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
  4248. 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>
  4249. attributes.</p>
  4250. <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-forms><a href=#dom-document-forms>forms</a></code><dd>
  4251. <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>
  4252. <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-scripts><a href=#dom-document-scripts>scripts</a></code><dd>
  4253. <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>
  4254. </dl>
  4255. <p>The <dfn id=dom-document-images><code>images</code></dfn> attribute must return an
  4256. <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
  4257. <code id=dom-tree-accessors:the-img-element-2><a href=#the-img-element>img</a></code> elements.</p>
  4258. <p>The <dfn id=dom-document-embeds><code>embeds</code></dfn> attribute must return an
  4259. <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
  4260. <code id=dom-tree-accessors:the-embed-element-2><a href=#the-embed-element>embed</a></code> elements.</p>
  4261. <p>The <dfn id=dom-document-plugins><code>plugins</code></dfn> attribute must return the
  4262. same object as that returned by the <code id=dom-tree-accessors:dom-document-embeds-2><a href=#dom-document-embeds>embeds</a></code>
  4263. attribute.</p>
  4264. <p>The <dfn id=dom-document-links><code>links</code></dfn> attribute must return an
  4265. <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
  4266. <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
  4267. <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>
  4268. <p>The <dfn id=dom-document-forms><code>forms</code></dfn> attribute must return an
  4269. <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
  4270. <code id=dom-tree-accessors:the-form-element-2><a href=#the-form-element>form</a></code> elements.</p>
  4271. <p>The <dfn id=dom-document-scripts><code>scripts</code></dfn> attribute must return an
  4272. <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
  4273. <code id=dom-tree-accessors:the-script-element-2><a href=#the-script-element>script</a></code> elements.</p>
  4274. <hr>
  4275. <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>
  4276. <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>
  4277. </dl>
  4278. <p>The <dfn id=dom-document-getelementsbyname><code>getElementsByName(<var>name</var>)</code></dfn> method takes a string <var>name</var>, and must
  4279. 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
  4280. 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
  4281. 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
  4282. argument, the user agent may return the same as the object returned by the earlier call. In other
  4283. cases, a new <code id=dom-tree-accessors:nodelist-3><a href=#nodelist>NodeList</a></code> object must be returned.</p>
  4284. <hr>
  4285. <dl class=domintro><dt><var>element</var> . <code id=dom-tree-accessors:dom-document-csselementmap><a href=#dom-document-csselementmap>cssElementMap</a></code><dd>
  4286. <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
  4287. current <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier>CSS element reference
  4288. identifiers</a>.</p>
  4289. </dl>
  4290. <p>The <dfn id=dom-document-csselementmap><code>cssElementMap</code></dfn> IDL attribute
  4291. allows authors to define <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier-2>CSS element reference
  4292. 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>
  4293. <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
  4294. ID overrides list</dfn>, which consists of a list of mappings each of which consists of a string
  4295. name mapped to an <code id=dom-tree-accessors:element><a href=#element>Element</a></code> node.</p>
  4296. <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
  4297. <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>,
  4298. <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
  4299. 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>
  4300. <p>On getting, the <code id=dom-tree-accessors:dom-document-csselementmap-2><a href=#dom-document-csselementmap>cssElementMap</a></code> IDL attribute
  4301. 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
  4302. expose the current mappings:</p>
  4303. <dl><dt>The algorithm for getting the list of name-element mappings<dd>
  4304. <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
  4305. in which the entries were originally added to the list.</p>
  4306. <dt>The algorithm for mapping a name to a certain element<dd>
  4307. <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>
  4308. <p>If <var>element</var> is null, run the algorithm for deleting mappings by name,
  4309. passing it <var>name</var>.</p>
  4310. <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
  4311. list</a> whose name is <var>name</var>, replace its current value with <var>element</var>.</p>
  4312. <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>
  4313. whose name is <var>name</var> and whose element is <var>element</var>.</p>
  4314. <dt>The algorithm for deleting mappings by name<dd>
  4315. <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
  4316. 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
  4317. reference identifier</a> for that name. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  4318. </dl>
  4319. <p>The same object must be returned each time.</p>
  4320. <hr>
  4321. <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-currentscript><a href=#dom-document-currentscript>currentScript</a></code><dd>
  4322. <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
  4323. <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
  4324. those that have not yet finished executing.</p>
  4325. <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>
  4326. element (e.g. because the running script is an event handler, or a timeout).</p>
  4327. </dl>
  4328. <p>The <dfn id=dom-document-currentscript><code>currentScript</code></dfn> attribute, on
  4329. getting, must return the value to which it was most recently initialized. When the
  4330. <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>
  4331. <hr>
  4332. <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
  4333. any moment consist of the values of the <code>name</code> content attributes of
  4334. all the
  4335. <code id=dom-tree-accessors:the-applet-element><a href=#the-applet-element>applet</a></code>,
  4336. <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>,
  4337. <code id=dom-tree-accessors:the-form-element-3><a href=#the-form-element>form</a></code>,
  4338. <code id=dom-tree-accessors:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
  4339. <code id=dom-tree-accessors:the-img-element-4><a href=#the-img-element>img</a></code>, and
  4340. <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>
  4341. elements in the <code id=dom-tree-accessors:document-22><a href=#document>Document</a></code> that have non-empty <code>name</code> content
  4342. 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
  4343. <code id=dom-tree-accessors:the-applet-element-2><a href=#the-applet-element>applet</a></code> and
  4344. <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>
  4345. 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
  4346. 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
  4347. <code id=dom-tree-accessors:the-img-element-5><a href=#the-img-element>img</a></code>
  4348. 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
  4349. 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
  4350. 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
  4351. 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>
  4352. <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
  4353. retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>
  4354. <ol><li>
  4355. <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>.
  4356. <p class=note>There will be at least one such element, by definition.</p>
  4357. <li>
  4358. <p>If <var>elements</var> has only one element, and that element is an
  4359. <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
  4360. 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
  4361. steps.</p>
  4362. <li>
  4363. <p>Otherwise, if <var>elements</var> has only one element, return that element and
  4364. abort these steps.</p>
  4365. <li>
  4366. <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,
  4367. whose filter matches only <a href=#dom-document-nameditem-filter id=dom-tree-accessors:dom-document-nameditem-filter-2>named elements</a> with
  4368. the name <var>name</var>.</p>
  4369. </ol>
  4370. <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>
  4371. <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>,
  4372. <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
  4373. 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
  4374. whose value is <var>name</var>, and that have a non-empty <code>name</code>
  4375. content attribute present also.</ul>
  4376. <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
  4377. 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
  4378. 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
  4379. <code id=dom-tree-accessors:the-embed-element-6><a href=#the-embed-element>embed</a></code> descendants.</p>
  4380. <hr>
  4381. <p class=note>The <code id=dom-tree-accessors:dom-document-dir><a href=#dom-document-dir>dir</a></code> attribute on the
  4382. <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>
  4383. content attribute.</p>
  4384. <h4 id=loading-xml-documents>3.1.4 Loading XML documents</h4>
  4385. <pre class=idl>partial interface <a href=#xmldocument id=loading-xml-documents:xmldocument>XMLDocument</a> {
  4386. boolean <a href=#dom-xmldocument-load id=loading-xml-documents:dom-xmldocument-load>load</a>(DOMString url);
  4387. };</pre>
  4388. <p>The <dfn id=dom-xmldocument-load><code>load(<var>url</var>)</code></dfn> method
  4389. must run the following steps:</p>
  4390. <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
  4391. 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
  4392. <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
  4393. 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
  4394. <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
  4395. and abort these steps.<li><p>Remove all child nodes of <var>document</var>, without firing any mutation
  4396. 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
  4397. 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
  4398. <var>document</var>, using the <a href=#api-referrer-source id=loading-xml-documents:api-referrer-source>API referrer source</a> specified by the
  4399. <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>
  4400. <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
  4401. these substeps:</p>
  4402. <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>
  4403. 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
  4404. all child nodes from <var>result</var>. Otherwise let <var>success</var> be
  4405. true.</ol>
  4406. <li>
  4407. <p> <a href=#queue-a-task id=loading-xml-documents:queue-a-task>Queue a task</a> to run the following steps. </p>
  4408. <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
  4409. "<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
  4410. <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>
  4411. </ol>
  4412. <h3 id=elements>3.2 Elements</h3>
  4413. <h4 id=semantics-2>3.2.1 Semantics</h4>
  4414. <p>Elements, attributes, and attribute values in HTML are defined (by this specification) to have
  4415. 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,
  4416. and the <code id=semantics-2:attr-lang><a href=#attr-lang>lang</a></code> attribute represents the language of the content.</p>
  4417. <p>These definitions allow HTML processors, such as Web browsers or search engines, to present and
  4418. use documents and applications in a wide variety of contexts that the author might not have
  4419. considered.</p>
  4420. <div class=example>
  4421. <p>As a simple example, consider a Web page written by an author who only considered desktop
  4422. computer Web browsers:</p>
  4423. <pre>&lt;!DOCTYPE HTML>
  4424. &lt;html>
  4425. &lt;head>
  4426. &lt;title>My Page&lt;/title>
  4427. &lt;/head>
  4428. &lt;body>
  4429. &lt;h1>Welcome to my page&lt;/h1>
  4430. &lt;p>I like cars and lorries and have a big Jeep!&lt;/p>
  4431. &lt;h2>Where I live&lt;/h2>
  4432. &lt;p>I live in a small hut on a mountain!&lt;/p>
  4433. &lt;/body>
  4434. &lt;/html></pre>
  4435. <p>Because HTML conveys <em>meaning</em>, rather than presentation, the same
  4436. page can also be used by a small browser on a mobile phone, without any change to the page.
  4437. Instead of headings being in large letters as on the desktop, for example, the browser on the
  4438. mobile phone might use the same size text for the whole the page, but with the headings in
  4439. bold.</p>
  4440. <p>But it goes further than just differences in screen size: the same page could equally be used
  4441. by a blind user using a browser based around speech synthesis, which instead of displaying the
  4442. page on a screen, reads the page to the user, e.g. using headphones. Instead of large text for
  4443. the headings, the speech browser might use a different volume or a slower voice.</p>
  4444. <p>That's not all, either. Since the browsers know which parts of the page are the headings, they
  4445. can create a document outline that the user can use to quickly navigate around the document,
  4446. using keys for "jump to next heading" or "jump to previous heading". Such features are especially
  4447. common with speech browsers, where users would otherwise find quickly navigating a page quite
  4448. difficult.</p>
  4449. <p>Even beyond browsers, software can make use of this information. Search engines can use the
  4450. headings to more effectively index a page, or to provide quick links to subsections of the page
  4451. from their results. Tools can use the headings to create a table of contents (that is in fact how
  4452. this very specification's table of contents is generated).</p>
  4453. <p>This example has focused on headings, but the same principle applies to all of the semantics
  4454. in HTML.</p>
  4455. </div>
  4456. <p>Authors must not use elements, attributes, or attribute values for purposes other than their
  4457. appropriate intended semantic purpose, as doing so prevents software from correctly processing the
  4458. page.</p>
  4459. <div class=example>
  4460. <p>For example, the following snippet, intended to represent the heading of a
  4461. corporate site, is non-conforming because the second line is not intended to
  4462. be a heading of a subsection, but merely a subheading or subtitle (a
  4463. subordinate heading for the same section).</p>
  4464. <pre class=bad>&lt;body>
  4465. &lt;h1>ACME Corporation&lt;/h1>
  4466. &lt;h2>The leaders in arbitrary fast delivery since 1920&lt;/h2>
  4467. ...</pre>
  4468. <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>
  4469. <pre>&lt;body>
  4470. &lt;hgroup>
  4471. &lt;h1>ACME Corporation&lt;/h1>
  4472. &lt;h2>The leaders in arbitrary fast delivery since 1920&lt;/h2>
  4473. &lt;/hgroup>
  4474. ...</pre>
  4475. </div>
  4476. <div class=example>
  4477. <p>The document in this next example is similarly non-conforming, despite
  4478. being syntactically correct, because the data placed in the cells is clearly
  4479. not tabular data, and the <code id=semantics-2:the-cite-element><a href=#the-cite-element>cite</a></code> element mis-used:</p>
  4480. <pre class=bad>&lt;!DOCTYPE HTML>
  4481. &lt;html lang="en-GB">
  4482. &lt;head> &lt;title> Demonstration &lt;/title> &lt;/head>
  4483. &lt;body>
  4484. &lt;table>
  4485. &lt;tr> &lt;td> My favourite animal is the cat. &lt;/td> &lt;/tr>
  4486. &lt;tr>
  4487. &lt;td>
  4488. —&lt;a href="http://example.org/~ernest/">&lt;cite>Ernest&lt;/cite>&lt;/a>,
  4489. in an essay from 1992
  4490. &lt;/td>
  4491. &lt;/tr>
  4492. &lt;/table>
  4493. &lt;/body>
  4494. &lt;/html></pre>
  4495. <p>This would make software that relies on these semantics fail: for example,
  4496. a speech browser that allowed a blind user to navigate tables in the document
  4497. would report the quote above as a table, confusing the user; similarly, a
  4498. tool that extracted titles of works from pages would extract "Ernest" as the
  4499. title of a work, even though it's actually a person's name, not a title.</p>
  4500. <p>A corrected version of this document might be:</p>
  4501. <pre>&lt;!DOCTYPE HTML>
  4502. &lt;html lang="en-GB">
  4503. &lt;head> &lt;title> Demonstration &lt;/title> &lt;/head>
  4504. &lt;body>
  4505. &lt;blockquote>
  4506. &lt;p> My favourite animal is the cat. &lt;/p>
  4507. &lt;/blockquote>
  4508. &lt;p>
  4509. —&lt;a href="http://example.org/~ernest/">Ernest&lt;/a>,
  4510. in an essay from 1992
  4511. &lt;/p>
  4512. &lt;/body>
  4513. &lt;/html></pre>
  4514. </div>
  4515. <p>Authors must not use elements, attributes, or attribute values that are not permitted by this
  4516. specification or <a href=#other-applicable-specifications id=semantics-2:other-applicable-specifications>other applicable specifications</a>, as doing so makes it significantly
  4517. harder for the language to be extended in the future.</p>
  4518. <div class=example>
  4519. <p>In the next example, there is a non-conforming attribute value ("carpet") and a non-conforming
  4520. attribute ("texture"), which is not permitted by this specification:</p>
  4521. <pre class=bad>&lt;label>Carpet: &lt;input type="carpet" name="c" texture="deep pile">&lt;/label></pre>
  4522. <p>Here would be an alternative and correct way to mark this up:</p>
  4523. <pre>&lt;label>Carpet: &lt;input type="text" class="carpet" name="c" data-texture="deep pile">&lt;/label></pre>
  4524. </div>
  4525. <p>Through scripting and using other mechanisms, the values of attributes, text, and indeed the
  4526. entire structure of the document may change dynamically while a user agent is processing it. The
  4527. semantics of a document at an instant in time are those represented by the state of the document
  4528. at that instant in time, and the semantics of a document can therefore change over time. User
  4529. agents must update their presentation of the document as this
  4530. occurs.</p>
  4531. <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
  4532. "value" attribute is dynamically updated by a script, the UA would update the rendering to show
  4533. the progress changing.</p>
  4534. <h4 id=elements-in-the-dom>3.2.2 Elements in the DOM</h4>
  4535. <p>The nodes representing <a href=#html-elements id=elements-in-the-dom:html-elements>HTML elements</a> in the DOM must
  4536. implement, and expose to scripts, the interfaces listed for them in the relevant sections of this
  4537. 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
  4538. those documents are in another context (e.g. inside an XSLT transform).</p>
  4539. <p>Elements in the DOM <dfn id=represents>represent</dfn> things; that is, they have
  4540. intrinsic <em>meaning</em>, also known as semantics.</p>
  4541. <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>
  4542. <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
  4543. the <code id=elements-in-the-dom:htmlelement><a href=#htmlelement>HTMLElement</a></code> interface.</p>
  4544. <pre class=idl>interface <dfn id=htmlelement>HTMLElement</dfn> : <a href=#element id=elements-in-the-dom:element>Element</a> {
  4545. // metadata attributes
  4546. attribute DOMString <a href=#dom-title id=elements-in-the-dom:dom-title>title</a>;
  4547. attribute DOMString <a href=#dom-lang id=elements-in-the-dom:dom-lang>lang</a>;
  4548. attribute boolean <a href=#dom-translate id=elements-in-the-dom:dom-translate>translate</a>;
  4549. attribute DOMString <a href=#dom-dir id=elements-in-the-dom:dom-dir>dir</a>;
  4550. 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>;
  4551. // <a href=#microdata id=elements-in-the-dom:microdata>microdata</a>
  4552. attribute boolean <a href=#dom-itemscope id=elements-in-the-dom:dom-itemscope>itemScope</a>;
  4553. [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>;
  4554. attribute DOMString <a href=#dom-itemid id=elements-in-the-dom:dom-itemid>itemId</a>;
  4555. [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>;
  4556. [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>;
  4557. 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>;
  4558. attribute any <a href=#dom-itemvalue id=elements-in-the-dom:dom-itemvalue>itemValue</a>; // acts as DOMString on setting
  4559. // <a href=#editing id=elements-in-the-dom:editing>user interaction</a>
  4560. attribute boolean <a href=#dom-hidden id=elements-in-the-dom:dom-hidden>hidden</a>;
  4561. void <a href=#dom-click id=elements-in-the-dom:dom-click>click</a>();
  4562. attribute long <a href=#dom-tabindex id=elements-in-the-dom:dom-tabindex>tabIndex</a>;
  4563. void <a href=#dom-focus id=elements-in-the-dom:dom-focus>focus</a>();
  4564. void <a href=#dom-blur id=elements-in-the-dom:dom-blur>blur</a>();
  4565. attribute DOMString <a href=#dom-accesskey id=elements-in-the-dom:dom-accesskey>accessKey</a>;
  4566. readonly attribute DOMString <a href=#dom-accesskeylabel id=elements-in-the-dom:dom-accesskeylabel>accessKeyLabel</a>;
  4567. attribute boolean <a href=#dom-draggable id=elements-in-the-dom:dom-draggable>draggable</a>;
  4568. [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>;
  4569. attribute DOMString <a href=#dom-contenteditable id=elements-in-the-dom:dom-contenteditable>contentEditable</a>;
  4570. readonly attribute boolean <a href=#dom-iscontenteditable id=elements-in-the-dom:dom-iscontenteditable>isContentEditable</a>;
  4571. 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>;
  4572. attribute boolean <a href=#dom-spellcheck id=elements-in-the-dom:dom-spellcheck>spellcheck</a>;
  4573. void <a href=#dom-forcespellcheck id=elements-in-the-dom:dom-forcespellcheck>forceSpellCheck</a>();
  4574. // <a href=#command-api id=elements-in-the-dom:command-api>command API</a>
  4575. readonly attribute DOMString? <a href=#dom-command-ro-commandtype id=elements-in-the-dom:dom-command-ro-commandtype>commandType</a>;
  4576. readonly attribute DOMString? <a href=#dom-command-ro-commandlabel id=elements-in-the-dom:dom-command-ro-commandlabel>commandLabel</a>;
  4577. readonly attribute DOMString? <a href=#dom-command-ro-commandicon id=elements-in-the-dom:dom-command-ro-commandicon>commandIcon</a>;
  4578. readonly attribute boolean? <a href=#dom-command-ro-commandhidden id=elements-in-the-dom:dom-command-ro-commandhidden>commandHidden</a>;
  4579. readonly attribute boolean? <a href=#dom-command-ro-commanddisabled id=elements-in-the-dom:dom-command-ro-commanddisabled>commandDisabled</a>;
  4580. readonly attribute boolean? <a href=#dom-command-ro-commandchecked id=elements-in-the-dom:dom-command-ro-commandchecked>commandChecked</a>;
  4581. };
  4582. <a href=#htmlelement id=elements-in-the-dom:htmlelement-2>HTMLElement</a> implements <a href=#globaleventhandlers id=elements-in-the-dom:globaleventhandlers>GlobalEventHandlers</a>;
  4583. interface <dfn id=htmlunknownelement>HTMLUnknownElement</dfn> : <a href=#htmlelement id=elements-in-the-dom:htmlelement-3>HTMLElement</a> { };</pre>
  4584. <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
  4585. disparate features, and the members of this interface are therefore described in various different
  4586. sections of this specification.</p>
  4587. <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
  4588. 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>
  4589. <h4 id=element-definitions>3.2.3 Element definitions</h4>
  4590. <p>Each element in this specification has a definition that includes the following
  4591. information:</p>
  4592. <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.
  4593. 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>
  4594. <p>A <em>non-normative</em> description of where the element can be used. This information is
  4595. redundant with the content models of elements that allow this one as a child, and is provided
  4596. only as a convenience.</p>
  4597. <p class=note>For simplicity, only the most specific expectations are listed. For example, an
  4598. 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
  4599. 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
  4600. 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
  4601. 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
  4602. <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2-5>phrasing content</a> is expected" will be listed.</p>
  4603. <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
  4604. 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
  4605. <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
  4606. 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
  4607. 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
  4608. otherwise disallowed), along with non-normative descriptions of those attributes. (The content to
  4609. 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>
  4610. <p>This is then followed by a description of what the element <a href=#represents id=element-definitions:represents>represents</a>, along with
  4611. any additional normative conformance criteria that may apply to authors and implementations. Examples are sometimes also included.</p>
  4612. <h5 id=attributes>3.2.3.1 Attributes</h5>
  4613. <p id=attribute-text>Except where otherwise specified, attributes on <a href=#html-elements id=attributes:html-elements>HTML elements</a>
  4614. may have any string value, including the empty string. Except where explicitly stated, there is no
  4615. restriction on what text can be specified in such attributes.</p>
  4616. <h4 id=content-models>3.2.4 <dfn>Content models</dfn></h4>
  4617. <p>Each element defined in this specification has a content model: a description of the element's
  4618. 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
  4619. element</a> must have contents that match the requirements described in the element's content
  4620. model. The <dfn id=concept-html-contents>contents</dfn> of an element are its children in the
  4621. 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
  4622. contents</a> (a separate <code id=content-models:documentfragment><a href=#documentfragment>DocumentFragment</a></code> assigned to the element when the element
  4623. is created).</p>
  4624. <p>The <a href=#space-character id=content-models:space-character>space characters</a> are always allowed between elements.
  4625. User agents represent these characters between elements in the source markup as <code id=content-models:text><a href=#text>Text</a></code>
  4626. nodes in the DOM. Empty
  4627. <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
  4628. characters are considered <dfn id=inter-element-whitespace>inter-element whitespace</dfn>.</p>
  4629. <p><a href=#inter-element-whitespace id=content-models:inter-element-whitespace>Inter-element whitespace</a>, comment nodes, and processing instruction nodes must be
  4630. ignored when establishing whether an element's contents match the element's content model or not,
  4631. and must be ignored when following algorithms that define document and element semantics.</p>
  4632. <p class=note>Thus, an element <var>A</var> is said to be <i>preceded or followed</i>
  4633. by a second element <var>B</var> if <var>A</var> and <var>B</var> have
  4634. 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
  4635. <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
  4636. 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
  4637. whitespace</a>, comment nodes, and processing instruction nodes.</p>
  4638. <p>Authors must not use <a href=#html-elements id=content-models:html-elements-2>HTML elements</a> anywhere except where they are explicitly
  4639. allowed, as defined for each element, or as explicitly required by other specifications. For XML
  4640. compound documents, these contexts could be inside elements from other namespaces, if those
  4641. elements are defined as providing the relevant contexts.</p>
  4642. <div class=example>
  4643. <p>For example, the Atom specification defines a <code>content</code> element. When its
  4644. <code>type</code> attribute has the value <code>xhtml</code>, the Atom
  4645. 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
  4646. <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
  4647. normatively stated by this specification. <a href=#refsATOM>[ATOM]</a></p>
  4648. </div>
  4649. <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>
  4650. <div class=example>
  4651. <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
  4652. 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
  4653. inside <code id=content-models:the-tr-element><a href=#the-tr-element>tr</a></code> elements.</p>
  4654. <pre>var data = {
  4655. name: "Banana",
  4656. cell: document.createElement('td'),
  4657. };</pre>
  4658. </div>
  4659. <h5 id=the-nothing-content-model>3.2.4.1 The "nothing" content model</h5>
  4660. <p>When an element's content model is <dfn id=concept-content-nothing>nothing</dfn>, the
  4661. 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>)
  4662. and no element nodes.</p>
  4663. <p class=note>Most HTML elements whose content model is "nothing" are also, for convenience,
  4664. <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
  4665. the <a href=#syntax>HTML syntax</a>). However, these are entirely separate concepts.</p>
  4666. <h5 id=kinds-of-content>3.2.4.2 Kinds of content</h5>
  4667. <p>Each element in HTML falls into zero or more <dfn id=content-categories>categories</dfn>
  4668. that group elements with similar characteristics together. The following broad categories are used
  4669. in this specification:</p>
  4670. <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>
  4671. <p class=note>Some elements also fall into other categories, which are defined in other parts of
  4672. this specification.</p>
  4673. <p>These categories are related as follows:</p>
  4674. <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>
  4675. <p>Sectioning content, heading content, phrasing content, embedded content, and interactive
  4676. content are all types of flow content. Metadata is sometimes flow content. Metadata and
  4677. interactive content are sometimes phrasing content. Embedded content is also a type of phrasing
  4678. content, and sometimes is interactive content.</p>
  4679. <p>Other categories are also used for specific purposes, e.g. form controls are specified using a
  4680. number of categories to define common requirements. Some elements have unique requirements and do
  4681. not fit into any particular category.</p>
  4682. <h6 id=metadata-content>3.2.4.2.1 Metadata content</h6>
  4683. <p><dfn id=metadata-content-2>Metadata content</dfn> is content that sets up the presentation or behavior of the rest of
  4684. the content, or that sets up the relationship of the document with other documents, or that
  4685. conveys other "out of band" information.</p>
  4686. <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>
  4687. <p>Elements from other namespaces whose semantics are primarily metadata-related (e.g. RDF) are
  4688. also <a href=#metadata-content-2 id=metadata-content:metadata-content-2>metadata content</a>.</p>
  4689. <div class=example>
  4690. <p>Thus, in the XML serialisation, one can use RDF, like this:</p>
  4691. <pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"
  4692. xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  4693. &lt;head>
  4694. &lt;title>Hedral's Home Page&lt;/title>
  4695. &lt;r:RDF>
  4696. &lt;Person xmlns="http://www.w3.org/2000/10/swap/pim/contact#"
  4697. r:about="http://hedral.example.com/#">
  4698. &lt;fullName>Cat Hedral&lt;/fullName>
  4699. &lt;mailbox r:resource="mailto:hedral@damowmow.com"/>
  4700. &lt;personalTitle>Sir&lt;/personalTitle>
  4701. &lt;/Person>
  4702. &lt;/r:RDF>
  4703. &lt;/head>
  4704. &lt;body>
  4705. &lt;h1>My home page&lt;/h1>
  4706. &lt;p>I like playing with string, I guess. Sister says squirrels are fun
  4707. too so sometimes I follow her to play with them.&lt;/p>
  4708. &lt;/body>
  4709. &lt;/html></pre>
  4710. <p>This isn't possible in the HTML serialisation, however.</p>
  4711. </div>
  4712. <h6 id=flow-content>3.2.4.2.2 Flow content</h6>
  4713. <p>Most elements that are used in the body of documents and applications are categorised as
  4714. <dfn id=flow-content-2>flow content</dfn>.</p>
  4715. <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>
  4716. <h6 id=sectioning-content>3.2.4.2.3 Sectioning content</h6>
  4717. <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>
  4718. <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>
  4719. <p>Each <a href=#sectioning-content-2 id=sectioning-content:sectioning-content-2>sectioning content</a> element potentially has a heading and an
  4720. <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
  4721. details.</p>
  4722. <p class=note>There are also certain elements that are <a href=#sectioning-root id=sectioning-content:sectioning-root>sectioning
  4723. 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
  4724. <a href=#outline id=sectioning-content:outline-2>outline</a>.</p>
  4725. <h6 id=heading-content>3.2.4.2.4 Heading content</h6>
  4726. <p><dfn id=heading-content-2>Heading content</dfn> defines the header of a section (whether explicitly marked up using
  4727. <a href=#sectioning-content-2 id=heading-content:sectioning-content-2>sectioning content</a> elements, or implied by the heading content itself).</p>
  4728. <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>
  4729. <h6 id=phrasing-content>3.2.4.2.5 Phrasing content</h6>
  4730. <p><dfn id=phrasing-content-2>Phrasing content</dfn> is the text of the document, as well as elements that mark up that
  4731. 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>
  4732. <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>
  4733. <p class=note>Most elements that are categorised as phrasing content can only contain elements
  4734. that are themselves categorised as phrasing content, not any flow content.</p>
  4735. <p><dfn id=text-content>Text</dfn>, in the context of content models, means either nothing,
  4736. 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
  4737. 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
  4738. 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>
  4739. <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
  4740. permanently undefined Unicode characters (noncharacters), and must not contain <a href=#control-characters id=phrasing-content:control-characters>control characters</a>
  4741. other than <a href=#space-character id=phrasing-content:space-character-2>space characters</a>.
  4742. This specification includes extra constraints on the exact value of <code id=phrasing-content:text-4><a href=#text>Text</a></code> nodes and
  4743. attribute values depending on their precise context.
  4744. </p>
  4745. <h6 id=embedded-content-2>3.2.4.2.6 Embedded content</h6>
  4746. <p><dfn id=embedded-content-category>Embedded content</dfn> is content that imports another
  4747. resource into the document, or content from another vocabulary that
  4748. is inserted into the document.</p>
  4749. <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>
  4750. <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
  4751. 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
  4752. defined in this specification. (For example, MathML, or SVG.)</p>
  4753. <p>Some embedded content elements can have <dfn id=fallback-content>fallback content</dfn>: content that is to be used
  4754. when the external resource cannot be used (e.g. because it is of an unsupported format). The
  4755. element definitions state what the fallback is, if any.</p>
  4756. <h6 id=interactive-content>3.2.4.2.7 Interactive content</h6>
  4757. <p><dfn id=interactive-content-2>Interactive content</dfn> is content that is specifically intended for user
  4758. interaction.</p>
  4759. <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>
  4760. <p>The <code id=interactive-content:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute can also make any element into
  4761. <a href=#interactive-content-2 id=interactive-content:interactive-content-2>interactive content</a>.</p>
  4762. <h6 id=palpable-content>3.2.4.2.8 Palpable content</h6>
  4763. <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
  4764. <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
  4765. not have the <code id=palpable-content:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute specified.</p>
  4766. <p>This requirement is not a hard requirement, however, as there are many cases where an element
  4767. can be empty legitimately, for example when it is used as a placeholder which will later be filled
  4768. in by a script, or when the element is part of a template and would on most pages be filled in but
  4769. on some pages is not relevant.</p>
  4770. <p>Conformance checkers are encouraged to provide a mechanism for authors to find elements that
  4771. fail to fulfill this requirement, as an authoring aid.</p>
  4772. <p>The following elements are palpable content:</p>
  4773. <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>
  4774. <h6 id=script-supporting-elements>3.2.4.2.9 Script-supporting elements</h6>
  4775. <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
  4776. used to support scripts, e.g. to provide functionality for the user.</p>
  4777. <p>The following elements are script-supporting elements:</p>
  4778. <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>
  4779. <h5 id=transparent-content-models>3.2.4.3 Transparent content models</h5>
  4780. <p>Some elements are described as <dfn id=transparent>transparent</dfn>; they have "transparent" in the
  4781. description of their content model. The content model of a <a href=#transparent id=transparent-content-models:transparent>transparent</a> element is
  4782. derived from the content model of its parent element: the elements required in the part of the
  4783. content model that is "transparent" are the same elements as required in the part of the content
  4784. model of the parent of the transparent element in which the transparent element finds itself.</p>
  4785. <div class=example>
  4786. <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
  4787. <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
  4788. 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
  4789. <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>
  4790. </div>
  4791. <p class=note>In some cases, where transparent elements are nested in each other, the process
  4792. has to be applied iteratively.</p>
  4793. <div class=example>
  4794. <p>Consider the following markup fragment:</p>
  4795. <pre>&lt;p>&lt;object>&lt;param>&lt;ins>&lt;map>&lt;a href="/">Apples&lt;/a>&lt;/map>&lt;/ins>&lt;/object>&lt;/p></pre>
  4796. <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
  4797. 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>
  4798. 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>
  4799. 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
  4800. 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,
  4801. "Apples" is allowed, as text is phrasing content.</p>
  4802. </div>
  4803. <p>When a transparent element has no parent, then the part of its content model that is
  4804. "transparent" must instead be treated as accepting any <a href=#flow-content-2 id=transparent-content-models:flow-content-2>flow content</a>.</p>
  4805. <h5 id=paragraphs>3.2.4.4 Paragraphs</h5>
  4806. <p class=note>The term <a href=#paragraph id=paragraphs:paragraph>paragraph</a> as defined in this section is used for more than
  4807. 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
  4808. 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
  4809. several ways of marking up a <a href=#paragraph id=paragraphs:paragraph-3>paragraph</a>.</p>
  4810. <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
  4811. of text with one or more sentences that discuss a particular topic, as in typography, but can also
  4812. be used for more general thematic grouping. For instance, an address is also a paragraph, as is a
  4813. part of a form, a byline, or a stanza in a poem.</p>
  4814. <div class=example>
  4815. <p>In the following example, there are two paragraphs in a section. There is also a heading,
  4816. which contains phrasing content that is not a paragraph. Note how the comments and
  4817. <a href=#inter-element-whitespace id=paragraphs:inter-element-whitespace>inter-element whitespace</a> do not form paragraphs.</p>
  4818. <pre>&lt;section>
  4819. &lt;h1>Example of paragraphs&lt;/h1>
  4820. This is the &lt;em>first&lt;/em> paragraph in this example.
  4821. &lt;p>This is the second.&lt;/p>
  4822. &lt;!-- This is not a paragraph. -->
  4823. &lt;/section></pre>
  4824. </div>
  4825. <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
  4826. 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
  4827. complicating matters, since those elements, with their hybrid content models, can straddle
  4828. paragraph boundaries, as shown in the first two examples below.</p>
  4829. <p class=note>Generally, having elements straddle paragraph boundaries is best avoided.
  4830. Maintaining such markup can be difficult.</p>
  4831. <div class=example>
  4832. <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
  4833. <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
  4834. this case, the changes admittedly don't make much sense). Notice how this example has exactly the
  4835. 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
  4836. — 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
  4837. <code id=paragraphs:the-del-element-4><a href=#the-del-element>del</a></code> element straddles the boundary between the two paragraphs.</p>
  4838. <pre>&lt;section>
  4839. &lt;ins>&lt;h1>Example of paragraphs&lt;/h1>
  4840. This is the &lt;em>first&lt;/em> paragraph in&lt;/ins> this example&lt;del>.
  4841. &lt;p>This is the second.&lt;/p>&lt;/del>
  4842. &lt;!-- This is not a paragraph. -->
  4843. &lt;/section></pre>
  4844. </div>
  4845. <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>,
  4846. <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
  4847. 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
  4848. 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
  4849. 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
  4850. 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
  4851. paragraph exists in the original DOM from immediately before <var>first</var> to
  4852. 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>,
  4853. <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>
  4854. <p>Conformance checkers may warn authors of cases where they have paragraphs that overlap each
  4855. 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
  4856. <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
  4857. 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>
  4858. <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>
  4859. <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
  4860. would otherwise not be any content other than phrasing content to separate the paragraphs from
  4861. each other.</p>
  4862. <div class=example>
  4863. <p>In the following example, the link spans half of the first paragraph, all of the heading
  4864. separating the two paragraphs, and half of the second paragraph. It straddles the paragraphs and
  4865. the heading.</p>
  4866. <pre>&lt;header>
  4867. Welcome!
  4868. &lt;a href="about.html">
  4869. This is home of...
  4870. &lt;h1>The Falcons!&lt;/h1>
  4871. The Lockheed Martin multirole jet fighter aircraft!
  4872. &lt;/a>
  4873. This page discusses the F-16 Fighting Falcon's innermost secrets.
  4874. &lt;/header></pre>
  4875. <p>Here is another way of marking this up, this time showing the paragraphs explicitly, and
  4876. splitting the one link element into three:</p>
  4877. <pre>&lt;header>
  4878. &lt;p>Welcome! &lt;a href="about.html">This is home of...&lt;/a>&lt;/p>
  4879. &lt;h1>&lt;a href="about.html">The Falcons!&lt;/a>&lt;/h1>
  4880. &lt;p>&lt;a href="about.html">The Lockheed Martin multirole jet
  4881. fighter aircraft!&lt;/a> This page discusses the F-16 Fighting
  4882. Falcon's innermost secrets.&lt;/p>
  4883. &lt;/header></pre>
  4884. </div>
  4885. <div class=example>
  4886. <p>It is possible for paragraphs to overlap when using certain elements that define fallback
  4887. content. For example, in the following section:</p>
  4888. <pre>&lt;section>
  4889. &lt;h1>My Cats&lt;/h1>
  4890. You can play with my cat simulator.
  4891. &lt;object data="cats.sim">
  4892. To see the cat simulator, use one of the following links:
  4893. &lt;ul>
  4894. &lt;li>&lt;a href="cats.sim">Download simulator file&lt;/a>
  4895. &lt;li>&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator&lt;/a>
  4896. &lt;/ul>
  4897. Alternatively, upgrade to the Mellblom Browser.
  4898. &lt;/object>
  4899. I'm quite proud of it.
  4900. &lt;/section></pre>
  4901. <p>There are five paragraphs:</p>
  4902. <ol class=brief><li>The paragraph that says "You can play with my cat simulator. <i>object</i> I'm
  4903. 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>
  4904. <p>The first paragraph is overlapped by the other four. A user agent that supports the "cats.sim"
  4905. resource will only show the first one, but a user agent that shows the fallback will confusingly
  4906. show the first sentence of the first paragraph as if it was in the same paragraph as the second
  4907. one, and will show the last paragraph as if it was at the start of the second sentence of the
  4908. first paragraph.</p>
  4909. <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>
  4910. <pre>&lt;section>
  4911. &lt;h1>My Cats&lt;/h1>
  4912. &lt;p>You can play with my cat simulator.&lt;/p>
  4913. &lt;object data="cats.sim">
  4914. &lt;p>To see the cat simulator, use one of the following links:&lt;/p>
  4915. &lt;ul>
  4916. &lt;li>&lt;a href="cats.sim">Download simulator file&lt;/a>
  4917. &lt;li>&lt;a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator&lt;/a>
  4918. &lt;/ul>
  4919. &lt;p>Alternatively, upgrade to the Mellblom Browser.&lt;/p>
  4920. &lt;/object>
  4921. &lt;p>I'm quite proud of it.&lt;/p>
  4922. &lt;/section></pre>
  4923. </div>
  4924. <h4 id=global-attributes>3.2.5 <dfn>Global attributes</dfn></h4>
  4925. <p>The following attributes are common to and may be specified on all <a href=#html-elements id=global-attributes:html-elements>HTML
  4926. elements</a> (even those not defined in this specification):</p>
  4927. <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>
  4928. <p>These attributes are only defined by this specification as attributes for <a href=#html-elements id=global-attributes:html-elements-2>HTML
  4929. elements</a>. When this specification refers to elements having these attributes, elements from
  4930. namespaces that are not defined as having these attributes must not be considered as being
  4931. elements with these attributes.</p>
  4932. <div class=example>
  4933. <p>For example, in the following XML fragment, the "<code>bogus</code>" element does not
  4934. 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
  4935. having an attribute with the literal name "<code>dir</code>". Thus, <a href=#the-directionality id=global-attributes:the-directionality>the
  4936. 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
  4937. the "<code>bogus</code>" element.</p>
  4938. <pre class=bad>&lt;div xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
  4939. &lt;bogus xmlns="http://example.net/ns" dir="ltr">
  4940. &lt;span xmlns="http://www.w3.org/1999/xhtml">
  4941. &lt;/span>
  4942. &lt;/bogus>
  4943. &lt;/div></pre>
  4944. </div>
  4945. <hr>
  4946. <p>To enable assistive technology products to expose a more fine-grained interface than is
  4947. otherwise possible with HTML elements and attributes, a set of <a href=#wai-aria id=global-attributes:wai-aria>annotations
  4948. 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>
  4949. <hr>
  4950. <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>
  4951. <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>
  4952. <p class=note>The attributes marked with an asterisk have a different meaning when specified on
  4953. <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
  4954. <code id=global-attributes:window><a href=#window>Window</a></code> object with the same names.</p>
  4955. <p class=note>While these attributes apply to all elements, they are not useful on all elements.
  4956. 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>
  4957. <hr>
  4958. <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>
  4959. <hr>
  4960. <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
  4961. documents</a>.</p>
  4962. <p class=note>In HTML, the <code>xmlns</code> attribute has absolutely no effect. It
  4963. is basically a talisman. It is allowed merely to make migration to and from XHTML mildly easier.
  4964. 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
  4965. XML do.</p>
  4966. <p class=note>In XML, an <code>xmlns</code> attribute is part of the namespace
  4967. declaration mechanism, and an element cannot actually have an <code>xmlns</code>
  4968. attribute in no namespace specified.</p>
  4969. <hr>
  4970. <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>
  4971. 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
  4972. document</a>. This attribute has no effect on <a href=#html-elements id=global-attributes:html-elements-5>HTML elements</a>, as the default
  4973. behavior in HTML is to preserve whitespace. <a href=#refsXML>[XML]</a></p>
  4974. <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>
  4975. 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>
  4976. <h5 id=the-id-attribute>3.2.5.1 The <dfn><code>id</code></dfn> attribute</h5>
  4977. <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>
  4978. <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
  4979. <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
  4980. <a href=#space-character id=the-id-attribute:space-character>space characters</a>.</p>
  4981. <p class=note>There are no other restrictions on what form an ID can take; in particular, IDs
  4982. can consist of just digits, start with a digit, start with an underscore, consist of just
  4983. punctuation, etc.</p>
  4984. <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
  4985. variety of purposes, most notably as a way to link to specific parts of a document using fragment
  4986. identifiers, as a way to target an element when scripting, and as a way to style a specific
  4987. element from CSS.</p>
  4988. <p>Identifiers are opaque strings. Particular meanings should not be derived from the value of the
  4989. <code id=the-id-attribute:the-id-attribute-2><a href=#the-id-attribute>id</a></code> attribute.</p>
  4990. <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>
  4991. <p>The <dfn id=attr-title><code>title</code></dfn> attribute <a href=#represents id=the-title-attribute:represents>represents</a> advisory
  4992. information for the element, such as would be appropriate for a tooltip. On a link, this could be
  4993. the title or a description of the target resource; on an image, it could be the image credit or a
  4994. description of the image; on a paragraph, it could be a footnote or commentary on the text; on a
  4995. 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>,
  4996. it could be a label for, or instructions for, use of the element; and so forth. The value is
  4997. text.</p>
  4998. <p class=note>Relying on the <code id=the-title-attribute:attr-title-2><a href=#attr-title>title</a></code> attribute is currently
  4999. discouraged as many user agents do not expose the attribute in an accessible manner as required by
  5000. this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear,
  5001. which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or
  5002. tablet).</p>
  5003. <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
  5004. 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
  5005. element. Setting the attribute overrides this, explicitly stating that the advisory information of
  5006. any ancestors is not relevant to this element. Setting the attribute to the empty string indicates
  5007. that the element has no advisory information.</p>
  5008. <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)
  5009. characters, the content is split into multiple lines. Each U+000A LINE FEED (LF) character
  5010. represents a line break.</p>
  5011. <div class=example>
  5012. <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>
  5013. <p>For instance, the following snippet actually defines an abbreviation's expansion <em>with a
  5014. line break in it</em>:</p>
  5015. <pre class=bad>&lt;p>My logs show that there was some interest in &lt;abbr title="Hypertext
  5016. Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></pre>
  5017. </div>
  5018. <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
  5019. additional semantics for the <code id=the-title-attribute:attr-title-7><a href=#attr-title>title</a></code> attribute beyond the semantics
  5020. described above.</p>
  5021. <p>The <dfn id=advisory-information>advisory information</dfn> of an element is the value that the following algorithm
  5022. returns, with the algorithm being aborted once a value is returned. When the algorithm returns the
  5023. empty string, then there is no advisory information.</p>
  5024. <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>,
  5025. <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,
  5026. 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
  5027. return its value.<li><p>Otherwise, if the element has a parent element, then return the parent element's
  5028. <a href=#advisory-information id=the-title-attribute:advisory-information>advisory information</a>.<li><p>Otherwise, return the empty string.</ol>
  5029. <p>User agents should inform the user when elements have <a href=#advisory-information id=the-title-attribute:advisory-information-2>advisory information</a>,
  5030. otherwise the information would not be discoverable.</p>
  5031. <hr>
  5032. <p>The <dfn id=dom-title><code>title</code></dfn> IDL attribute must <a href=#reflect id=the-title-attribute:reflect>reflect</a> the
  5033. <code id=the-title-attribute:attr-title-9><a href=#attr-title>title</a></code> content attribute.</p>
  5034. <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>
  5035. <p>The <dfn id=attr-lang><code>lang</code></dfn> attribute (in no namespace) specifies the
  5036. primary language for the element's contents and for any of the element's attributes that contain
  5037. text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to
  5038. the empty string indicates that the primary language is unknown. <a href=#refsBCP47>[BCP47]</a></p>
  5039. <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
  5040. namespace</a> is defined in XML. <a href=#refsXML>[XML]</a></p>
  5041. <p>If these attributes are omitted from an element, then the language of this element is the same
  5042. as the language of its parent element, if any.</p>
  5043. <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>
  5044. <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
  5045. 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>,
  5046. as well as elements in other namespaces if the relevant specifications allow it (in particular,
  5047. 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
  5048. <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
  5049. 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
  5050. case-insensitive</a> manner.</p>
  5051. <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
  5052. 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
  5053. documents</a>. To ease migration to and from XHTML, authors may specify an attribute in no
  5054. namespace with no prefix and with the literal localname "<code>xml:lang</code>" on
  5055. <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
  5056. 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,
  5057. 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
  5058. case-insensitive</a> manner.</p>
  5059. <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>
  5060. <hr>
  5061. <p>To determine the <dfn id=language>language</dfn> of a node, user agents must look at the nearest ancestor
  5062. 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
  5063. 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
  5064. <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
  5065. language of the node (regardless of its value).</p>
  5066. <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
  5067. 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
  5068. 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
  5069. must be <a href=#ignore id=the-lang-and-xml:lang-attributes:ignore>ignored</a> for the purposes of determining the element's
  5070. language.</p>
  5071. <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>,
  5072. 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
  5073. 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
  5074. language information from a higher-level protocol (such as HTTP), if any, must be used as the
  5075. final fallback language instead. In the absence of any such language information, and in cases
  5076. where the higher-level protocol reports multiple languages, the language of the node is unknown,
  5077. and the corresponding language tag is the empty string.</p>
  5078. <p>If the resulting value is not a recognised language tag, then it must be treated as an unknown
  5079. language having the given language tag, distinct from all other languages. For the purposes of
  5080. round-tripping or communicating with other services that expect language tags, user agents should
  5081. pass unknown language tags through unmodified, and tagged as being BCP 47 language tags, so that
  5082. subsequent services do not interpret the data as another type of language description. <a href=#refsBCP47>[BCP47]</a></p>
  5083. <p class=example>Thus, for instance, an element with <code>lang="xyzzy"</code> would be
  5084. matched by the selector <code>:lang(xyzzy)</code> (e.g. in CSS), but it would not be
  5085. matched by <code>:lang(abcde)</code>, even though both are equally invalid. Similarly, if
  5086. a Web browser and screen reader working in unison communicated about the language of the element,
  5087. the browser would tell the screen reader that the language was "xyzzy", even if it knew it was
  5088. invalid, just in case the screen reader actually supported a language with that tag after all.
  5089. Even if the screen reader supported both BCP 47 and another syntax for encoding language names,
  5090. and in that other syntax the string "xyzzy" was a way to denote the Belarusian language, it would
  5091. be <em>incorrect</em> for the screen reader to then start treating text as Belarusian, because
  5092. "xyzzy" is not how Belarusian is described in BCP 47 codes (BCP 47 uses the code "be" for
  5093. Belarusian).</p>
  5094. <p>If the resulting value is the empty string, then it must be interpreted as meaning that the
  5095. language of the node is explicitly unknown.</p>
  5096. <hr>
  5097. <p>User agents may use the element's language to determine proper processing or rendering (e.g. in
  5098. the selection of appropriate fonts or pronunciations, for dictionary selection, or for the user
  5099. interfaces of form controls such as date pickers). </p>
  5100. <hr>
  5101. <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
  5102. <code id=the-lang-and-xml:lang-attributes:attr-lang-8><a href=#attr-lang>lang</a></code> content attribute in no namespace.</p>
  5103. <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>
  5104. <p>The <dfn id=attr-translate><code>translate</code></dfn> attribute is an <a href=#enumerated-attribute id=the-translate-attribute:enumerated-attribute>enumerated
  5105. attribute</a> that is used to specify whether an element's attribute values and the values of
  5106. 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
  5107. leave them unchanged.</p>
  5108. <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
  5109. <i>yes</i> state. The <code>no</code> keyword maps to the <i>no</i> state. In addition,
  5110. 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
  5111. the <i id=the-translate-attribute:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i>).</p>
  5112. <p>Each element (even non-HTML elements) has a <dfn id=translation-mode>translation mode</dfn>, which is in either the
  5113. <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>
  5114. 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
  5115. <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
  5116. <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
  5117. 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,
  5118. 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
  5119. <code id=the-translate-attribute:attr-translate-5><a href=#attr-translate>translate</a></code> attribute; in either case, the element's
  5120. <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
  5121. <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>
  5122. <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
  5123. 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
  5124. the page is localized.</p>
  5125. <p>When an element is in the <dfn id=no-translate>no-translate</dfn> state, the element's attribute values and the
  5126. 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,
  5127. e.g. because the element contains a person's name or a the name of a computer program.</p>
  5128. <p>The following attributes are <dfn id=translatable-attributes>translatable attributes</dfn>:</p>
  5129. <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>,
  5130. <code id=the-translate-attribute:attr-img-alt><a href=#attr-img-alt>img</a></code>, and
  5131. <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
  5132. <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>,
  5133. <code id=the-translate-attribute:attr-menu-label><a href=#attr-menu-label>menu</a></code>,
  5134. <code id=the-translate-attribute:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
  5135. <code id=the-translate-attribute:attr-option-label><a href=#attr-option-label>option</a></code>, and
  5136. <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
  5137. <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
  5138. <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
  5139. or the <a href="#reset-button-state-(type=reset)" id="the-translate-attribute:reset-button-state-(type=reset)">Reset Button</a> state</ul>
  5140. <p>Other specifications may define other attributes that are also <a href=#translatable-attributes id=the-translate-attribute:translatable-attributes-2>translatable
  5141. 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>
  5142. <hr>
  5143. <p>The <dfn id=dom-translate><code>translate</code></dfn> IDL attribute must, on getting,
  5144. 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
  5145. 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>
  5146. <div class=example>
  5147. <p>In this example, everything in the document is to be translated when the page is localized,
  5148. except the sample keyboard input and sample program output:</p>
  5149. <pre>&lt;!DOCTYPE HTML>
  5150. &lt;html> &lt;!-- default on the root element is translate=yes -->
  5151. &lt;head>
  5152. &lt;title>The Bee Game&lt;/title> &lt;!-- implied translate=yes inherited from ancestors -->
  5153. &lt;/head>
  5154. &lt;body>
  5155. &lt;p>The Bee Game is a text adventure game in English.&lt;/p>
  5156. &lt;p>When the game launches, the first thing you should do is type
  5157. &lt;kbd <strong>translate=no</strong>>eat honey&lt;/kbd>. The game will respond with:&lt;/p>
  5158. &lt;pre>&lt;samp <strong>translate=no</strong>>Yum yum! That was some good honey!&lt;/samp>&lt;/pre>
  5159. &lt;/body>
  5160. &lt;/html></pre>
  5161. </div>
  5162. <h5 id=the-xml:base-attribute-(xml-only)>3.2.5.5 The <dfn><code>xml:base</code></dfn> attribute (XML only)</h5>
  5163. <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>
  5164. <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
  5165. 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
  5166. documents</a>.</p>
  5167. <h5 id=the-dir-attribute>3.2.5.6 The <dfn><code>dir</code></dfn> attribute</h5>
  5168. <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.
  5169. The attribute is an <a href=#enumerated-attribute id=the-dir-attribute:enumerated-attribute>enumerated attribute</a> with the following keywords and states:</p>
  5170. <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>
  5171. <p>Indicates that the contents of the element are explicitly directionally isolated
  5172. left-to-right text.</p>
  5173. <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>
  5174. <p>Indicates that the contents of the element are explicitly directionally isolated
  5175. right-to-left text.</p>
  5176. <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>
  5177. <p>Indicates that the contents of the element are explicitly directionally isolated text, but
  5178. that the direction is to be determined programmatically using the contents of the element (as
  5179. described below).</p>
  5180. <p class=note>The heuristic used by this state is very crude (it just looks at the first
  5181. character with a strong directionality, in a manner analogous to the Paragraph Level
  5182. determination in the bidirectional algorithm). Authors are urged to only use this value as a
  5183. last resort when the direction of the text is truly unknown and no better server-side heuristic
  5184. can be applied. <a href=#refsBIDI>[BIDI]</a></p>
  5185. <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
  5186. applied on a per-paragraph level.</p>
  5187. </dl>
  5188. <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>
  5189. <hr>
  5190. <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
  5191. the following list:</p>
  5192. <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>
  5193. 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>
  5194. 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>,
  5195. <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>
  5196. 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>
  5197. attribute is in the <a href=#attr-dir-auto-state id=the-dir-attribute:attr-dir-auto-state-2>auto</a> state<dd>
  5198. <p>If the element's <a href=#concept-fe-value id=the-dir-attribute:concept-fe-value>value</a> contains a character of
  5199. bidirectional character type AL or R, and there is no character of bidirectional character type
  5200. L anywhere before it in the element's <a href=#concept-fe-value id=the-dir-attribute:concept-fe-value-2>value</a>, then
  5201. <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>
  5202. <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
  5203. 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
  5204. element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-2>ltr</a>'.</p>
  5205. <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
  5206. element's <a href=#the-directionality id=the-dir-attribute:the-directionality-6>directionality</a>.</p>
  5207. <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>
  5208. attribute is not in a defined state (i.e. it is not present or has an invalid value)<dd>
  5209. <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>
  5210. <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
  5211. <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>
  5212. <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
  5213. descendant of the element whose <a href=#the-directionality id=the-dir-attribute:the-directionality-8>directionality</a> is
  5214. being determined and that is either:</p>
  5215. <ul class=brief><li>A <code id=the-dir-attribute:the-bdi-element-2><a href=#the-bdi-element>bdi</a></code> element.
  5216. <li>A <code id=the-dir-attribute:the-script-element><a href=#the-script-element>script</a></code> element.
  5217. <li>A <code id=the-dir-attribute:the-style-element><a href=#the-style-element>style</a></code> element.
  5218. <li>A <code id=the-dir-attribute:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> element.
  5219. <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.
  5220. </ul>
  5221. </ul>
  5222. <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
  5223. directionality</a> of the element is '<a href=#concept-rtl id=the-dir-attribute:concept-rtl-3>rtl</a>'.</p>
  5224. <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
  5225. directionality</a> of the element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-3>ltr</a>'.</p>
  5226. <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
  5227. the element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-4>ltr</a>'.</p>
  5228. <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
  5229. element's <a href=#the-directionality id=the-dir-attribute:the-directionality-13>directionality</a>.</p>
  5230. <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
  5231. 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
  5232. element's <a href=#the-directionality id=the-dir-attribute:the-directionality-15>directionality</a>.</dl>
  5233. <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
  5234. <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
  5235. 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,
  5236. default to '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-5>ltr</a>'.</p>
  5237. <p class=note>This attribute <a href=#bidireq>has rendering requirements involving the
  5238. bidirectional algorithm</a>.</p>
  5239. <hr>
  5240. <p>The <dfn id=directionality-of-the-attribute>directionality of an attribute</dfn> of an
  5241. <a href=#html-elements id=the-dir-attribute:html-elements-3>HTML element</a>, which is used when the text of that attribute is
  5242. to be included in the rendering in some manner, is determined as per the first appropriate set of
  5243. steps from the following list:</p>
  5244. <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>
  5245. state<dd>
  5246. <p>Find the first character (in logical order) of the attribute's value that is of bidirectional
  5247. character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a></p>
  5248. <p>If such a character is found and it is of bidirectional character type AL or R, the
  5249. <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>
  5250. <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>
  5251. <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>
  5252. <p>The following attributes are <dfn id=directionality-capable-attribute>directionality-capable attributes</dfn>:</p>
  5253. <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>,
  5254. <code id=the-dir-attribute:attr-img-alt><a href=#attr-img-alt>img</a></code>, and
  5255. <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>,
  5256. <code id=the-dir-attribute:attr-menu-label><a href=#attr-menu-label>menu</a></code>,
  5257. <code id=the-dir-attribute:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
  5258. <code id=the-dir-attribute:attr-option-label><a href=#attr-option-label>option</a></code>, and
  5259. <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
  5260. <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>
  5261. <hr>
  5262. <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>
  5263. <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>
  5264. <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>
  5265. <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>
  5266. </dl>
  5267. <p>The <dfn id=dom-dir><code>dir</code></dfn> IDL attribute on an element must
  5268. <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,
  5269. <a href=#limited-to-only-known-values id=the-dir-attribute:limited-to-only-known-values>limited to only known values</a>.</p>
  5270. <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>
  5271. 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
  5272. <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
  5273. there is no such element, then the attribute must return the empty string and do nothing on
  5274. setting.</p>
  5275. <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>
  5276. attribute to indicate text direction rather than using CSS, since that way their documents will
  5277. continue to render correctly even in the absence of CSS (e.g. as interpreted by search
  5278. engines).</p>
  5279. <div class=example>
  5280. <p>This markup fragment is of an IM conversation.</p>
  5281. <pre>&lt;p dir=auto class="u1">&lt;b>&lt;bdi>Student&lt;/bdi>:&lt;/b> How do you write "What's your name?" in Arabic?&lt;/p>
  5282. &lt;p dir=auto class="u2">&lt;b>&lt;bdi>Teacher&lt;/bdi>:&lt;/b> ما اسمك؟&lt;/p>
  5283. &lt;p dir=auto class="u1">&lt;b>&lt;bdi>Student&lt;/bdi>:&lt;/b> Thanks.&lt;/p>
  5284. &lt;p dir=auto class="u2">&lt;b>&lt;bdi>Teacher&lt;/bdi>:&lt;/b> That's written "شكرًا".&lt;/p>
  5285. &lt;p dir=auto class="u2">&lt;b>&lt;bdi>Teacher&lt;/bdi>:&lt;/b> Do you know how to write "Please"?&lt;/p>
  5286. &lt;p dir=auto class="u1">&lt;b>&lt;bdi>Student&lt;/bdi>:&lt;/b> "من فضلك", right?&lt;/p></pre>
  5287. <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,
  5288. namely to align the text to the <i>start edge</i> of the paragraph, the resulting rendering could
  5289. be as follows:</p>
  5290. <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>
  5291. <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
  5292. final paragraph in this example is misinterpreted as being right-to-left text, since it begins
  5293. with an Arabic character, which causes the "right?" to be to the left of the Arabic text.</p>
  5294. </div>
  5295. <h5 id=classes>3.2.5.7 The <dfn><code>class</code></dfn> attribute</h5>
  5296. <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>
  5297. <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
  5298. tokens</a> representing the various classes that the element belongs to.</p>
  5299. <p>The classes that an <a href=#html-elements id=classes:html-elements-2>HTML element</a> has assigned to it consists
  5300. of all the classes returned when the value of the <code id=classes:classes-2><a href=#classes>class</a></code> attribute
  5301. is <a href=#split-a-string-on-spaces id=classes:split-a-string-on-spaces>split on spaces</a>. (Duplicates are ignored.)</p>
  5302. <p class=note>Assigning classes to an element affects class matching in selectors in CSS, the
  5303. <code id=classes:dom-document-getelementsbyclassname><a href=#dom-document-getelementsbyclassname>getElementsByClassName()</a></code> method in the
  5304. DOM, and other such features.</p>
  5305. <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
  5306. the nature of the content, rather than values that describe the desired presentation of the
  5307. content.</p>
  5308. <hr>
  5309. <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
  5310. specification, <a href=#reflect id=classes:reflect>reflect</a> the <code id=classes:classes-4><a href=#classes>class</a></code> content attribute.
  5311. <a href=#refsDOM>[DOM]</a></p>
  5312. <h5 id=the-style-attribute>3.2.5.8 The <dfn><code>style</code></dfn> attribute</h5>
  5313. <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
  5314. 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
  5315. Attribute Syntax specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>
  5316. <p>In user agents that support CSS, the attribute's value must be parsed when the attribute is
  5317. added or has its value changed,
  5318. according to the rules given for <a href=#css-styling-attribute id=the-style-attribute:css-styling-attribute-2>CSS styling
  5319. attributes</a>. <a href=#refsCSSATTR>[CSSATTR]</a></p>
  5320. <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
  5321. must still be comprehensible and usable if those attributes were removed.</p>
  5322. <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
  5323. and show content, or to convey meaning that is otherwise not included in the document, is
  5324. 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>
  5325. attribute.)</p>
  5326. <hr>
  5327. <dl class=domintro><dt><var>element</var> . <code id=the-style-attribute:dom-style><a href=#dom-style>style</a></code><dd>
  5328. <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>
  5329. </dl>
  5330. <p>The <dfn id=dom-style><code>style</code></dfn> IDL attribute is defined in the CSS Object
  5331. Model (CSSOM) specification. <a href=#refsCSSOM>[CSSOM]</a></p>
  5332. <div class=example>
  5333. <p>In the following example, the words that refer to colours are marked up using the
  5334. <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
  5335. words show up in the relevant colours in visual media.</p>
  5336. <pre>&lt;p>My sweat suit is &lt;span style="color: green; background:
  5337. transparent">green&lt;/span> and my eyes are &lt;span style="color: blue;
  5338. background: transparent">blue&lt;/span>.&lt;/p></pre>
  5339. </div>
  5340. <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>
  5341. <p>A <dfn id=custom-data-attribute>custom data attribute</dfn> is an attribute in no namespace whose name starts with the
  5342. string "<dfn id=attr-data-*><code>data-</code></dfn>", has at least one character after the
  5343. 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>
  5344. <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>
  5345. get ASCII-lowercased automatically, so the restriction on ASCII uppercase letters doesn't affect
  5346. such documents.</p>
  5347. <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
  5348. data private to the page or application, for which there are no more appropriate attributes or
  5349. elements.</p>
  5350. <p>These attributes are not intended for use by software that is not known to the administrators
  5351. of the site that uses the attributes. For generic extensions that are to be used by multiple
  5352. independent tools, either this specification should be extended to provide the feature explicitly,
  5353. 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>
  5354. <div class=example>
  5355. <p>For instance, a site about music could annotate list items representing tracks in an album
  5356. with custom data attributes containing the length of each track. This information could then be
  5357. used by the site itself to allow the user to sort the list by track length, or to filter the list
  5358. for tracks of certain lengths.</p>
  5359. <pre>&lt;ol>
  5360. &lt;li data-length="2m11s">Beyond The Sea&lt;/li>
  5361. ...
  5362. &lt;/ol></pre>
  5363. <p>It would be inappropriate, however, for the user to use generic software not associated with
  5364. that music site to search for tracks of a certain length by looking at this data.</p>
  5365. <p>This is because these attributes are intended for use by the site's own scripts, and are not a
  5366. generic extension mechanism for publicly-usable metadata.</p>
  5367. </div>
  5368. <div class=example>
  5369. <p>Similarly, a page author could write markup that provides information for a translation tool
  5370. that they are intending to use:</p>
  5371. <pre>&lt;p>The third &lt;span data-mytrans-de="Anspruch">claim&lt;/span> covers the case of &lt;span
  5372. translate="no">HTML&lt;/span> markup.&lt;/p></pre>
  5373. <p>In this example, the "<code>data-mytrans-de</code>" attribute gives specific text
  5374. for the MyTrans product to use when translating the phrase "claim" to German. However, the
  5375. 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
  5376. languages, "HTML" is to remain unchanged. When a standard attribute is available, there is no
  5377. 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>
  5378. </div>
  5379. <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>
  5380. <hr>
  5381. <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>
  5382. <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>
  5383. <p>Hyphenated names become camel-cased. For example, <code>data-foo-bar=""</code>
  5384. becomes <code>element.dataset.fooBar</code>.</p>
  5385. </dl>
  5386. <p>The <dfn id=dom-dataset><code>dataset</code></dfn> IDL attribute provides convenient
  5387. 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
  5388. 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
  5389. <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
  5390. attributes on their element:</p>
  5391. <dl><dt>The algorithm for getting the list of name-value pairs<dd>
  5392. <ol><li>Let <var>list</var> be an empty list of name-value
  5393. 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
  5394. <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
  5395. 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
  5396. name is the attribute's name with the first five characters removed and whose value is the
  5397. attribute's value.<li>For each name in <var>list</var>, for each U+002D HYPHEN-MINUS character (-) in the
  5398. 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>,
  5399. remove the U+002D HYPHEN-MINUS character (-) and replace the character that followed it by the
  5400. 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>
  5401. <dt>The algorithm for setting names to certain values<dd>
  5402. <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
  5403. <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
  5404. <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
  5405. 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
  5406. the name <var>name</var>, then this must throw the same exception.</ol>
  5407. <dt>The algorithm for deleting names<dd>
  5408. <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
  5409. 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.
  5410. Do nothing otherwise.</ol>
  5411. <p class=note>This algorithm will only get invoked by the Web IDL specification for names that
  5412. are given by the earlier algorithm for getting the list of name-value pairs. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  5413. </dl>
  5414. <p>The same object must be returned each time.</p>
  5415. <div class=example>
  5416. <p>If a Web page wanted an element to represent a space ship, e.g. as part of a game, it would
  5417. 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>
  5418. <pre>&lt;div class="spaceship" data-ship-id="92432"
  5419. data-weapons="laser 2" data-shields="50%"
  5420. data-x="30" data-y="10" data-z="90">
  5421. &lt;button class="fire"
  5422. onclick="spaceships[this.parentNode.dataset.shipId].fire()">
  5423. Fire
  5424. &lt;/button>
  5425. &lt;/div></pre>
  5426. <p>Notice how the hyphenated attribute name becomes camel-cased in the API.</p>
  5427. </div>
  5428. <p>Authors should carefully design such extensions so that when the attributes are ignored and any
  5429. associated CSS dropped, the page is still usable.</p>
  5430. <p>User agents must not derive any implementation behavior from these attributes or values.
  5431. Specifications intended for user agents must not define these attributes to have any meaningful
  5432. values.</p>
  5433. <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
  5434. attributes</a>, as they are considered to be part of the page on which they are used. Authors
  5435. of libraries that are reused by many authors are encouraged to include their name in the attribute
  5436. names, to reduce the risk of clashes. Where it makes sense, library authors are also encouraged to
  5437. make the exact name used in the attribute names customizable, so that libraries whose authors
  5438. unknowingly picked the same name can be used on the same page, and so that multiple versions of a
  5439. particular library can be used on the same page even when those versions are not mutually
  5440. compatible.</p>
  5441. <div class=example>
  5442. <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
  5443. <code>data-jjo-range</code>. The jJo library could also provide an API to set which
  5444. prefix to use (e.g. <code>J.setDataPrefix('j2')</code>, making the attributes have names
  5445. like <code>data-j2-range</code>).</p>
  5446. </div>
  5447. <h4 id=requirements-relating-to-the-bidirectional-algorithm>3.2.6 Requirements relating to the bidirectional algorithm</h4>
  5448. <h5 id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters>3.2.6.1 Authoring conformance criteria for bidirectional-algorithm formatting characters</h5>
  5449. <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
  5450. <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
  5451. elements</a> that allow free-form text, may contain characters in the ranges U+202A to U+202E
  5452. and U+2066 to U+2069 (the bidirectional-algorithm formatting characters). However, the use of
  5453. these characters is restricted so that any embedding or overrides generated by these characters do
  5454. not start and end with different parent elements, and so that all such embeddings and overrides
  5455. are explicitly terminated by a U+202C POP DIRECTIONAL FORMATTING character. This helps reduce
  5456. incidences of text being reused in a manner that has unforeseen effects on the bidirectional
  5457. algorithm. <a href=#refsBIDI>[BIDI]</a></p>
  5458. <p>The aforementioned restrictions are defined by specifying that certain parts of documents form
  5459. <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
  5460. on such ranges.</p>
  5461. <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
  5462. formatting character ranges</a>:</p>
  5463. <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
  5464. any, or null otherwise.<li><p><i>Loop</i>: If <var>node</var> is null, jump to the step labeled
  5465. <i>end</i>.<li>
  5466. <p>Process <var>node</var> according to the first matching step from the following
  5467. list:</p>
  5468. <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
  5469. <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>
  5470. onto <var>output</var>, and let <var>string</var> be empty string.<dt>Otherwise<dd>Do nothing.</dl>
  5471. <li><p>Let <var>node</var> be <var>node</var>'s next sibling, if any, or null
  5472. 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
  5473. character ranges</a>.</ol>
  5474. <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>
  5475. 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
  5476. formatting character range</a>.</p>
  5477. <p>Any strings that, as described above, are <dfn id=bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting character
  5478. ranges</dfn> must match the <code>string</code> production in the following ABNF, the
  5479. character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
  5480. <pre>string = *( plaintext ( embedding / override / isolation ) ) plaintext
  5481. embedding = ( lre / rle ) string pdf
  5482. override = ( lro / rlo ) string pdf
  5483. isolation = ( lri / rli / fsi ) string pdi
  5484. lre = %x202A ; U+202A LEFT-TO-RIGHT EMBEDDING
  5485. rle = %x202B ; U+202B RIGHT-TO-LEFT EMBEDDING
  5486. lro = %x202D ; U+202D LEFT-TO-RIGHT OVERRIDE
  5487. rlo = %x202E ; U+202E RIGHT-TO-LEFT OVERRIDE
  5488. pdf = %x202C ; U+202C POP DIRECTIONAL FORMATTING
  5489. lri = %x2066 ; U+2066 LEFT-TO-RIGHT ISOLATE
  5490. rli = %x2067 ; U+2067 RIGHT-TO-LEFT ISOLATE
  5491. fsi = %x2068 ; U+2068 FIRST STRONG ISOLATE
  5492. pdi = %x2069 ; U+2069 POP DIRECTIONAL ISOLATE
  5493. plaintext = *( %x0000-2029 / %x202F-2065 / %x206A-10FFFF )
  5494. ; any string with no bidirectional-algorithm formatting characters</pre>
  5495. <p class=note>While the U+2069 POP DIRECTIONAL ISOLATE character implicitly also ends open
  5496. embeddings and overrides, text that relies on this implicit scope closure is not conforming to
  5497. this specification. All strings of embeddings, overrides, and isolations need to be explicitly
  5498. terminated to conform to this section's requirements.</p>
  5499. <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
  5500. <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
  5501. bidirectional-algorithm formatting characters manually. The bidirectional-algorithm formatting
  5502. characters interact poorly with CSS.</p>
  5503. <h5 id=user-agent-conformance-criteria>3.2.6.2 User agent conformance criteria</h5>
  5504. <p>User agents must implement the Unicode bidirectional algorithm to determine the proper ordering
  5505. of characters when rendering documents and parts of documents. <a href=#refsBIDI>[BIDI]</a></p>
  5506. <p>The mapping of HTML to the Unicode bidirectional algorithm must be done in one of three ways.
  5507. Either the user agent must implement CSS, including in particular the CSS 'unicode-bidi',
  5508. 'direction', and 'content' properties, and must have, in its user agent style sheet, the rules
  5509. using those properties given in this specification's <a href=#rendering>rendering</a> section,
  5510. or, alternatively, the user agent must act as if it implemented just the aforementioned properties
  5511. and had a user agent style sheet that included all the aforementioned rules, but without letting
  5512. style sheets specified in documents override them, or, alternatively, the user agent must
  5513. implement another styling language with equivalent semantics. <a href=#refsCSSWM>[CSSWM]</a> <a href=#refsCSSGC>[CSSGC]</a></p>
  5514. <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
  5515. requirements on all user agents (not just those that <a href=#renderingUA>support the suggested
  5516. default rendering</a>):</p>
  5517. <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>
  5518. <h4 id=wai-aria>3.2.7 <dfn>WAI-ARIA</dfn></h4>
  5519. <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
  5520. the requirements described in the ARIA specifications, except where these conflict with the
  5521. <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
  5522. semantics</a> described below. These exceptions are intended to prevent authors from making
  5523. assistive technology products report nonsensical states that do not represent the actual state of
  5524. the document. <a href=#refsARIA>[ARIA]</a></p>
  5525. <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
  5526. 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
  5527. 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
  5528. semantics</a> defined in the following two tables.</p>
  5529. <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
  5530. 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
  5531. recognised by implementations for the purposes of ARIA processing. <a href=#refsARIAIMPL>[ARIAIMPL]</a></p>
  5532. <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
  5533. 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
  5534. have any effect on CSS pseudo-class matching, user interface modalities that don't use assistive
  5535. technologies, or the default actions of user interaction events as described in this
  5536. specification.</p>
  5537. <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
  5538. <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
  5539. language feature (element or attribute) in a cell in the first column implies the ARIA semantics
  5540. (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
  5541. must be applied, and the states and properties from all the rows must be combined.</p>
  5542. <table id=table-aria-strong><thead><tr><th>Language feature
  5543. <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>
  5544. <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>
  5545. <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
  5546. <tr><td><code id=wai-aria:the-base-element><a href=#the-base-element>base</a></code> element
  5547. <td><a href=#concept-role-none id=wai-aria:concept-role-none>No role</a>
  5548. <tr><td><code id=wai-aria:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element
  5549. <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"
  5550. <tr><td><code id=wai-aria:the-details-element><a href=#the-details-element>details</a></code> element
  5551. <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
  5552. <code id=wai-aria:attr-details-open><a href=#attr-details-open>open</a></code> attribute is present, and set to "false" otherwise
  5553. <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
  5554. <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"
  5555. <tr><td><code id=wai-aria:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element
  5556. <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
  5557. <tr><td><code id=wai-aria:the-head-element><a href=#the-head-element>head</a></code> element
  5558. <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"
  5559. <tr><td><code id=wai-aria:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element
  5560. <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
  5561. depth</a>
  5562. <tr><td><code id=wai-aria:the-hr-element><a href=#the-hr-element>hr</a></code> element
  5563. <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
  5564. <tr><td><code id=wai-aria:the-html-element><a href=#the-html-element>html</a></code> element
  5565. <td><a href=#concept-role-none id=wai-aria:concept-role-none-3>No role</a>
  5566. <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
  5567. <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
  5568. <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
  5569. the <a href="#checkbox-state-(type=checkbox)" id="wai-aria:checkbox-state-(type=checkbox)">Checkbox</a> state
  5570. <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
  5571. <code id=wai-aria:dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is true, or "true" if
  5572. the element's <a href=#concept-fe-checked id=wai-aria:concept-fe-checked>checkedness</a> is true, or "false" otherwise
  5573. <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
  5574. the <a href="#colour-state-(type=color)" id="wai-aria:colour-state-(type=color)">Colour</a> state
  5575. <td><a href=#concept-role-none id=wai-aria:concept-role-none-4>No role</a>
  5576. <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
  5577. the <a href="#date-state-(type=date)" id="wai-aria:date-state-(type=date)">Date</a> state
  5578. <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
  5579. <code id=wai-aria:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
  5580. <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
  5581. the <a href="#date-and-time-state-(type=datetime)" id="wai-aria:date-and-time-state-(type=datetime)">Date and Time</a> state
  5582. <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
  5583. <code id=wai-aria:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code> attribute
  5584. <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
  5585. 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
  5586. <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
  5587. <code id=wai-aria:attr-input-readonly-3><a href=#attr-input-readonly>readonly</a></code> attribute
  5588. <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
  5589. 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>
  5590. <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
  5591. <code id=wai-aria:attr-input-readonly-4><a href=#attr-input-readonly>readonly</a></code> attribute
  5592. <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
  5593. the <a href="#file-upload-state-(type=file)" id="wai-aria:file-upload-state-(type=file)">File Upload</a> state
  5594. <td><a href=#concept-role-none id=wai-aria:concept-role-none-8>No role</a>
  5595. <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
  5596. the <a href="#hidden-state-(type=hidden)" id="wai-aria:hidden-state-(type=hidden)">Hidden</a> state
  5597. <td><a href=#concept-role-none id=wai-aria:concept-role-none-9>No role</a>
  5598. <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
  5599. the <a href="#month-state-(type=month)" id="wai-aria:month-state-(type=month)">Month</a> state
  5600. <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
  5601. <code id=wai-aria:attr-input-readonly-5><a href=#attr-input-readonly>readonly</a></code> attribute
  5602. <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
  5603. the <a href="#number-state-(type=number)" id="wai-aria:number-state-(type=number)">Number</a> state
  5604. <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
  5605. <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
  5606. 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
  5607. <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
  5608. the <a href="#password-state-(type=password)" id="wai-aria:password-state-(type=password)">Password</a> state
  5609. <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
  5610. <code id=wai-aria:attr-input-readonly-7><a href=#attr-input-readonly>readonly</a></code> attribute
  5611. <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
  5612. the <a href="#radio-button-state-(type=radio)" id="wai-aria:radio-button-state-(type=radio)">Radio Button</a> state
  5613. <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
  5614. <a href=#concept-fe-checked id=wai-aria:concept-fe-checked-2>checkedness</a> is true, or "false" otherwise
  5615. <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
  5616. 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
  5617. <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
  5618. <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
  5619. <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
  5620. 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
  5621. <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>
  5622. <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
  5623. the <a href="#reset-button-state-(type=reset)" id="wai-aria:reset-button-state-(type=reset)">Reset Button</a> state
  5624. <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
  5625. <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
  5626. 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>
  5627. <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
  5628. <code id=wai-aria:attr-input-readonly-8><a href=#attr-input-readonly>readonly</a></code> attribute
  5629. <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
  5630. the <a href="#submit-button-state-(type=submit)" id="wai-aria:submit-button-state-(type=submit)">Submit Button</a> state
  5631. <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
  5632. <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
  5633. 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>
  5634. <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
  5635. <code id=wai-aria:attr-input-readonly-9><a href=#attr-input-readonly>readonly</a></code> attribute
  5636. <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
  5637. 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>
  5638. <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
  5639. <code id=wai-aria:attr-input-readonly-10><a href=#attr-input-readonly>readonly</a></code> attribute
  5640. <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
  5641. 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
  5642. <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>
  5643. <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
  5644. <code id=wai-aria:attr-input-readonly-11><a href=#attr-input-readonly>readonly</a></code> attribute
  5645. <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
  5646. the <a href="#time-state-(type=time)" id="wai-aria:time-state-(type=time)">Time</a> state
  5647. <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
  5648. <code id=wai-aria:attr-input-readonly-12><a href=#attr-input-readonly>readonly</a></code> attribute
  5649. <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
  5650. 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>
  5651. <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
  5652. <code id=wai-aria:attr-input-readonly-13><a href=#attr-input-readonly>readonly</a></code> attribute
  5653. <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
  5654. the <a href="#week-state-(type=week)" id="wai-aria:week-state-(type=week)">Week</a> state
  5655. <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
  5656. <code id=wai-aria:attr-input-readonly-14><a href=#attr-input-readonly>readonly</a></code> attribute
  5657. <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>
  5658. <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"
  5659. <tr><td><code id=wai-aria:the-keygen-element><a href=#the-keygen-element>keygen</a></code> element
  5660. <td><a href=#concept-role-none id=wai-aria:concept-role-none-13>No role</a>
  5661. <tr><td><code id=wai-aria:the-label-element><a href=#the-label-element>label</a></code> element
  5662. <td><a href=#concept-role-none id=wai-aria:concept-role-none-14>No role</a>
  5663. <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>
  5664. <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
  5665. <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
  5666. <a href=#popup-menu-state id=wai-aria:popup-menu-state>popup menu</a> state
  5667. <td><a href=#concept-role-none id=wai-aria:concept-role-none-15>No role</a>
  5668. <tr><td><code id=wai-aria:the-meta-element><a href=#the-meta-element>meta</a></code> element
  5669. <td><a href=#concept-role-none id=wai-aria:concept-role-none-16>No role</a>
  5670. <tr><td><code id=wai-aria:the-meter-element><a href=#the-meter-element>meter</a></code> element
  5671. <td><a href=#concept-role-none id=wai-aria:concept-role-none-17>No role</a>
  5672. <tr><td><code id=wai-aria:the-nav-element><a href=#the-nav-element>nav</a></code> element
  5673. <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
  5674. <tr><td><code id=wai-aria:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element, when <span>scripting is enabled</span>
  5675. <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"
  5676. <tr><td><code id=wai-aria:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element
  5677. <td><a href=#concept-role-none id=wai-aria:concept-role-none-19>No role</a>
  5678. <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
  5679. options</a>
  5680. <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
  5681. <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
  5682. 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
  5683. <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>
  5684. attribute or a <a href=#concept-select-size id=wai-aria:concept-select-size>display size</a> greater than 1
  5685. <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
  5686. <tr><td><code id=wai-aria:the-param-element><a href=#the-param-element>param</a></code> element
  5687. <td><a href=#concept-role-none id=wai-aria:concept-role-none-20>No role</a>
  5688. <tr><td><code id=wai-aria:the-progress-element><a href=#the-progress-element>progress</a></code> element
  5689. <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
  5690. 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
  5691. 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>
  5692. 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
  5693. set to the current value of the progress bar
  5694. <tr><td><code id=wai-aria:the-script-element><a href=#the-script-element>script</a></code> element
  5695. <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"
  5696. <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
  5697. <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"
  5698. <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>
  5699. attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-2>display size</a> equal to 1
  5700. <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"
  5701. <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>
  5702. attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-3>display size</a> greater than 1
  5703. <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"
  5704. <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
  5705. <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"
  5706. <tr><td><code id=wai-aria:the-source-element><a href=#the-source-element>source</a></code> element
  5707. <td><a href=#concept-role-none id=wai-aria:concept-role-none-22>No role</a>
  5708. <tr><td><code id=wai-aria:the-style-element><a href=#the-style-element>style</a></code> element
  5709. <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"
  5710. <tr><td><code id=wai-aria:the-summary-element><a href=#the-summary-element>summary</a></code> element
  5711. <td><a href=#concept-role-none id=wai-aria:concept-role-none-24>No role</a>
  5712. <tr><td><code id=wai-aria:the-table-element><a href=#the-table-element>table</a></code> element
  5713. <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"
  5714. <tr><td><code id=wai-aria:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element
  5715. <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
  5716. <tr><td><code id=wai-aria:the-td-element><a href=#the-td-element>td</a></code> element
  5717. <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
  5718. <tr><td><code id=wai-aria:the-template-element><a href=#the-template-element>template</a></code> element
  5719. <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"
  5720. <tr><td><code id=wai-aria:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element
  5721. <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
  5722. <code id=wai-aria:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
  5723. <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
  5724. <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"
  5725. <tr><td><code id=wai-aria:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element
  5726. <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
  5727. <tr><td><code id=wai-aria:the-thead-element><a href=#the-thead-element>thead</a></code> element
  5728. <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
  5729. <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
  5730. <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
  5731. sort direction</a> is <i>normal</i>, and "descending" otherwise.
  5732. <tr><td><code id=wai-aria:the-title-element><a href=#the-title-element>title</a></code> element
  5733. <td><a href=#concept-role-none id=wai-aria:concept-role-none-26>No role</a>
  5734. <tr><td><code id=wai-aria:the-tr-element><a href=#the-tr-element>tr</a></code> element
  5735. <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
  5736. <tr><td>Element that is <a href=#concept-fe-disabled id=wai-aria:concept-fe-disabled>disabled</a>
  5737. <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"
  5738. <tr><td>Element that is <a href=#inert id=wai-aria:inert>inert</a>
  5739. <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"
  5740. <tr><td>Element with a <code id=wai-aria:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute
  5741. <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"
  5742. <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>
  5743. <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"
  5744. </table>
  5745. <p>Some <a href=#html-elements id=wai-aria:html-elements-4>HTML elements</a> have native semantics that can be overridden. The following
  5746. 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
  5747. restrictions that apply to those elements. Each language feature (element or attribute) in a cell
  5748. in the first column implies, unless otherwise overridden, the ARIA semantic (role, state, or
  5749. property) given in the cell in the second column of the same row, but this semantic may be
  5750. overridden under the conditions listed in the cell in the third column of that row. In addition,
  5751. 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,
  5752. regardless of the restrictions below.</p>
  5753. <table id=table-aria-weak><thead><tr><th>Language feature
  5754. <th>Default implicit ARIA semantic
  5755. <th>Restrictions
  5756. <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>
  5757. <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
  5758. <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>,
  5759. 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>
  5760. <tr><td><code id=wai-aria:the-address-element><a href=#the-address-element>address</a></code> element
  5761. <td><a href=#concept-role-none id=wai-aria:concept-role-none-27>No role</a>
  5762. <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>
  5763. <tr><td><code id=wai-aria:the-article-element><a href=#the-article-element>article</a></code> element
  5764. <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
  5765. <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>
  5766. <tr><td><code id=wai-aria:the-aside-element><a href=#the-aside-element>aside</a></code> element
  5767. <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
  5768. <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>
  5769. <tr><td><code id=wai-aria:the-audio-element><a href=#the-audio-element>audio</a></code> element
  5770. <td><a href=#concept-role-none id=wai-aria:concept-role-none-28>No role</a>
  5771. <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>
  5772. <tr><td><code id=wai-aria:the-button-element><a href=#the-button-element>button</a></code> element
  5773. <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
  5774. <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>
  5775. <tr><td><code id=wai-aria:the-details-element-2><a href=#the-details-element>details</a></code> element
  5776. <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
  5777. <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>
  5778. <tr><td><code id=wai-aria:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element
  5779. <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
  5780. <td>Role must be either
  5781. <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>,
  5782. <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>,
  5783. <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>,
  5784. <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>,
  5785. <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>,
  5786. <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>,
  5787. <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>,
  5788. <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>,
  5789. <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>,
  5790. <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>,
  5791. <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
  5792. <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>
  5793. <tr><td><code id=wai-aria:the-embed-element><a href=#the-embed-element>embed</a></code> element
  5794. <td><a href=#concept-role-none id=wai-aria:concept-role-none-29>No role</a>
  5795. <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>
  5796. <tr><td><code id=wai-aria:the-footer-element><a href=#the-footer-element>footer</a></code> element
  5797. <td><a href=#concept-role-none id=wai-aria:concept-role-none-30>No role</a>
  5798. <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>
  5799. <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
  5800. <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
  5801. depth</a>
  5802. <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>
  5803. <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
  5804. <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
  5805. depth</a>
  5806. <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>
  5807. <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
  5808. <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
  5809. depth</a>
  5810. <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>
  5811. <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
  5812. <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
  5813. depth</a>
  5814. <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>
  5815. <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
  5816. <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
  5817. depth</a>
  5818. <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>
  5819. <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
  5820. <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
  5821. depth</a>
  5822. <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>
  5823. <tr><td><code id=wai-aria:the-header-element><a href=#the-header-element>header</a></code> element
  5824. <td><a href=#concept-role-none id=wai-aria:concept-role-none-31>No role</a>
  5825. <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>
  5826. <tr><td><code id=wai-aria:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element
  5827. <td><a href=#concept-role-none id=wai-aria:concept-role-none-32>No role</a>
  5828. <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>
  5829. <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
  5830. <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
  5831. <td>No restrictions
  5832. <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
  5833. present and not empty
  5834. <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
  5835. <td>No restrictions
  5836. <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
  5837. the <a href="#button-state-(type=button)" id="wai-aria:button-state-(type=button)">Button</a> state
  5838. <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
  5839. <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>
  5840. <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
  5841. the <a href="#checkbox-state-(type=checkbox)" id="wai-aria:checkbox-state-(type=checkbox)-2">Checkbox</a> state
  5842. <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
  5843. <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>
  5844. <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
  5845. the <a href="#image-button-state-(type=image)" id="wai-aria:image-button-state-(type=image)">Image Button</a> state
  5846. <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
  5847. <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>
  5848. <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
  5849. the <a href="#radio-button-state-(type=radio)" id="wai-aria:radio-button-state-(type=radio)-2">Radio Button</a> state
  5850. <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
  5851. <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>
  5852. <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
  5853. <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
  5854. <td>Role must be either
  5855. <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>,
  5856. <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>,
  5857. <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>,
  5858. <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>,
  5859. <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
  5860. <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>
  5861. <tr><td><code id=wai-aria:the-main-element><a href=#the-main-element>main</a></code> element
  5862. <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
  5863. <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>
  5864. <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
  5865. <a href=#toolbar-state id=wai-aria:toolbar-state>toolbar</a> state
  5866. <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
  5867. <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>,
  5868. <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>
  5869. <tr><td><code id=wai-aria:the-object-element><a href=#the-object-element>object</a></code> element
  5870. <td><a href=#concept-role-none id=wai-aria:concept-role-none-33>No role</a>
  5871. <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>
  5872. <tr><td><code id=wai-aria:the-ol-element-2><a href=#the-ol-element>ol</a></code> element
  5873. <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
  5874. <td>Role must be either
  5875. <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>,
  5876. <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>,
  5877. <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>,
  5878. <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>,
  5879. <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>,
  5880. <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>,
  5881. <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>,
  5882. <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
  5883. <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>
  5884. <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
  5885. 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
  5886. <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
  5887. <td>Role must be either
  5888. <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>,
  5889. <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>,
  5890. <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
  5891. <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>
  5892. <tr><td><code id=wai-aria:the-output-element><a href=#the-output-element>output</a></code> element
  5893. <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
  5894. <td>No restrictions
  5895. <tr><td><code id=wai-aria:the-section-element><a href=#the-section-element>section</a></code> element
  5896. <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
  5897. <td>Role must be either
  5898. <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>,
  5899. <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>,
  5900. <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>,
  5901. <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>,
  5902. <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>,
  5903. <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>,
  5904. <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>,
  5905. <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>,
  5906. <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>,
  5907. <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>,
  5908. <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
  5909. <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>
  5910. <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>
  5911. attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-5>display size</a> equal to 1
  5912. <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
  5913. <td>Role must be either
  5914. <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
  5915. <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>
  5916. <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
  5917. <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
  5918. <td>Role must be either
  5919. <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>,
  5920. <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
  5921. <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>
  5922. <tr><td><code id=wai-aria:the-ul-element-2><a href=#the-ul-element>ul</a></code> element
  5923. <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
  5924. <td>Role must be either
  5925. <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>,
  5926. <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>,
  5927. <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>,
  5928. <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>,
  5929. <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>,
  5930. <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>,
  5931. <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>,
  5932. <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
  5933. <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>
  5934. <tr><td><code id=wai-aria:the-video-element><a href=#the-video-element>video</a></code> element
  5935. <td><a href=#concept-role-none id=wai-aria:concept-role-none-34>No role</a>
  5936. <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>
  5937. <tr><td><a href=#the-body-element-2 id=wai-aria:the-body-element-2>The body element</a>
  5938. <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
  5939. <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>
  5940. </table>
  5941. <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
  5942. agent has no default mapping to ARIA roles. (However, it probably will have its own mappings to
  5943. the accessibility layer.)</p>
  5944. <p>Conformance checkers are encouraged to phrase errors such that authors are encouraged to use
  5945. more appropriate elements rather than remove accessibility annotations. For example, if an
  5946. <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>
  5947. role, a conformance checker could say "Use a more appropriate element to represent a button, for
  5948. 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>
  5949. <div class=example>
  5950. <p>These features can be used to make accessibility tools render content to their users in more
  5951. useful ways. For example, ASCII art, which is really an image, appears to be text, and in the
  5952. absence of appropriate annotations would end up being rendered by screen readers as a very
  5953. painful reading of lots of punctuation. Using the features described in this section, one can
  5954. instead make the ATs skip the ASCII art and just read the caption:</p>
  5955. <pre>&lt;figure <strong>role="img" aria-labelledby="fish-caption"</strong>>
  5956. &lt;pre>
  5957. o .'`/
  5958. ' / (
  5959. O .-'` ` `'-._ .')
  5960. _/ (o) '. .' /
  5961. ) ))) >&lt; &lt;
  5962. `\ |_\ _.' '. \
  5963. '-._ _ .-' '.)
  5964. jgs `\__\
  5965. &lt;/pre>
  5966. &lt;figcaption <strong>id="fish-caption"</strong>>
  5967. Joan G. Stark, "&lt;cite>fish&lt;/cite>".
  5968. October 1997. ASCII on electrons. 28×8.
  5969. &lt;/figcaption>
  5970. &lt;/figure>
  5971. </pre>
  5972. </div>
  5973. <h2 id=semantics>4 The elements of HTML</h2>
  5974. <h3 id=the-root-element>4.1 The root element</h3>
  5975. <h4 id=the-html-element>4.1.1 The <dfn><code>html</code></dfn> element</h4>
  5976. <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
  5977. 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
  5978. 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>
  5979. <pre class=idl>interface <dfn id=htmlhtmlelement>HTMLHtmlElement</dfn> : <a href=#htmlelement id=the-html-element:htmlelement>HTMLElement</a> {
  5980. // <a href="#HTMLHtmlElement-partial">also has obsolete members</a>
  5981. };</pre>
  5982. </dl>
  5983. <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>
  5984. <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
  5985. <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
  5986. determine what pronunciations to use, translation tools to determine what rules to use, and so
  5987. forth.</p>
  5988. <p>The <dfn id=attr-html-manifest><code>manifest</code></dfn> attribute gives the address of
  5989. 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,
  5990. 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
  5991. spaces</a>.</p>
  5992. <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.
  5993. Changing the attribute dynamically thus has no effect (and thus, no DOM API is provided for this
  5994. attribute).</p>
  5995. <p class=note>For the purposes of <a href=#concept-appcache-init id=the-html-element:concept-appcache-init-2>application cache
  5996. 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>
  5997. attributes, as the attributes are processed before those elements are seen.</p>
  5998. <p class=note>The <code id=the-html-element:dom-applicationcache><a href=#dom-applicationcache>window.applicationCache</a></code> IDL
  5999. attribute provides scripted access to the offline <a href=#application-cache id=the-html-element:application-cache-2>application cache</a> mechanism.</p>
  6000. <div class=example>
  6001. <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
  6002. is English.</p>
  6003. <pre>&lt;!DOCTYPE html>
  6004. <strong>&lt;html lang="en"></strong>
  6005. &lt;head>
  6006. &lt;title>Swapping Songs&lt;/title>
  6007. &lt;/head>
  6008. &lt;body>
  6009. &lt;h1>Swapping Songs&lt;/h1>
  6010. &lt;p>Tonight I swapped some of the songs I wrote with some friends, who
  6011. gave me some of the songs they wrote. I love sharing my music.&lt;/p>
  6012. &lt;/body>
  6013. <strong>&lt;/html></strong></pre>
  6014. </div>
  6015. <h3 id=document-metadata>4.2 Document metadata</h3>
  6016. <h4 id=the-head-element>4.2.1 The <dfn><code>head</code></dfn> element</h4>
  6017. <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
  6018. 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
  6019. 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
  6020. <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>
  6021. <pre class=idl>interface <dfn id=htmlheadelement>HTMLHeadElement</dfn> : <a href=#htmlelement id=the-head-element:htmlelement>HTMLElement</a> {};</pre>
  6022. </dl>
  6023. <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
  6024. <code id=the-head-element:document><a href=#document>Document</a></code>.</p>
  6025. <div class=example>
  6026. <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
  6027. example of a very short one:</p>
  6028. <pre>&lt;!doctype html>
  6029. &lt;html>
  6030. &lt;head>
  6031. &lt;title>A document with a short head&lt;/title>
  6032. &lt;/head>
  6033. &lt;body>
  6034. ...</pre>
  6035. <p>Here is an example of a longer one:</p>
  6036. <pre>&lt;!DOCTYPE HTML>
  6037. &lt;HTML>
  6038. &lt;HEAD>
  6039. &lt;META CHARSET="UTF-8">
  6040. &lt;BASE HREF="http://www.example.com/">
  6041. &lt;TITLE>An application with a long head&lt;/TITLE>
  6042. &lt;LINK REL="STYLESHEET" HREF="default.css">
  6043. &lt;LINK REL="STYLESHEET ALTERNATE" HREF="big.css" TITLE="Big Text">
  6044. &lt;SCRIPT SRC="support.js">&lt;/SCRIPT>
  6045. &lt;META NAME="APPLICATION-NAME" CONTENT="Long headed application">
  6046. &lt;/HEAD>
  6047. &lt;BODY>
  6048. ...</pre>
  6049. </div>
  6050. <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
  6051. higher-level protocol provides title information, e.g. in the Subject line of an e-mail when HTML
  6052. 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>
  6053. <h4 id=the-title-element>4.2.2 The <dfn><code>title</code></dfn> element</h4>
  6054. <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>
  6055. <pre class=idl>interface <dfn id=htmltitleelement>HTMLTitleElement</dfn> : <a href=#htmlelement id=the-title-element:htmlelement>HTMLElement</a> {
  6056. attribute DOMString <a href=#dom-title-text id=the-title-element:dom-title-text>text</a>;
  6057. };</pre>
  6058. </dl>
  6059. <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
  6060. should use titles that identify their documents even when they are used out of context, for
  6061. example in a user's history or bookmarks, or in search results. The document's title is often
  6062. different from its first heading, since the first heading does not have to stand alone when taken
  6063. out of context.</p>
  6064. <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>
  6065. <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
  6066. <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
  6067. model for a description of when the element is required.</p>
  6068. <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>
  6069. <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>
  6070. nodes.</p>
  6071. <p>Can be set, to replace the element's children with the given value.</p>
  6072. </dl>
  6073. <p>The IDL attribute <dfn id=dom-title-text><code>text</code></dfn> must return a
  6074. 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
  6075. <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>.
  6076. 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>
  6077. <div class=example>
  6078. <p>Here are some examples of appropriate titles, contrasted with the top-level headings that
  6079. might be used on those same pages.</p>
  6080. <pre> &lt;title>Introduction to The Mating Rituals of Bees&lt;/title>
  6081. ...
  6082. &lt;h1>Introduction&lt;/h1>
  6083. &lt;p>This companion guide to the highly successful
  6084. &lt;cite>Introduction to Medieval Bee-Keeping&lt;/cite> book is...</pre>
  6085. <p>The next page might be a part of the same site. Note how the title describes the subject
  6086. matter unambiguously, while the first heading assumes the reader knows what the context is and
  6087. therefore won't wonder if the dances are Salsa or Waltz:</p>
  6088. <pre> &lt;title>Dances used during bee mating rituals&lt;/title>
  6089. ...
  6090. &lt;h1>The Dances&lt;/h1></pre>
  6091. </div>
  6092. <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>
  6093. <p>User agents should use the document's title when referring to the document in their user
  6094. 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
  6095. 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
  6096. of the document's title in the user interface.</p>
  6097. <h4 id=the-base-element>4.2.3 The <dfn><code>base</code></dfn> element</h4>
  6098. <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>
  6099. <pre class=idl>interface <dfn id=htmlbaseelement>HTMLBaseElement</dfn> : <a href=#htmlelement id=the-base-element:htmlelement>HTMLElement</a> {
  6100. attribute DOMString <a href=#dom-base-href id=the-base-element:dom-base-href>href</a>;
  6101. attribute DOMString <a href=#dom-base-target id=the-base-element:dom-base-target>target</a>;
  6102. };</pre>
  6103. </dl>
  6104. <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
  6105. the purposes of <a href=#resolve-a-url id=the-base-element:resolve-a-url>resolving relative URLs</a>, and the name of the
  6106. 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
  6107. element does not <a href=#represents id=the-base-element:represents>represent</a> any content beyond this
  6108. information.</p>
  6109. <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>
  6110. <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>
  6111. attribute, a <code id=the-base-element:attr-base-target-2><a href=#attr-base-target>target</a></code> attribute, or both.</p>
  6112. <p>The <dfn id=attr-base-href><code>href</code></dfn> content attribute, if specified, must
  6113. 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>
  6114. <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,
  6115. 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>
  6116. elements).</p>
  6117. <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>
  6118. <p>The <dfn id=attr-base-target><code>target</code></dfn> attribute, if specified, must
  6119. 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
  6120. <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
  6121. <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>
  6122. <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>
  6123. attribute, must come before any elements in the tree that represent <a href=#hyperlink id=the-base-element:hyperlink-3>hyperlinks</a>.</p>
  6124. <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>
  6125. <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
  6126. <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>
  6127. <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
  6128. 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
  6129. <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
  6130. 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
  6131. <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
  6132. changed.</ul>
  6133. <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
  6134. 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
  6135. <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
  6136. <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
  6137. <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>
  6138. <p>The <dfn id=dom-base-href><code>href</code></dfn> IDL attribute, on getting, must return
  6139. the result of running the following algorithm:
  6140. <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
  6141. 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
  6142. 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>
  6143. 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
  6144. abort these steps.<li><p>Otherwise, return the empty string.</ol>
  6145. <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>
  6146. <p>The <dfn id=dom-base-target><code>target</code></dfn> IDL attribute must
  6147. <a href=#reflect id=the-base-element:reflect>reflect</a> the content attribute of the same name.</p>
  6148. <div class=example>
  6149. <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
  6150. URL</a>:</p>
  6151. <pre>&lt;!DOCTYPE html>
  6152. &lt;html>
  6153. &lt;head>
  6154. &lt;title>This is an example for the &amp;lt;base&amp;gt; element&lt;/title>
  6155. &lt;base href="http://www.example.com/news/index.html">
  6156. &lt;/head>
  6157. &lt;body>
  6158. &lt;p>Visit the &lt;a href="archives.html">archives&lt;/a>.&lt;/p>
  6159. &lt;/body>
  6160. &lt;/html></pre>
  6161. <p>The link in the above example would be a link to "<code>http://www.example.com/news/archives.html</code>".</p>
  6162. </div>
  6163. <h4 id=the-link-element>4.2.4 The <dfn><code>link</code></dfn> element</h4>
  6164. <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>
  6165. <pre class=idl>interface <dfn id=htmllinkelement>HTMLLinkElement</dfn> : <a href=#htmlelement id=the-link-element:htmlelement>HTMLElement</a> {
  6166. attribute DOMString <a href=#dom-link-href id=the-link-element:dom-link-href>href</a>;
  6167. attribute DOMString? <a href=#dom-link-crossorigin id=the-link-element:dom-link-crossorigin>crossOrigin</a>;
  6168. attribute DOMString <a href=#dom-link-rel id=the-link-element:dom-link-rel>rel</a>;
  6169. 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>;
  6170. attribute DOMString <a href=#dom-link-media id=the-link-element:dom-link-media>media</a>;
  6171. attribute DOMString <a href=#dom-link-hreflang id=the-link-element:dom-link-hreflang>hreflang</a>;
  6172. attribute DOMString <a href=#dom-link-type id=the-link-element:dom-link-type>type</a>;
  6173. [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>;
  6174. // <a href="#HTMLLinkElement-partial">also has obsolete members</a>
  6175. };
  6176. <a href=#htmllinkelement id=the-link-element:htmllinkelement>HTMLLinkElement</a> implements <a href=#linkstyle id=the-link-element:linkstyle>LinkStyle</a>;</pre>
  6177. </dl>
  6178. <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>
  6179. <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
  6180. <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
  6181. link.</p>
  6182. <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
  6183. 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>
  6184. <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
  6185. 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
  6186. <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
  6187. the microdata model.</p>
  6188. <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
  6189. 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
  6190. 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
  6191. used are allowed according to the definitions in this specification, then the element does not
  6192. create any links.</p>
  6193. <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
  6194. 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>
  6195. element can create multiple links (of which some might be external resource links and some might
  6196. be hyperlinks); exactly which and how many links are created depends on the keywords given in the
  6197. <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
  6198. basis, not a per-element basis.</p>
  6199. <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
  6200. 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>,
  6201. they each count as a separate external resource, and each is affected by its own attributes
  6202. 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>,
  6203. 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
  6204. 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>
  6205. 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>)
  6206. differently.</p>
  6207. <div class=example>
  6208. <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
  6209. page):</p>
  6210. <pre>&lt;link rel="author license" href="/about"></pre>
  6211. <p>The two links created by this element are one whose semantic is that the target page has
  6212. information about the current page's author, and one whose semantic is that the target page has
  6213. information regarding the license under which the current page is provided.</p>
  6214. </div>
  6215. <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
  6216. settings attribute</a>. It is intended for use with external resource links.</p>
  6217. <p>The exact behavior for links to external resources depends on the exact relationship, as
  6218. defined for the relevant link type. Some of the attributes control whether or not the external
  6219. resource is to be applied (as defined below).</p>
  6220. <p>For external resources that are represented in the DOM (for example, style sheets), the DOM
  6221. representation must be made available (modulo cross-origin restrictions) even if the resource is
  6222. not applied. To <dfn id=concept-link-obtain>obtain the resource</dfn>, the user agent must
  6223. run the following steps:</p>
  6224. <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,
  6225. 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>
  6226. <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
  6227. 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>
  6228. 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
  6229. <i>default origin behaviour</i> set to <i>taint</i>.</p>
  6230. <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
  6231. <a href=#cors-cross-origin id=the-link-element:cors-cross-origin>CORS-cross-origin</a>.</p>
  6232. </ol>
  6233. <p>User agents may opt to only try to obtain such resources when they are needed, instead of
  6234. pro-actively <a href=#fetch id=the-link-element:fetch>fetching</a> all the external resources that are not
  6235. applied.</p>
  6236. <p>The semantics of the protocol used (e.g. HTTP) must be followed when fetching external
  6237. resources. (For example, redirects will be followed and 404 responses will cause the external
  6238. resource to not be applied.)</p>
  6239. <p>Once the attempts to obtain the resource and its <a href=#critical-subresources id=the-link-element:critical-subresources>critical subresources</a> are
  6240. 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
  6241. <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
  6242. <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>
  6243. failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being
  6244. 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
  6245. 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.
  6246. Non-network errors in processing the resource or its subresources (e.g. CSS parse errors, PNG
  6247. decoding errors) are not failures for the purposes of this paragraph.</p>
  6248. <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
  6249. manipulation task source</a>.</p>
  6250. <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
  6251. attempts to obtain the resource and its <a href=#critical-subresources id=the-link-element:critical-subresources-3>critical subresources</a> are complete.
  6252. (Resources that the user agent has not yet attempted to obtain, e.g. because it is waiting for the
  6253. 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>
  6254. <hr>
  6255. <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
  6256. within their user interface. The exact interface is not defined by this specification, but it
  6257. could include the following information (obtained from the element's attributes, again as defined
  6258. below), in some form or another (possibly simplified), for each hyperlink created with each
  6259. <code id=the-link-element:the-link-element-13><a href=#the-link-element>link</a></code> element in the document:</p>
  6260. <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>
  6261. 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>
  6262. 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>
  6263. 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>
  6264. attribute).</ul>
  6265. <p>User agents could also include other information, such as the type of the resource (as given by
  6266. the <code id=the-link-element:attr-link-type-2><a href=#attr-link-type>type</a></code> attribute).</p>
  6267. <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,
  6268. which indicates the type of a link whose context is given by the link's location within the
  6269. document.</p>
  6270. <p>The <dfn id=attr-link-media><code>media</code></dfn> attribute says which media the
  6271. 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>
  6272. <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>
  6273. attribute is purely advisory, and describes for which media the document in question was
  6274. designed.</p>
  6275. <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
  6276. external resource when the <code id=the-link-element:attr-link-media-6><a href=#attr-link-media>media</a></code> attribute's value
  6277. <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
  6278. it otherwise.</p>
  6279. <p class=note>The external resource might have further restrictions defined within that limit
  6280. its applicability. For example, a CSS style sheet might have some <code>@media</code>
  6281. blocks. This specification does not override such further restrictions or requirements.</p>
  6282. <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
  6283. omitted, is "<code>all</code>", meaning that by default links apply to all media.</p>
  6284. <p>The <dfn id=attr-link-hreflang><code>hreflang</code></dfn> attribute on the
  6285. <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
  6286. <code>area</code> elements</a>.</p>
  6287. <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
  6288. 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
  6289. type</a>.</p>
  6290. <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
  6291. avoid fetching resources they do not support. If the attribute is present, then
  6292. the user agent must assume that the resource is of the given type (even if that is not a
  6293. <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
  6294. external resource link type has a default type defined, then the user agent must assume that the
  6295. 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
  6296. given link relationship, then the UA should not <a href=#concept-link-obtain id=the-link-element:concept-link-obtain>obtain</a>
  6297. 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
  6298. relationship, then the UA should <a href=#concept-link-obtain id=the-link-element:concept-link-obtain-2>obtain</a> the resource at
  6299. 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.
  6300. If the attribute is omitted, and the external resource link type does not have a default type
  6301. defined, but the user agent would <a href=#concept-link-obtain id=the-link-element:concept-link-obtain-3>obtain</a> the resource if
  6302. 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
  6303. supported.</p>
  6304. <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
  6305. 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
  6306. (as defined in the next paragraph) is used to determine whether to <em>apply</em> the resource,
  6307. not the aforementioned assumed type.</p>
  6308. <p id=concept-link-type-sniffing>If the external resource link type defines rules for processing
  6309. the resource's <a href=#content-type id=the-link-element:content-type>Content-Type metadata</a>, then those rules apply.
  6310. 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
  6311. type</var> being the type determined from the resource's <a href=#content-type id=the-link-element:content-type-2>Content-Type
  6312. metadata</a>, and use the resulting sniffed type of the resource as if it was the actual type.
  6313. Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image
  6314. 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
  6315. is no type metadata, but the external resource link type has a default type defined, then the user
  6316. agent must assume that the resource is of that type.</p>
  6317. <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
  6318. processing the resource's <a href=#content-type id=the-link-element:content-type-4>Content-Type metadata</a>.</p>
  6319. <p>Once the user agent has established the type of the resource, the user agent must apply the
  6320. resource if it is of a supported type and the other relevant conditions apply, and must ignore the
  6321. resource otherwise.</p>
  6322. <div class=example>
  6323. <p>If a document contains style sheet links labeled as follows:</p>
  6324. <pre>&lt;link rel="stylesheet" href="A" type="text/plain">
  6325. &lt;link rel="stylesheet" href="B" type="text/css">
  6326. &lt;link rel="stylesheet" href="C"></pre>
  6327. <p>...then a compliant UA that supported only CSS style sheets would fetch the B and C files, and
  6328. 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
  6329. sheets).</p>
  6330. <p>For files B and C, it would then check the actual types returned by the server. For those that
  6331. 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
  6332. <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>
  6333. <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
  6334. syntactically incorrect type like <code>Content-Type: "null"</code>, then the
  6335. 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
  6336. default type is <code>text/css</code>, the style sheet <em>would</em> nonetheless be
  6337. applied.</p>
  6338. </div>
  6339. <p>The <dfn id=attr-link-title><code>title</code></dfn> attribute gives the title of the
  6340. link. With one exception, it is purely advisory. The value is text. The exception is for style
  6341. sheet links, where the <code id=the-link-element:attr-link-title-5><a href=#attr-link-title>title</a></code> attribute defines
  6342. <a href=#alternative-style-sheet-sets id=the-link-element:alternative-style-sheet-sets>alternative style sheet sets</a>.</p>
  6343. <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>
  6344. elements differs from the global <code id=the-link-element:attr-title><a href=#attr-title>title</a></code> attribute of most other
  6345. elements in that a link without a title does not inherit the title of the parent element: it
  6346. merely has no title.</p>
  6347. <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>
  6348. 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
  6349. <code id=the-link-element:rel-icon-3><a href=#rel-icon>icon</a></code> keyword.</p>
  6350. <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>
  6351. <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>,
  6352. 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
  6353. <code id=the-link-element:the-link-element-20><a href=#the-link-element>link</a></code> element.</ol>
  6354. <p>HTTP <code id=the-link-element:http-link><a href=#http-link>Link:</a></code> headers, if supported, must be assumed to come
  6355. before any links in the document, in the order that they were given in the HTTP message. These
  6356. 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>
  6357. <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
  6358. HTML types.</p>
  6359. <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>,
  6360. <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
  6361. content attributes of the same name.</p>
  6362. <p>The <dfn id=dom-link-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
  6363. <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>
  6364. <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>
  6365. <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>
  6366. <div class=example>
  6367. <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>
  6368. <pre>&lt;!-- a persistent style sheet -->
  6369. &lt;link rel="stylesheet" href="default.css">
  6370. &lt;!-- the preferred alternate style sheet -->
  6371. &lt;link rel="stylesheet" href="green.css" title="Green styles">
  6372. &lt;!-- some alternate style sheets -->
  6373. &lt;link rel="alternate stylesheet" href="contrast.css" title="High contrast">
  6374. &lt;link rel="alternate stylesheet" href="big.css" title="Big fonts">
  6375. &lt;link rel="alternate stylesheet" href="wide.css" title="Wide screen"></pre>
  6376. </div>
  6377. <div class=example>
  6378. <p>The following example shows how you can specify versions of the page that use alternative
  6379. formats, are aimed at other languages, and that are intended for other media:</p>
  6380. <pre>&lt;link rel=alternate href="/en/html" hreflang=en type=text/html title="English HTML">
  6381. &lt;link rel=alternate href="/fr/html" hreflang=fr type=text/html title="French HTML">
  6382. &lt;link rel=alternate href="/en/html/print" hreflang=en type=text/html media=print title="English HTML (for printing)">
  6383. &lt;link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)">
  6384. &lt;link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF">
  6385. &lt;link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"></pre>
  6386. </div>
  6387. <h4 id=the-meta-element>4.2.5 The <dfn id=meta><code>meta</code></dfn> element</h4>
  6388. <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>
  6389. <pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement id=the-meta-element:htmlelement>HTMLElement</a> {
  6390. attribute DOMString <a href=#dom-meta-name id=the-meta-element:dom-meta-name>name</a>;
  6391. attribute DOMString <a href=#dom-meta-httpequiv id=the-meta-element:dom-meta-httpequiv>httpEquiv</a>;
  6392. attribute DOMString <a href=#dom-meta-content id=the-meta-element:dom-meta-content>content</a>;
  6393. // <a href="#HTMLMetaElement-partial">also has obsolete members</a>
  6394. };</pre>
  6395. </dl>
  6396. <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
  6397. 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>,
  6398. and <code id=the-meta-element:the-script-element><a href=#the-script-element>script</a></code> elements.</p>
  6399. <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
  6400. declaration</a> when an HTML document is serialised to string form (e.g. for transmission over
  6401. 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>
  6402. attribute.</p>
  6403. <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>,
  6404. 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>
  6405. <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
  6406. specified, then the <code id=the-meta-element:attr-meta-content-2><a href=#attr-meta-content>content</a></code> attribute must also be
  6407. specified. Otherwise, it must be omitted.</p>
  6408. <p>The <dfn id=attr-meta-charset><code>charset</code></dfn> attribute specifies the character
  6409. 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
  6410. attribute is present in an <a href=#xml-documents id=the-meta-element:xml-documents>XML document</a>, its value must be an
  6411. <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
  6412. document is therefore forced to use UTF-8 as its encoding).</p>
  6413. <p class=note>The <code id=the-meta-element:attr-meta-charset-5><a href=#attr-meta-charset>charset</a></code> attribute on the
  6414. <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
  6415. facilitate migration to and from XHTML.</p>
  6416. <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>
  6417. <p>The <dfn id=attr-meta-content><code>content</code></dfn> attribute gives the value of the
  6418. document metadata or pragma directive when the element is used for those purposes. The allowed
  6419. values depend on the exact context, as described in subsequent sections of this specification.</p>
  6420. <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>
  6421. attribute, it sets document metadata. Document metadata is expressed in terms of name-value pairs,
  6422. 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
  6423. 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
  6424. the value. The name specifies what aspect of metadata is being set; valid names and the meaning of
  6425. 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
  6426. pair is the empty string.</p>
  6427. <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
  6428. 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
  6429. attribute <code id=the-meta-element:attr-meta-http-equiv-8><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>
  6430. <h5 id=standard-metadata-names>4.2.5.1 Standard metadata names</h5>
  6431. <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>
  6432. attribute of the <code id=standard-metadata-names:the-meta-element><a href=#the-meta-element>meta</a></code> element.</p>
  6433. <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
  6434. case-insensitive</a> manner</span>.</p>
  6435. <dl><dt><dfn id=meta-application-name><code>application-name</code></dfn><dd>
  6436. <p>The value must be a short free-form string giving the name of the Web application that the
  6437. 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.
  6438. 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>
  6439. <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>
  6440. 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>
  6441. <p>User agents may use the application name in UI in preference to the page's
  6442. <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
  6443. status of the page at a particular moment in time instead of just being the name of the
  6444. application.</p>
  6445. <p>To find the application name to use given an ordered list of languages (e.g. British English,
  6446. American English, and English), user agents must run the following steps:</p>
  6447. <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
  6448. <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>,
  6449. if any, and if that language is not unknown.</p>
  6450. <li><p>If there is a <var>default language</var>, and if it is not the same language
  6451. as any of the languages in <var>languages</var>, append it to <var>languages</var>.<li>
  6452. <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
  6453. <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
  6454. the value <code id=standard-metadata-names:meta-application-name-3><a href=#meta-application-name>application-name</a></code> and whose
  6455. <a href=#language id=standard-metadata-names:language-3>language</a> is the language in question.</p>
  6456. <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;
  6457. there's no given application name.</p>
  6458. <li>
  6459. <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
  6460. 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
  6461. 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>
  6462. </ol>
  6463. <p class=note>This algorithm would be used by a browser when it needs a name for the page, for
  6464. instance, to label a bookmark. The languages it would provide to the algorithm would be the
  6465. user's preferred languages.</p>
  6466. <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
  6467. 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
  6468. appropriate for use in a directory of pages, e.g. in a search engine. There must not be more than
  6469. 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
  6470. 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>
  6471. <p>The value must be a free-form string that identifies one of the software packages used to
  6472. generate the document. This value must not be used on pages whose markup is not generated by
  6473. software, e.g. pages whose markup was written by a user in a text editor.</p>
  6474. <div class=example>
  6475. <p>Here is what a tool called "Frontweaver" could include in its output, in the page's
  6476. <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>
  6477. <pre>&lt;meta name=generator content="Frontweaver 8.2"></pre>
  6478. </div>
  6479. <dt><dfn id=meta-keywords><code>keywords</code></dfn><dd>
  6480. <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
  6481. relevant to the page.</p>
  6482. <div class=example>
  6483. <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
  6484. some keywords that users might use to look for the page:</p>
  6485. <pre>&lt;!DOCTYPE HTML>
  6486. &lt;html>
  6487. &lt;head>
  6488. &lt;title>Typefaces on UK motorways&lt;/title>
  6489. &lt;meta name="keywords" content="british,type face,font,fonts,highway,highways">
  6490. &lt;/head>
  6491. &lt;body>
  6492. ...</pre>
  6493. </div>
  6494. <p class=note>Many search engines do not consider such keywords, because this feature has
  6495. historically been used unreliably and even misleadingly as a way to spam search engine results
  6496. in a way that is not helpful for users.</p>
  6497. <p>To obtain the list of keywords that the author has specified as applicable to the page, the
  6498. user agent must run the following steps:</p>
  6499. <ol><li><p>Let <var>keywords</var> be an empty list.<li>
  6500. <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>
  6501. 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>
  6502. <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>
  6503. <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
  6504. specified as applicable to the page.</ol>
  6505. <p>User agents should not use this information when there is insufficient confidence in the
  6506. reliability of the value.</p>
  6507. <p class=example>For instance, it would be reasonable for a content management system to use
  6508. the keyword information of pages within the system to populate the index of a site-specific
  6509. search engine, but a large-scale content aggregator that used this information would likely find
  6510. that certain users would try to game its ranking mechanism through the use of inappropriate
  6511. keywords.</p>
  6512. </dl>
  6513. <h5 id=other-metadata-names>4.2.5.2 Other metadata names</h5>
  6514. <p><dfn id=concept-meta-extensions>Extensions to the predefined set of metadata names</dfn>
  6515. may be registered in the <a href=http://wiki.whatwg.org/wiki/MetaExtensions>WHATWG Wiki
  6516. MetaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
  6517. <p>Anyone is free to edit the WHATWG Wiki MetaExtensions page at any time to add a type. These new
  6518. names must be specified with the following information:</p>
  6519. <dl><dt>Keyword<dd><p>The actual name being defined. The name should not be confusingly similar to any other
  6520. 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
  6521. 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
  6522. 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
  6523. not use the names defined to be synonyms, they are only intended to allow user agents to support
  6524. legacy content. Anyone may remove synonyms that are not used in practice; only names that need to
  6525. be processed as synonyms for compatibility with legacy content are to be registered in this
  6526. way.<dt>Status<dd>
  6527. <p>One of the following:</p>
  6528. <dl><dt>Proposed<dd>The name has not received wide peer review and approval. Someone has proposed it and is, or
  6529. soon will be, using it.<dt>Ratified<dd>The name has received wide peer review and approval. It has a specification that
  6530. unambiguously defines how to handle pages that use the name, including when they use it in
  6531. incorrect ways.<dt>Discontinued<dd>The metadata name has received wide peer review and it has been found wanting. Existing
  6532. pages are using this metadata name, but new pages should avoid it. The "brief description" and
  6533. "specification" entries will give details of what authors should use instead, if anything.</dl>
  6534. <p>If a metadata name is found to be redundant with existing values, it should be removed and
  6535. listed as a synonym for the existing value.</p>
  6536. <p>If a metadata name is registered in the "proposed" state for a period of a month or more
  6537. without being used or specified, then it may be removed from the registry.</p>
  6538. <p>If a metadata name is added with the "proposed" status and found to be redundant with
  6539. existing values, it should be removed and listed as a synonym for the existing value. If a
  6540. metadata name is added with the "proposed" status and found to be harmful, then it should be
  6541. changed to "discontinued" status.</p>
  6542. <p>Anyone can change the status at any time, but should only do so in accordance with the
  6543. definitions above.</p>
  6544. </dl>
  6545. <p>Conformance checkers must use the information given on the WHATWG Wiki MetaExtensions page to
  6546. establish if a value is allowed or not: values defined in this specification or marked as
  6547. "proposed" or "ratified" must be accepted, whereas values marked as "discontinued" or not listed
  6548. in either this specification or on the aforementioned page must be rejected as invalid.
  6549. Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use
  6550. of unreliable network connectivity).</p>
  6551. <p>When an author uses a new metadata name not defined by either this specification or the Wiki
  6552. page, conformance checkers should offer to add the value to the Wiki, with the details described
  6553. above, with the "proposed" status.</p>
  6554. <p>Metadata names whose values are to be <a href=#url id=other-metadata-names:url>URLs</a> must not be proposed or
  6555. 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>
  6556. element.</p>
  6557. <h5 id=pragma-directives>4.2.5.3 Pragma directives</h5>
  6558. <p>When the <dfn id=attr-meta-http-equiv><code>http-equiv</code></dfn> attribute is specified
  6559. 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>
  6560. <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
  6561. attribute</a>. The following table lists the keywords defined for this attribute. The states
  6562. given in the first cell of the rows with keywords give the states to which those keywords map.
  6563. Some of the keywords are non-conforming, as noted in the last
  6564. column.</p>
  6565. <table id=table-http-equiv><thead><tr><th>State
  6566. <th>Keyword
  6567. <th>Notes
  6568. <tbody><tr><td><a href=#attr-meta-http-equiv-content-language id=pragma-directives:attr-meta-http-equiv-content-language>Content Language</a>
  6569. <td><code>content-language</code>
  6570. <td>Non-conforming
  6571. <tr><td><a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type>Encoding declaration</a>
  6572. <td><code>content-type</code>
  6573. <td>
  6574. <tr><td><a href=#attr-meta-http-equiv-default-style id=pragma-directives:attr-meta-http-equiv-default-style>Default style</a>
  6575. <td><code>default-style</code>
  6576. <td>
  6577. <tr><td><a href=#attr-meta-http-equiv-refresh id=pragma-directives:attr-meta-http-equiv-refresh>Refresh</a>
  6578. <td><code>refresh</code>
  6579. <td>
  6580. <tr><td><a href=#attr-meta-http-equiv-set-cookie id=pragma-directives:attr-meta-http-equiv-set-cookie>Cookie setter</a>
  6581. <td><code>set-cookie</code>
  6582. <td>Non-conforming
  6583. </table>
  6584. <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
  6585. 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
  6586. present and represents one of the above states, then the user agent must run the algorithm
  6587. appropriate for that state, as described in the following list:</p>
  6588. <dl><dt><dfn id=attr-meta-http-equiv-content-language>Content language state</dfn>
  6589. (<code>http-equiv="content-language"</code>)
  6590. <dd>
  6591. <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>
  6592. <p>This pragma sets the <dfn id=pragma-set-default-language>pragma-set default language</dfn>. Until such a pragma is
  6593. successfully processed, there is no <a href=#pragma-set-default-language id=pragma-directives:pragma-set-default-language>pragma-set default language</a>.</p>
  6594. <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>
  6595. 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
  6596. 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
  6597. step.<li><p>If <var>candidate</var> is the empty string, abort these steps.<li>
  6598. <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>
  6599. <p class=note>If the value consists of multiple space-separated tokens, tokens after the
  6600. first are ignored.</p>
  6601. </ol>
  6602. <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>
  6603. <dt><dfn id=attr-meta-http-equiv-content-type>Encoding declaration state</dfn> (<code>http-equiv="content-type"</code>)
  6604. <dd>
  6605. <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
  6606. just an alternative form of setting the <code id=pragma-directives:attr-meta-charset><a href=#attr-meta-charset>charset</a></code>
  6607. attribute: it is a <a href=#character-encoding-declaration id=pragma-directives:character-encoding-declaration>character encoding declaration</a>. This state's user
  6608. agent requirements are all handled by the parsing section of the specification.</p>
  6609. <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>
  6610. attribute in the <a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type-3>Encoding declaration
  6611. state</a>, the <code id=pragma-directives:attr-meta-content-4><a href=#attr-meta-content>content</a></code> attribute must have a value
  6612. 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
  6613. 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
  6614. 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
  6615. declaration</a>.</p>
  6616. <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
  6617. <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
  6618. present.</p>
  6619. <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
  6620. 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
  6621. <a href=#xml-documents id=pragma-directives:xml-documents>XML documents</a>.</p>
  6622. <dt><dfn id=attr-meta-http-equiv-default-style>Default style state</dfn> (<code>http-equiv="default-style"</code>)
  6623. <dd>
  6624. <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>
  6625. <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>
  6626. 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>
  6627. <dt><dfn id=attr-meta-http-equiv-refresh>Refresh state</dfn> (<code>http-equiv="refresh"</code>)
  6628. <dd>
  6629. <p>This pragma acts as timed redirect.</p>
  6630. <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
  6631. processed (i.e. when it was inserted the user agent processed it and reached the last step of
  6632. 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>
  6633. 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
  6634. 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
  6635. the sequence of characters collected is the empty string, then no number will have been parsed;
  6636. 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
  6637. 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>
  6638. 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>
  6639. is a U+0055 LATIN CAPITAL LETTER U character (U) or a U+0075 LATIN SMALL LETTER U character
  6640. (u), then advance <var>position</var> to the next character. Otherwise, jump to the
  6641. last step.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
  6642. is a U+0052 LATIN CAPITAL LETTER R character (R) or a U+0072 LATIN SMALL LETTER R character
  6643. (r), then advance <var>position</var> to the next character. Otherwise, jump to the
  6644. last step.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
  6645. is s U+004C LATIN CAPITAL LETTER L character (L) or a U+006C LATIN SMALL LETTER L character
  6646. (l), then advance <var>position</var> to the next character. Otherwise, jump to the
  6647. 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>
  6648. is a U+003D EQUALS SIGN (=), then advance <var>position</var> to the next character.
  6649. 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>
  6650. is either a U+0027 APOSTROPHE character (') or U+0022 QUOTATION MARK character ("), then let
  6651. <var>quote</var> be that character, and advance <var>position</var> to the
  6652. 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
  6653. 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
  6654. that character, so that it and all subsequent characters are removed.</p>
  6655. <li><p>Strip any trailing <a href=#space-character id=pragma-directives:space-character-3>space characters</a> from the end of
  6656. <var>url</var>.<li><p>Strip any U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), and U+000D CARRIAGE
  6657. 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
  6658. <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
  6659. these steps.<li>
  6660. <p>Perform one or more of the following steps:</p>
  6661. <ul><li>
  6662. <p>After the refresh has come due (as defined below), if the user has not canceled the
  6663. 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
  6664. 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
  6665. context flag</a> set, <a href=#navigate id=pragma-directives:navigate>navigate</a> the
  6666. <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
  6667. <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
  6668. context</a> as the <a href=#source-browsing-context id=pragma-directives:source-browsing-context>source browsing context</a>.</p>
  6669. <p>For the purposes of the previous paragraph, a refresh is said to have come due as soon as
  6670. the <em>later</em> of the following two conditions occurs:</p>
  6671. <ul><li>At least <var>time</var> seconds have elapsed since the document has
  6672. <a href=#completely-loaded id=pragma-directives:completely-loaded>completely loaded</a>, adjusted to take into account user or user agent
  6673. 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>
  6674. element was <a href=#insert-an-element-into-a-document id=pragma-directives:insert-an-element-into-a-document-2>inserted into the
  6675. <code>Document</code></a>, adjusted to take into account user or user agent
  6676. preferences.</ul>
  6677. <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
  6678. <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
  6679. the <a href=#source-browsing-context id=pragma-directives:source-browsing-context-2>source browsing context</a>.<li><p>Do nothing.</ul>
  6680. <p>In addition, the user agent may, as with anything, inform the user of any and all aspects
  6681. of its operation, including the state of any timers, the destinations of any timed redirects,
  6682. and so forth.</p>
  6683. </ol>
  6684. <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>
  6685. 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>
  6686. <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
  6687. (;), followed by one or more <a href=#space-character id=pragma-directives:space-character-4>space characters</a>, followed
  6688. 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
  6689. URL</a> that does not start with a literal U+0027 APOSTROPHE (') or U+0022 QUOTATION MARK
  6690. (") character.</ul>
  6691. <p>In the former case, the integer represents a number of seconds before the page is to be
  6692. reloaded; in the latter case the integer represents a number of seconds before the page is to be
  6693. replaced by the page at the given <a href=#url id=pragma-directives:url>URL</a>.</p>
  6694. <div class=example>
  6695. <p>A news organization's front page could include the following markup in the page's
  6696. <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
  6697. five minutes:</p>
  6698. <pre>&lt;meta http-equiv="Refresh" content="300"></pre>
  6699. </div>
  6700. <div class=example>
  6701. <p>A sequence of pages could be used as an automated slide show by making each page refresh to
  6702. the next page in the sequence, using markup such as the following:</p>
  6703. <pre>&lt;meta http-equiv="Refresh" content="20; URL=page4.html"></pre>
  6704. </div>
  6705. <dt><dfn id=attr-meta-http-equiv-set-cookie>Cookie setter</dfn> (<code>http-equiv="set-cookie"</code>)
  6706. <dd>
  6707. <p>This pragma sets an HTTP cookie. <a href=#refsCOOKIES>[COOKIES]</a></p>
  6708. <p>It is non-conforming. Real HTTP headers should be used instead.</p>
  6709. <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>
  6710. 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
  6711. 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,
  6712. consisting of the value of the element's <code id=pragma-directives:attr-meta-content-11><a href=#attr-meta-content>content</a></code>
  6713. attribute encoded as UTF-8. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsENCODING>[ENCODING]</a></ol>
  6714. </dl>
  6715. <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
  6716. document at a time.</p>
  6717. <h5 id=other-pragma-directives>4.2.5.4 Other pragma directives</h5>
  6718. <p><dfn id=concept-http-equiv-extensions>Extensions to the predefined set of pragma
  6719. 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>
  6720. <p>Such extensions must use a name that is identical to an HTTP header registered in the Permanent
  6721. Message Header Field Registry, and must have behavior identical to that described for the HTTP
  6722. header. <a href=#refsIANAPERMHEADERS>[IANAPERMHEADERS]</a></p>
  6723. <p>Pragma directives corresponding to headers describing metadata, or not requiring specific user
  6724. 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
  6725. that affect the HTTP processing model (e.g. caching) must not be registered, as they would result
  6726. in HTTP-level behavior being different for user agents that implement HTML than for user agents
  6727. that do not.</p>
  6728. <p>Anyone is free to edit the WHATWG Wiki PragmaExtensions page at any time to add a pragma
  6729. directive satisfying these conditions. Such registrations must specify the following
  6730. information:</p>
  6731. <dl><dt>Keyword<dd><p>The actual name being defined. The name must match a previously-registered HTTP name with
  6732. 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>
  6733. <p>Conformance checkers must use the information given on the WHATWG Wiki PragmaExtensions page to
  6734. establish if a value is allowed or not: values defined in this specification or listed on the
  6735. aforementioned page must be accepted, whereas values not listed in either this specification or on
  6736. the aforementioned page must be rejected as invalid. Conformance checkers may cache this
  6737. information (e.g. for performance reasons or to avoid the use of unreliable network
  6738. connectivity).</p>
  6739. <h5 id=charset>4.2.5.5 Specifying the document's character encoding</h5>
  6740. <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>
  6741. <p>The following restrictions apply to <a href=#character-encoding-declaration id=charset:character-encoding-declaration>character
  6742. encoding declarations</a>:</p>
  6743. <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
  6744. one of the <a href=#encoding-label id=charset:encoding-label>labels</a> of the <a href=#encoding id=charset:encoding-2>character
  6745. 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
  6746. declaration must be serialised completely within the first 1024 bytes of the
  6747. document.</span></ul>
  6748. <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
  6749. one <code id=charset:the-meta-element-2><a href=#the-meta-element>meta</a></code>-based character encoding declaration per document.</p>
  6750. <p>If an <a href=#html-documents id=charset:html-documents>HTML document</a> does not start with a BOM, and its
  6751. <a href=#encoding id=charset:encoding-3>encoding</a> is not explicitly given by <a href=#content-type id=charset:content-type>Content-Type
  6752. 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
  6753. 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
  6754. <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
  6755. <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
  6756. in the <a href=#attr-meta-http-equiv-content-type id=charset:attr-meta-http-equiv-content-type>Encoding declaration state</a>.</p>
  6757. <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
  6758. is US-ASCII, because a character encoding is needed to process non-ASCII characters entered by the
  6759. user in forms, in URLs generated by scripts, and so forth.</p>
  6760. <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>
  6761. document</a>, the document must not have a <a href=#character-encoding-declaration id=charset:character-encoding-declaration-2>character encoding declaration</a>. (In
  6762. this case, the source is already decoded, since it is part of the document that contained the
  6763. <code id=charset:the-iframe-element><a href=#the-iframe-element>iframe</a></code>.)</p>
  6764. <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
  6765. 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
  6766. 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
  6767. encoding used must be an <a href=#ascii-compatible-character-encoding id=charset:ascii-compatible-character-encoding-2>ASCII-compatible character encoding</a>.</p>
  6768. <p>Authors should use UTF-8. Conformance checkers may advise authors against using legacy
  6769. encodings. <a href=#refsENCODING>[ENCODING]</a></p>
  6770. <p>Authoring tools should default to using UTF-8 for newly-created documents. <a href=#refsENCODING>[ENCODING]</a></p>
  6771. <p>Encodings in which a series of bytes in the range 0x20 to 0x7E can encode characters other than
  6772. the corresponding characters in the range U+0020 to U+007E represent a potential security
  6773. vulnerability: a user agent that does not support the encoding (or does not support the label used
  6774. to declare the encoding, or does not use the same mechanism to detect the encoding of unlabeled
  6775. content as another user agent) might end up interpreting technically benign plain text content as
  6776. HTML tags and JavaScript. Authors should therefore not use these encodings. For example, this
  6777. applies to encodings in which the bytes corresponding to "<code>&lt;script></code>" in
  6778. ASCII can encode a different string. Authors should not use such encodings, which are known to
  6779. include JIS_C6226-1983, JIS_X0212-1990,
  6780. HZ-GB-2312, JOHAB (Windows code page 1361), encodings based on
  6781. ISO-2022, and encodings
  6782. based on EBCDIC. Furthermore, authors must not use the CESU-8, UTF-7, BOCU-1 and SCSU encodings,
  6783. which also fall into this category; these encodings were never intended for use for Web content.
  6784. <a href=#refsRFC1345>[RFC1345]</a>
  6785. <a href=#refsRFC1842>[RFC1842]</a>
  6786. <a href=#refsRFC1468>[RFC1468]</a>
  6787. <a href=#refsRFC2237>[RFC2237]</a>
  6788. <a href=#refsRFC1554>[RFC1554]</a>
  6789. <a href=#refsCP50220>[CP50220]</a>
  6790. <a href=#refsRFC1922>[RFC1922]</a>
  6791. <a href=#refsRFC1557>[RFC1557]</a>
  6792. <a href=#refsCESU8>[CESU8]</a>
  6793. <a href=#refsUTF7>[UTF7]</a>
  6794. <a href=#refsBOCU1>[BOCU1]</a>
  6795. <a href=#refsSCSU>[SCSU]</a>
  6796. </p>
  6797. <p>Authors should not use UTF-32, as the encoding detection algorithms described in this
  6798. specification intentionally do not distinguish it from UTF-16. <a href=#refsUNICODE>[UNICODE]</a></p>
  6799. <p class=note>Using non-UTF-8 encodings can have unexpected results on form submission and URL
  6800. encodings, which use the <a href="#document's-character-encoding" id="charset:document's-character-encoding">document's character encoding</a> by default.</p>
  6801. <p>In XHTML, the XML declaration should be used for inline character encoding information, if
  6802. necessary.</p>
  6803. <div class=example>
  6804. <p>In HTML, to declare that the character encoding is UTF-8, the author could include the
  6805. 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>
  6806. <pre>&lt;meta charset="utf-8"></pre>
  6807. <p>In XML, the XML declaration would be used instead, at the very top of the markup:</p>
  6808. <pre>&lt;?xml version="1.0" encoding="utf-8"?></pre>
  6809. </div>
  6810. <h4 id=the-style-element>4.2.6 The <dfn><code>style</code></dfn> element</h4>
  6811. <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>
  6812. <pre class=idl>interface <dfn id=htmlstyleelement>HTMLStyleElement</dfn> : <a href=#htmlelement id=the-style-element:htmlelement>HTMLElement</a> {
  6813. attribute DOMString <a href=#dom-style-media id=the-style-element:dom-style-media>media</a>;
  6814. attribute DOMString <a href=#dom-style-type id=the-style-element:dom-style-type>type</a>;
  6815. attribute boolean <a href=#dom-style-scoped id=the-style-element:dom-style-scoped>scoped</a>;
  6816. };
  6817. <a href=#htmlstyleelement id=the-style-element:htmlstyleelement>HTMLStyleElement</a> implements <a href=#linkstyle id=the-style-element:linkstyle>LinkStyle</a>;</pre>
  6818. </dl>
  6819. <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.
  6820. 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
  6821. model. The element does not <a href=#represents id=the-style-element:represents>represent</a> content for the
  6822. user.</p>
  6823. <p>The <dfn id=attr-style-type><code>type</code></dfn> attribute gives the styling language.
  6824. 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
  6825. styling language. The <code>charset</code> parameter must not be specified. The default
  6826. 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
  6827. is absent, is "<code>text/css</code>". <a href=#refsRFC2318>[RFC2318]</a></p>
  6828. <p>When examining types
  6829. to determine if they support the language, user agents must not ignore unknown MIME parameters
  6830. — 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
  6831. comparing <a href=#mime-type id=the-style-element:mime-type>MIME types</a> here.</p>
  6832. <p>The <dfn id=attr-style-media><code>media</code></dfn> attribute says which media the
  6833. 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
  6834. 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
  6835. 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
  6836. apply them otherwise.</p>
  6837. <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
  6838. requirements.</p>
  6839. <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>
  6840. attribute is omitted, is "<code>all</code>", meaning that by default styles apply to all
  6841. media.</p>
  6842. <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
  6843. attribute</a>. If present, it indicates that the styles are intended just for the subtree
  6844. 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
  6845. <code id=the-style-element:document><a href=#document>Document</a></code>.</p>
  6846. <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
  6847. 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
  6848. 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>
  6849. elements, and the parent element's content model must not have a <a href=#transparent id=the-style-element:transparent-2>transparent</a>
  6850. component.</p>
  6851. <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.,
  6852. <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>
  6853. containers.</p>
  6854. <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
  6855. <code id=the-style-element:the-head-element-2><a href=#the-head-element>head</a></code> of the document.</p>
  6856. <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
  6857. <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
  6858. element. <a href=#refsCSSSCOPED>[CSSSCOPED]</a></p>
  6859. <p id=title-on-style>The <dfn id=attr-style-title><code>title</code></dfn> attribute on
  6860. <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
  6861. <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
  6862. 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
  6863. 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>
  6864. <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>
  6865. 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>
  6866. elements, differs from the global <code id=the-style-element:attr-title-2><a href=#attr-title>title</a></code> attribute in that a
  6867. <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
  6868. merely has no title.</p>
  6869. <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>
  6870. <pre>style = no-c-start *( c-start no-c-end c-end no-c-start )
  6871. no-c-start = &lt; any string that doesn't contain a substring that matches c-start >
  6872. c-start = "&lt;!--"
  6873. no-c-end = &lt; any string that doesn't contain a substring that matches c-end >
  6874. c-end = "-->"</pre>
  6875. <hr>
  6876. <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
  6877. a <a href=#browsing-context id=the-style-element:browsing-context>browsing context</a>:</p>
  6878. <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
  6879. parser</a> or <a href=#xml-parser id=the-style-element:xml-parser>XML parser</a>,
  6880. <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>
  6881. 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>,
  6882. <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>
  6883. 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,
  6884. </ul>
  6885. <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>
  6886. 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
  6887. data</dfn>.</p>
  6888. <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>
  6889. element's <a href=#style-data id=the-style-element:style-data>style data</a> is the concatenation of the contents of all the
  6890. <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
  6891. 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
  6892. <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>
  6893. <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
  6894. as follows:</p>
  6895. <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
  6896. these steps.<li>
  6897. <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>
  6898. <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>
  6899. <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>
  6900. <p class=note>This is a reference to the (possibly absent at this time) attribute, rather
  6901. than a copy of the attribute's current value. The CSSOM specification defines what happens
  6902. when the attribute is dynamically set, changed, or removed.</p>
  6903. <dt><a href=#concept-css-style-sheet-title id=the-style-element:concept-css-style-sheet-title>title</a><dd>
  6904. <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>
  6905. <p class=note>Again, this is a <em>reference</em> to the attribute.</p>
  6906. <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>
  6907. </ol>
  6908. <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>
  6909. <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
  6910. 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
  6911. has been parsed and processed, the user agent must, if the loads were successful or there were
  6912. 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
  6913. <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
  6914. 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
  6915. 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
  6916. 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
  6917. subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of
  6918. this paragraph.</p>
  6919. <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
  6920. manipulation task source</a>.</p>
  6921. <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
  6922. 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>
  6923. <p class=note>This specification does not specify a style system, but CSS is expected to be
  6924. supported by most Web browsers. <a href=#refsCSS>[CSS]</a></p>
  6925. <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
  6926. respective content attributes of the same name.</p>
  6927. <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>
  6928. <div class=example>
  6929. <p>The following document has its stress emphasis styled as bright red text rather than italics
  6930. text, while leaving titles of works and Latin words in their default italics. It shows how using
  6931. appropriate elements enables easier restyling of documents.</p>
  6932. <pre>&lt;!DOCTYPE html>
  6933. &lt;html lang="en-US">
  6934. &lt;head>
  6935. &lt;title>My favorite book&lt;/title>
  6936. &lt;style>
  6937. body { color: black; background: white; }
  6938. em { font-style: normal; color: red; }
  6939. &lt;/style>
  6940. &lt;/head>
  6941. &lt;body>
  6942. &lt;p>My &lt;em>favorite&lt;/em> book of all time has &lt;em>got&lt;/em> to be
  6943. &lt;cite>A Cat's Life&lt;/cite>. It is a book by P. Rahmel that talks
  6944. about the &lt;i lang="la">Felis Catus&lt;/i> in modern human society.&lt;/p>
  6945. &lt;/body>
  6946. &lt;/html></pre>
  6947. </div>
  6948. <h4 id=interactions-of-styling-and-scripting>4.2.7 Interactions of styling and scripting</h4>
  6949. <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
  6950. <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>&lt;?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
  6951. some other mechanism, have a <dfn id=style-sheet-ready>style sheet ready</dfn> flag, which is initially unset.</p>
  6952. <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.
  6953. If the style sheet referenced no other resources (e.g. it was an internal style sheet given by a
  6954. <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
  6955. be synchronously made available to script; otherwise, the style rules must only be made available
  6956. 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>
  6957. <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
  6958. <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
  6959. 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
  6960. <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
  6961. model</a> when the element was created by the parser, and the element's style sheet was enabled
  6962. 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
  6963. 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
  6964. <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
  6965. up on that particular style sheet yet. A user agent may give up on a style sheet at any time.</p>
  6966. <p class=note>Giving up on a style sheet before the style sheet loads, if the style sheet
  6967. eventually does still load, means that the script might end up operating with incorrect
  6968. information. For example, if a style sheet sets the colour of an element to green, but a script
  6969. that inspects the resulting style is executed before the sheet is loaded, the script will find
  6970. that the element is black (or whatever the default colour is), and might thus make poor choices
  6971. (e.g. deciding to use black as the colour elsewhere on the page, instead of green). Implementors
  6972. have to balance the likelihood of a script using incorrect information with the performance impact
  6973. of doing nothing while waiting for a slow network request to finish.</p>
  6974. <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
  6975. 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
  6976. <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
  6977. 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
  6978. <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
  6979. scripts</a>.</p>
  6980. <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
  6981. <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
  6982. scripts</a> as defined in the previous paragraph.</p>
  6983. <h3 id=sections>4.3 Sections</h3>
  6984. <h4 id=the-body-element>4.3.1 The <dfn><code>body</code></dfn> element</h4>
  6985. <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
  6986. 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
  6987. <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
  6988. 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>,
  6989. <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
  6990. <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>
  6991. <pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement id=the-body-element:htmlelement>HTMLElement</a> {
  6992. // <a href="#HTMLBodyElement-partial">also has obsolete members</a>
  6993. };
  6994. <a href=#htmlbodyelement id=the-body-element:htmlbodyelement>HTMLBodyElement</a> implements <a href=#windoweventhandlers id=the-body-element:windoweventhandlers>WindowEventHandlers</a>;</pre>
  6995. </dl>
  6996. <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>
  6997. <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
  6998. a document's <code id=the-body-element:the-body-element-8><a href=#the-body-element>body</a></code> element.</p>
  6999. <p class=note>Some DOM operations (for example, parts of the <a href=#dnd id=the-body-element:dnd>drag and drop</a> model)
  7000. 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
  7001. 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>
  7002. <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
  7003. 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
  7004. <a href=#event-handler-idl-attributes id=the-body-element:event-handler-idl-attributes>event handler IDL attributes</a>.</p>
  7005. <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>,
  7006. <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>
  7007. <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>
  7008. 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
  7009. <a href=#html-elements id=the-body-element:html-elements>HTML elements</a>.</p>
  7010. <p class=example>Thus, for example, a bubbling <code id=the-body-element:event-error><a href=#event-error>error</a></code> event
  7011. 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
  7012. 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
  7013. 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
  7014. <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
  7015. <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
  7016. <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
  7017. <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
  7018. <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
  7019. 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>,
  7020. 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
  7021. the <code id=the-body-element:window-5><a href=#window>Window</a></code> object.</p>
  7022. <div class=example>
  7023. <p>This page updates an indicator to show whether or not the user is online:</p>
  7024. <pre>&lt;!DOCTYPE HTML>
  7025. &lt;html>
  7026. &lt;head>
  7027. &lt;title>Online or offline?&lt;/title>
  7028. &lt;script>
  7029. function update(online) {
  7030. document.getElementById('status').textContent =
  7031. online ? 'Online' : 'Offline';
  7032. }
  7033. &lt;/script>
  7034. &lt;/head>
  7035. &lt;body ononline="update(true)"
  7036. onoffline="update(false)"
  7037. onload="update(navigator.onLine)">
  7038. &lt;p>You are: &lt;span id="status">(Unknown)&lt;/span>&lt;/p>
  7039. &lt;/body>
  7040. &lt;/html></pre>
  7041. </div>
  7042. <h4 id=the-article-element>4.3.2 The <dfn><code>article</code></dfn> element</h4>
  7043. <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>
  7044. <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,
  7045. composition in a document, page, application, or site and that is, in principle, independently
  7046. distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or
  7047. newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any
  7048. other independent item of content.</p>
  7049. <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
  7050. represent articles that are in principle related to the contents of the outer article. For
  7051. instance, a blog entry on a site that accepts user-submitted comments could represent the comments
  7052. 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
  7053. entry.</p>
  7054. <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
  7055. <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>
  7056. <p class=note>When used specifically with content to be redistributed in syndication, the
  7057. <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
  7058. Atom. <a href=#refsATOM>[ATOM]</a>
  7059. <p class=note>The schema.org microdata vocabulary can be used to provide the publication date
  7060. 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>
  7061. <p>When the main content of the page (i.e. excluding footers, headers, navigation blocks, and
  7062. sidebars) is all one single self-contained composition, that content may be marked with an
  7063. <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
  7064. the page is a single composition, as it is a single document).</p>
  7065. <div id=article-example class=example>
  7066. <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
  7067. annotations:</p>
  7068. <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting">
  7069. &lt;header>
  7070. &lt;h1 itemprop="headline">The Very First Rule of Life&lt;/h1>
  7071. &lt;p>&lt;time itemprop="datePublished" datetime="2009-10-09">3 days ago&lt;/time>&lt;/p>
  7072. &lt;link itemprop="url" href="?comments=0">
  7073. &lt;/header>
  7074. &lt;p>If there's a microphone anywhere near you, assume it's hot and
  7075. sending whatever you're saying to the world. Seriously.&lt;/p>
  7076. &lt;p><em>...</em>&lt;/p>
  7077. &lt;footer>
  7078. &lt;a itemprop="discussionUrl" href="?comments=1">Show comments...&lt;/a>
  7079. &lt;/footer>
  7080. &lt;/article></pre>
  7081. <p>Here is that same blog post, but showing some of the comments:</p>
  7082. <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting">
  7083. &lt;header>
  7084. &lt;h1 itemprop="headline">The Very First Rule of Life&lt;/h1>
  7085. &lt;p>&lt;time itemprop="datePublished" datetime="2009-10-09">3 days ago&lt;/time>&lt;/p>
  7086. &lt;link itemprop="url" href="?comments=0">
  7087. &lt;/header>
  7088. &lt;p>If there's a microphone anywhere near you, assume it's hot and
  7089. sending whatever you're saying to the world. Seriously.&lt;/p>
  7090. &lt;p><em>...</em>&lt;/p>
  7091. &lt;section>
  7092. &lt;h1>Comments&lt;/h1>
  7093. &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
  7094. &lt;link itemprop="url" href="#c1">
  7095. &lt;footer>
  7096. &lt;p>Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person">
  7097. &lt;span itemprop="name">George Washington&lt;/span>
  7098. &lt;/span>&lt;/p>
  7099. &lt;p>&lt;time itemprop="commentTime" datetime="2009-10-10">15 minutes ago&lt;/time>&lt;/p>
  7100. &lt;/footer>
  7101. &lt;p>Yeah! Especially when talking about your lobbyist friends!&lt;/p>
  7102. &lt;/article>
  7103. &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
  7104. &lt;link itemprop="url" href="#c2">
  7105. &lt;footer>
  7106. &lt;p>Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person">
  7107. &lt;span itemprop="name">George Hammond&lt;/span>
  7108. &lt;/span>&lt;/p>
  7109. &lt;p>&lt;time itemprop="commentTime" datetime="2009-10-10">5 minutes ago&lt;/time>&lt;/p>
  7110. &lt;/footer>
  7111. &lt;p>Hey, you have the same first name as me.&lt;/p>
  7112. &lt;/article>
  7113. &lt;/section>
  7114. &lt;/article></pre>
  7115. <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
  7116. 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
  7117. 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
  7118. be wrong either; it's mostly a matter of authoring preference.)</p>
  7119. </div>
  7120. <h4 id=the-section-element>4.3.3 The <dfn><code>section</code></dfn> element</h4>
  7121. <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>
  7122. <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
  7123. application. A section, in this context, is a thematic grouping of content, typically with a
  7124. heading.</p>
  7125. <p class=example>Examples of sections would be chapters, the various tabbed pages in a tabbed
  7126. dialog box, or the numbered sections of a thesis. A Web site's home page could be split into
  7127. sections for an introduction, news items, and contact information.</p>
  7128. <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
  7129. <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
  7130. element.</p>
  7131. <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
  7132. container element. When an element is needed only for styling purposes or as a convenience for
  7133. 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
  7134. 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
  7135. listed explicitly in the document's <a href=#outline id=the-section-element:outline>outline</a>.</p>
  7136. <div class=example>
  7137. <p>In the following example, we see an article (part of a larger Web page) about apples,
  7138. containing two short sections.</p>
  7139. <pre>&lt;article>
  7140. &lt;hgroup>
  7141. &lt;h1>Apples&lt;/h1>
  7142. &lt;h2>Tasty, delicious fruit!&lt;/h2>
  7143. &lt;/hgroup>
  7144. &lt;p>The apple is the pomaceous fruit of the apple tree.&lt;/p>
  7145. &lt;section>
  7146. &lt;h1>Red Delicious&lt;/h1>
  7147. &lt;p>These bright red apples are the most common found in many
  7148. supermarkets.&lt;/p>
  7149. &lt;/section>
  7150. &lt;section>
  7151. &lt;h1>Granny Smith&lt;/h1>
  7152. &lt;p>These juicy, green apples make a great filling for
  7153. apple pies.&lt;/p>
  7154. &lt;/section>
  7155. &lt;/article></pre>
  7156. <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>
  7157. elements throughout, without having to worry about whether a particular section is at the top
  7158. level, the second level, the third level, and so on.</p>
  7159. </div>
  7160. <div class=example>
  7161. <p>Here is a graduation programme with two sections, one for the list of people graduating, and
  7162. one for the description of the ceremony. (The markup in this example features an uncommon style
  7163. sometimes used to minimise the amount of <a href=#inter-element-whitespace id=the-section-element:inter-element-whitespace>inter-element whitespace</a>.)</p>
  7164. <pre>&lt;!DOCTYPE Html>
  7165. &lt;Html
  7166. >&lt;Head
  7167. >&lt;Title
  7168. >Graduation Ceremony Summer 2022&lt;/Title
  7169. >&lt;/Head
  7170. >&lt;Body
  7171. >&lt;H1
  7172. >Graduation&lt;/H1
  7173. >&lt;Section
  7174. >&lt;H1
  7175. >Ceremony&lt;/H1
  7176. >&lt;P
  7177. >Opening Procession&lt;/P
  7178. >&lt;P
  7179. >Speech by Validactorian&lt;/P
  7180. >&lt;P
  7181. >Speech by Class President&lt;/P
  7182. >&lt;P
  7183. >Presentation of Diplomas&lt;/P
  7184. >&lt;P
  7185. >Closing Speech by Headmaster&lt;/P
  7186. >&lt;/Section
  7187. >&lt;Section
  7188. >&lt;H1
  7189. >Graduates&lt;/H1
  7190. >&lt;Ul
  7191. >&lt;Li
  7192. >Molly Carpenter&lt;/Li
  7193. >&lt;Li
  7194. >Anastasia Luccio&lt;/Li
  7195. >&lt;Li
  7196. >Ebenezar McCoy&lt;/Li
  7197. >&lt;Li
  7198. >Karrin Murphy&lt;/Li
  7199. >&lt;Li
  7200. >Thomas Raith&lt;/Li
  7201. >&lt;Li
  7202. >Susan Rodriguez&lt;/Li
  7203. >&lt;/Ul
  7204. >&lt;/Section
  7205. >&lt;/Body
  7206. >&lt;/Html></pre>
  7207. </div>
  7208. <div class=example>
  7209. <p>In this example, a book author has marked up some sections as chapters and some as appendices,
  7210. and uses CSS to style the headers in these two classes of section differently. The whole book is
  7211. 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
  7212. books.</p>
  7213. <pre>&lt;article class="book">
  7214. &lt;style>
  7215. section { border: double medium; margin: 2em; }
  7216. section.chapter h1 { font: 2em Roboto, Helvetica Neue, sans-serif; }
  7217. section.appendix h1 { font: small-caps 2em Roboto, Helvetica Neue, sans-serif; }
  7218. &lt;/style>
  7219. &lt;header>
  7220. &lt;hgroup>
  7221. &lt;h1>My Book&lt;/h1>
  7222. &lt;h2>A sample with not much content&lt;/h2>
  7223. &lt;/hgroup>
  7224. &lt;p>&lt;small>Published by Dummy Publicorp Ltd.&lt;/small>&lt;/p>
  7225. &lt;/header>
  7226. &lt;section class="chapter">
  7227. &lt;h1>My First Chapter&lt;/h1>
  7228. &lt;p>This is the first of my chapters. It doesn't say much.&lt;/p>
  7229. &lt;p>But it has two paragraphs!&lt;/p>
  7230. &lt;/section>
  7231. &lt;section class="chapter">
  7232. &lt;h1>It Continutes: The Second Chapter&lt;/h1>
  7233. &lt;p>Bla dee bla, dee bla dee bla. Boom.&lt;/p>
  7234. &lt;/section>
  7235. &lt;section class="chapter">
  7236. &lt;h1>Chapter Three: A Further Example&lt;/h1>
  7237. &lt;p>It's not like a battle between brightness and earthtones would go
  7238. unnoticed.&lt;/p>
  7239. &lt;p>But it might ruin my story.&lt;/p>
  7240. &lt;/section>
  7241. &lt;section class="appendix">
  7242. &lt;h1>Appendix A: Overview of Examples&lt;/h1>
  7243. &lt;p>These are demonstrations.&lt;/p>
  7244. &lt;/section>
  7245. &lt;section class="appendix">
  7246. &lt;h1>Appendix B: Some Closing Remarks&lt;/h1>
  7247. &lt;p>Hopefully this long example shows that you &lt;em>can&lt;/em> style
  7248. sections, so long as they are used to indicate actual sections.&lt;/p>
  7249. &lt;/section>
  7250. &lt;/article></pre>
  7251. </div>
  7252. <h4 id=the-nav-element>4.3.4 The <dfn><code>nav</code></dfn> element</h4>
  7253. <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>
  7254. <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
  7255. pages or to parts within the page: a section with navigation links.</p>
  7256. <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 —
  7257. the element is primarily intended for sections that consist of major navigation blocks. In
  7258. particular, it is common for footers to have a short list of links to various pages of a site,
  7259. 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
  7260. 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
  7261. is usually unnecessary.</p>
  7262. <p class=note>User agents (such as screen readers) that are targeted at users who can benefit
  7263. from navigation information being omitted in the initial rendering, or who can benefit from
  7264. navigation information being immediately available, can use this element as a way to determine
  7265. what content on the page to initially skip or provide on request (or both).</p>
  7266. <div class=example>
  7267. <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
  7268. around the site, and one for secondary navigation around the page itself.</p>
  7269. <pre>&lt;body>
  7270. &lt;h1>The Wiki Center Of Exampland&lt;/h1>
  7271. &lt;nav>
  7272. &lt;ul>
  7273. &lt;li>&lt;a href="/">Home&lt;/a>&lt;/li>
  7274. &lt;li>&lt;a href="/events">Current Events&lt;/a>&lt;/li>
  7275. <em>...more...</em>
  7276. &lt;/ul>
  7277. &lt;/nav>
  7278. &lt;article>
  7279. &lt;header>
  7280. &lt;h1>Demos in Exampland&lt;/h1>
  7281. &lt;p>Written by A. N. Other.&lt;/p>
  7282. &lt;/header>
  7283. &lt;nav>
  7284. &lt;ul>
  7285. &lt;li>&lt;a href="#public">Public demonstrations&lt;/a>&lt;/li>
  7286. &lt;li>&lt;a href="#destroy">Demolitions&lt;/a>&lt;/li>
  7287. <em>...more...</em>
  7288. &lt;/ul>
  7289. &lt;/nav>
  7290. &lt;div>
  7291. &lt;section id="public">
  7292. &lt;h1>Public demonstrations&lt;/h1>
  7293. &lt;p><em>...more...</em>&lt;/p>
  7294. &lt;/section>
  7295. &lt;section id="destroy">
  7296. &lt;h1>Demolitions&lt;/h1>
  7297. &lt;p><em>...more...</em>&lt;/p>
  7298. &lt;/section>
  7299. <em>...more...</em>
  7300. &lt;/div>
  7301. &lt;footer>
  7302. &lt;p>&lt;a href="?edit">Edit&lt;/a> | &lt;a href="?delete">Delete&lt;/a> | &lt;a href="?Rename">Rename&lt;/a>&lt;/p>
  7303. &lt;/footer>
  7304. &lt;/article>
  7305. &lt;footer>
  7306. &lt;p>&lt;small>© copyright 1998 Exampland Emperor&lt;/small>&lt;/p>
  7307. &lt;/footer>
  7308. &lt;/body></pre>
  7309. </div>
  7310. <div class=example>
  7311. <p>In the following example, the page has several places where links are present, but only one of
  7312. those places is considered a navigation section.</p>
  7313. <pre>&lt;body itemscope itemtype="http://schema.org/Blog">
  7314. &lt;header>
  7315. &lt;h1>Wake up sheeple!&lt;/h1>
  7316. &lt;p>&lt;a href="news.html">News&lt;/a> -
  7317. &lt;a href="blog.html">Blog&lt;/a> -
  7318. &lt;a href="forums.html">Forums&lt;/a>&lt;/p>
  7319. &lt;p>Last Modified: &lt;span itemprop="dateModified">2009-04-01&lt;/span>&lt;/p>
  7320. &lt;nav>
  7321. &lt;h1>Navigation&lt;/h1>
  7322. &lt;ul>
  7323. &lt;li>&lt;a href="articles.html">Index of all articles&lt;/a>&lt;/li>
  7324. &lt;li>&lt;a href="today.html">Things sheeple need to wake up for today&lt;/a>&lt;/li>
  7325. &lt;li>&lt;a href="successes.html">Sheeple we have managed to wake&lt;/a>&lt;/li>
  7326. &lt;/ul>
  7327. &lt;/nav>
  7328. &lt;/header>
  7329. &lt;main>
  7330. &lt;article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
  7331. &lt;header>
  7332. &lt;h1 itemprop="headline">My Day at the Beach&lt;/h1>
  7333. &lt;/header>
  7334. &lt;main itemprop="articleBody">
  7335. &lt;p>Today I went to the beach and had a lot of fun.&lt;/p>
  7336. <em>...more content...</em>
  7337. &lt;/main>
  7338. &lt;footer>
  7339. &lt;p>Posted &lt;time itemprop="datePublished" datetime="2009-10-10">Thursday&lt;/time>.&lt;/p>
  7340. &lt;/footer>
  7341. &lt;/article>
  7342. <em>...more blog posts...</em>
  7343. &lt;/main>
  7344. &lt;footer>
  7345. &lt;p>Copyright ©
  7346. &lt;span itemprop="copyrightYear">2010&lt;/span>
  7347. &lt;span itemprop="copyrightHolder">The Example Company&lt;/span>
  7348. &lt;/p>
  7349. &lt;p>&lt;a href="about.html">About&lt;/a> -
  7350. &lt;a href="policy.html">Privacy Policy&lt;/a> -
  7351. &lt;a href="contact.html">Contact Us&lt;/a>&lt;/p>
  7352. &lt;/footer>
  7353. &lt;/body></pre>
  7354. <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
  7355. than the header and footer, and all the contents of the blog entry other than its header and
  7356. footer.</p>
  7357. <p>You can also see microdata annotations in the above example that use the schema.org vocabulary
  7358. to provide the publication date and other metadata about the blog post.</p>
  7359. </div>
  7360. <div class=example>
  7361. <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
  7362. content as well. In this navigation block, links are provided in prose:</p>
  7363. <pre>&lt;nav>
  7364. &lt;h1>Navigation&lt;/h1>
  7365. &lt;p>You are on my home page. To the north lies &lt;a href="/blog">my
  7366. blog&lt;/a>, from whence the sounds of battle can be heard. To the east
  7367. you can see a large mountain, upon which many &lt;a
  7368. href="/school">school papers&lt;/a> are littered. Far up thus mountain
  7369. you can spy a little figure who appears to be me, desperately
  7370. scribbling a &lt;a href="/school/thesis">thesis&lt;/a>.&lt;/p>
  7371. &lt;p>To the west are several exits. One fun-looking exit is labeled &lt;a
  7372. href="http://games.example.com/">"games"&lt;/a>. Another more
  7373. boring-looking exit is labeled &lt;a
  7374. href="http://isp.example.net/">ISP™&lt;/a>.&lt;/p>
  7375. &lt;p>To the south lies a dark and dank &lt;a href="/about">contacts
  7376. page&lt;/a>. Cobwebs cover its disused entrance, and at one point you
  7377. see a rat run quickly out of the page.&lt;/p>
  7378. &lt;/nav></pre>
  7379. </div>
  7380. <h4 id=the-aside-element>4.3.5 The <dfn><code>aside</code></dfn> element</h4>
  7381. <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>
  7382. <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
  7383. 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
  7384. which could be considered separate from that content. Such sections are often represented as
  7385. sidebars in printed typography.</p>
  7386. <p>The element can be used for typographical effects like pull quotes or sidebars, for
  7387. 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
  7388. separate from the main content of the page.</p>
  7389. <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
  7390. parentheticals, since those are part of the main flow of the document.</p>
  7391. <div class=example>
  7392. <p>The following example shows how an aside is used to mark up background material on Switzerland
  7393. in a much longer news story on Europe.</p>
  7394. <pre>&lt;aside>
  7395. &lt;h1>Switzerland&lt;/h1>
  7396. &lt;p>Switzerland, a land-locked country in the middle of geographic
  7397. Europe, has not joined the geopolitical European Union, though it is
  7398. a signatory to a number of European treaties.&lt;/p>
  7399. &lt;/aside></pre>
  7400. </div>
  7401. <div class=example>
  7402. <p>The following example shows how an aside is used to mark up a pull quote in a longer
  7403. article.</p>
  7404. <pre>...
  7405. &lt;p>He later joined a large company, continuing on the same work.
  7406. &lt;q>I love my job. People ask me what I do for fun when I'm not at
  7407. work. But I'm paid to do my hobby, so I never know what to
  7408. answer. Some people wonder what they would do if they didn't have to
  7409. work... but I know what I would do, because I was unemployed for a
  7410. year, and I filled that time doing exactly what I do now.&lt;/q>&lt;/p>
  7411. &lt;aside>
  7412. &lt;q> People ask me what I do for fun when I'm not at work. But I'm
  7413. paid to do my hobby, so I never know what to answer. &lt;/q>
  7414. &lt;/aside>
  7415. &lt;p>Of course his work — or should that be hobby? —
  7416. isn't his only passion. He also enjoys other pleasures.&lt;/p>
  7417. ...</pre>
  7418. </div>
  7419. <div class=example>
  7420. <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
  7421. content on a blog:</p>
  7422. <pre>&lt;body>
  7423. &lt;header>
  7424. &lt;h1>My wonderful blog&lt;/h1>
  7425. &lt;p>My tagline&lt;/p>
  7426. &lt;/header>
  7427. &lt;aside>
  7428. &lt;!-- <em>this aside contains two sections that are tangentially related
  7429. to the page, namely, links to other blogs, and links to blog posts
  7430. from this blog</em> -->
  7431. &lt;nav>
  7432. &lt;h1>My blogroll&lt;/h1>
  7433. &lt;ul>
  7434. &lt;li>&lt;a href="http://blog.example.com/">Example Blog&lt;/a>
  7435. &lt;/ul>
  7436. &lt;/nav>
  7437. &lt;nav>
  7438. &lt;h1>Archives&lt;/h1>
  7439. &lt;ol reversed>
  7440. &lt;li>&lt;a href="/last-post">My last post&lt;/a>
  7441. &lt;li>&lt;a href="/first-post">My first post&lt;/a>
  7442. &lt;/ol>
  7443. &lt;/nav>
  7444. &lt;/aside>
  7445. &lt;aside>
  7446. &lt;!-- <em>this aside is tangentially related to the page also, it
  7447. contains twitter messages from the blog author</em> -->
  7448. &lt;h1>Twitter Feed&lt;/h1>
  7449. &lt;blockquote cite="http://twitter.example.net/t31351234">
  7450. I'm on vacation, writing my blog.
  7451. &lt;/blockquote>
  7452. &lt;blockquote cite="http://twitter.example.net/t31219752">
  7453. I'm going to go on vacation soon.
  7454. &lt;/blockquote>
  7455. &lt;/aside>
  7456. &lt;article>
  7457. &lt;!-- <em>this is a blog post</em> -->
  7458. &lt;h1>My last post&lt;/h1>
  7459. &lt;p>This is my last post.&lt;/p>
  7460. &lt;footer>
  7461. &lt;p>&lt;a href="/last-post" rel=bookmark>Permalink&lt;/a>
  7462. &lt;/footer>
  7463. &lt;/article>
  7464. &lt;article>
  7465. &lt;!-- <em>this is also a blog post</em> -->
  7466. &lt;h1>My first post&lt;/h1>
  7467. &lt;p>This is my first post.&lt;/p>
  7468. &lt;aside>
  7469. &lt;!-- <em>this aside is about the blog post, since it's inside the
  7470. &lt;article> element; it would be wrong, for instance, to put the
  7471. blogroll here, since the blogroll isn't really related to this post
  7472. specifically, only to the page as a whole</em> -->
  7473. &lt;h1>Posting&lt;/h1>
  7474. &lt;p>While I'm thinking about it, I wanted to say something about
  7475. posting. Posting is fun!&lt;/p>
  7476. &lt;/aside>
  7477. &lt;footer>
  7478. &lt;p>&lt;a href="/first-post" rel=bookmark>Permalink&lt;/a>
  7479. &lt;/footer>
  7480. &lt;/article>
  7481. &lt;footer>
  7482. &lt;nav>
  7483. &lt;a href="/archives">Archives&lt;/a> —
  7484. &lt;a href="/about">About me&lt;/a> —
  7485. &lt;a href="/copyright">Copyright&lt;/a>
  7486. &lt;/nav>
  7487. &lt;/footer>
  7488. &lt;/body></pre>
  7489. </div>
  7490. <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
  7491. <dfn id=the-h6-element><code>h6</code></dfn> elements</h4>
  7492. <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>
  7493. <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> {
  7494. // <a href="#HTMLHeadingElement-partial">also has obsolete members</a>
  7495. };</pre>
  7496. </dl>
  7497. <p>These elements <a href=#represents id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:represents>represent</a> headings for their sections.</p>
  7498. <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
  7499. sections</a>.</p>
  7500. <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>
  7501. 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
  7502. elements with the same name have equal rank.</p>
  7503. <div class=example>
  7504. <p>As far as their respective document outlines (their heading and section structures) are
  7505. concerned, these two snippets are semantically equivalent:</p>
  7506. <pre>&lt;body>
  7507. &lt;h1>Let's call it a draw(ing surface)&lt;/h1>
  7508. &lt;h2>Diving in&lt;/h2>
  7509. &lt;h2>Simple shapes&lt;/h2>
  7510. &lt;h2>Canvas coordinates&lt;/h2>
  7511. &lt;h3>Canvas coordinates diagram&lt;/h3>
  7512. &lt;h2>Paths&lt;/h2>
  7513. &lt;/body></pre>
  7514. <pre>&lt;body>
  7515. &lt;h1>Let's call it a draw(ing surface)&lt;/h1>
  7516. &lt;section>
  7517. &lt;h1>Diving in&lt;/h1>
  7518. &lt;/section>
  7519. &lt;section>
  7520. &lt;h1>Simple shapes&lt;/h1>
  7521. &lt;/section>
  7522. &lt;section>
  7523. &lt;h1>Canvas coordinates&lt;/h1>
  7524. &lt;section>
  7525. &lt;h1>Canvas coordinates diagram&lt;/h1>
  7526. &lt;/section>
  7527. &lt;/section>
  7528. &lt;section>
  7529. &lt;h1>Paths&lt;/h1>
  7530. &lt;/section>
  7531. &lt;/body></pre>
  7532. <p>Authors might prefer the former style for its terseness, or the latter style for its
  7533. convenience in the face of heavy editing; which is best is purely an issue of preferred authoring
  7534. style.</p>
  7535. <p>The two styles can be combined, for compatibility with legacy tools while still
  7536. future-proofing for when that compatibility is no longer needed. This third snippet again has the
  7537. same outline as the previous two:</p>
  7538. <pre>&lt;body>
  7539. &lt;h1>Let's call it a draw(ing surface)&lt;/h1>
  7540. &lt;section>
  7541. &lt;h2>Diving in&lt;/h2>
  7542. &lt;/section>
  7543. &lt;section>
  7544. &lt;h2>Simple shapes&lt;/h2>
  7545. &lt;/section>
  7546. &lt;section>
  7547. &lt;h2>Canvas coordinates&lt;/h2>
  7548. &lt;section>
  7549. &lt;h3>Canvas coordinates diagram&lt;/h3>
  7550. &lt;/section>
  7551. &lt;/section>
  7552. &lt;section>
  7553. &lt;h2>Paths&lt;/h2>
  7554. &lt;/section>
  7555. &lt;/body></pre>
  7556. </div>
  7557. <h4 id=the-hgroup-element>4.3.7 The <dfn><code>hgroup</code></dfn> element</h4>
  7558. <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>
  7559. <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
  7560. 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
  7561. <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
  7562. <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
  7563. subheadings, alternative titles, or taglines.</p>
  7564. <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
  7565. <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
  7566. 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
  7567. 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
  7568. subheadings or subtitles.</p>
  7569. <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
  7570. assigned to individual sections.</p>
  7571. <div class=example>
  7572. <p>Here are some examples of valid headings.</p>
  7573. <pre>&lt;hgroup>
  7574. &lt;h1>The reality dysfunction&lt;/h1>
  7575. &lt;h2>Space is not the only void&lt;/h2>
  7576. &lt;/hgroup></pre>
  7577. <pre>&lt;hgroup>
  7578. &lt;h1>Dr. Strangelove&lt;/h1>
  7579. &lt;h2>Or: How I Learned to Stop Worrying and Love the Bomb&lt;/h2>
  7580. &lt;/hgroup></pre>
  7581. <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>
  7582. element (which acts as a secondary title) from the <a href=#outline id=the-hgroup-element:outline>outline</a> algorithm.</p>
  7583. <p>How a user agent exposes such multi-level headings in user interfaces (e.g. in tables of
  7584. contents or search results) is left open to implementors, as it is a user interface issue. The
  7585. first example above could be rendered as:</p>
  7586. <pre>The reality dysfunction: Space is not the only void</pre>
  7587. <p>Alternatively, it could look like this:
  7588. <pre>The reality dysfunction (Space is not the only void)</pre>
  7589. <p>In interfaces where a title can be rendered on multiple lines, it could be rendered as
  7590. follows, maybe with the first line in a bigger font size:</p>
  7591. <pre>The reality dysfunction
  7592. Space is not the only void</pre>
  7593. </div>
  7594. <h4 id=the-header-element>4.3.8 The <dfn><code>header</code></dfn> element</h4>
  7595. <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>
  7596. <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
  7597. aids.</p>
  7598. <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
  7599. (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
  7600. 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
  7601. contents, a search form, or any relevant logos.</p>
  7602. <div class=example>
  7603. <p>Here are some sample headers. This first one is for a game:</p>
  7604. <pre>&lt;header>
  7605. &lt;p>Welcome to...&lt;/p>
  7606. &lt;h1>Voidwars!&lt;/h1>
  7607. &lt;/header></pre>
  7608. <p>The following snippet shows how the element can be used to mark
  7609. up a specification's header:</p>
  7610. <pre>&lt;header>
  7611. &lt;hgroup>
  7612. &lt;h1>Scalable Vector Graphics (SVG) 1.2&lt;/h1>
  7613. &lt;h2>W3C Working Draft 27 October 2004&lt;/h2>
  7614. &lt;/hgroup>
  7615. &lt;dl>
  7616. &lt;dt>This version:&lt;/dt>
  7617. &lt;dd>&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/&lt;/a>&lt;/dd>
  7618. &lt;dt>Previous version:&lt;/dt>
  7619. &lt;dd>&lt;a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/&lt;/a>&lt;/dd>
  7620. &lt;dt>Latest version of SVG 1.2:&lt;/dt>
  7621. &lt;dd>&lt;a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/&lt;/a>&lt;/dd>
  7622. &lt;dt>Latest SVG Recommendation:&lt;/dt>
  7623. &lt;dd>&lt;a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/&lt;/a>&lt;/dd>
  7624. &lt;dt>Editor:&lt;/dt>
  7625. &lt;dd>Dean Jackson, W3C, &lt;a href="mailto:dean@w3.org">dean@w3.org&lt;/a>&lt;/dd>
  7626. &lt;dt>Authors:&lt;/dt>
  7627. &lt;dd>See &lt;a href="#authors">Author List&lt;/a>&lt;/dd>
  7628. &lt;/dl>
  7629. &lt;p class="copyright">&lt;a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
  7630. &lt;/header></pre>
  7631. </div>
  7632. <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
  7633. introduce a new section.</p>
  7634. <div class=example>
  7635. <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
  7636. 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
  7637. <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
  7638. <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
  7639. <a href=#outline id=the-header-element:outline>outline</a> algorithm.</p>
  7640. <pre>&lt;body>
  7641. &lt;header>
  7642. &lt;h1>Little Green Guys With Guns&lt;/h1>
  7643. &lt;nav>
  7644. &lt;ul>
  7645. &lt;li>&lt;a href="/games">Games&lt;/a>
  7646. &lt;li>&lt;a href="/forum">Forum&lt;/a>
  7647. &lt;li>&lt;a href="/download">Download&lt;/a>
  7648. &lt;/ul>
  7649. &lt;/nav>
  7650. &lt;h2>Important News&lt;/h2> &lt;!-- this starts a second subsection -->
  7651. &lt;!-- this is part of the subsection entitled "Important News" -->
  7652. &lt;p>To play today's games you will need to update your client.&lt;/p>
  7653. &lt;h2>Games&lt;/h2> &lt;!-- this starts a third subsection -->
  7654. &lt;/header>
  7655. &lt;p>You have three active games:&lt;/p>
  7656. &lt;!-- this is still part of the subsection entitled "Games" -->
  7657. ...</pre>
  7658. </div>
  7659. <h4 id=the-footer-element>4.3.9 The <dfn><code>footer</code></dfn> element</h4>
  7660. <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>
  7661. <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
  7662. <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
  7663. contains information about its section such as who wrote it, links to related documents, copyright
  7664. data, and the like.</p>
  7665. <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
  7666. agreements, and other such content.</p>
  7667. <p class=note>Contact information for the author or editor of a section belongs in an
  7668. <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
  7669. 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
  7670. placed in either (or neither). The primary purpose of these elements is merely to help the author
  7671. write self-explanatory markup that is easy to maintain and style; they are not intended to impose
  7672. specific structures on authors.</p>
  7673. <p>Footers don't necessarily have to appear at the <em>end</em> of a section, though they usually
  7674. do.</p>
  7675. <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>
  7676. 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>
  7677. <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
  7678. introduce a new section.</p>
  7679. <div class=example>
  7680. <p>Here is a page with two footers, one at the top and one at the bottom, with the same
  7681. content:</p>
  7682. <pre>&lt;body>
  7683. &lt;footer>&lt;a href="../">Back to index...&lt;/a>&lt;/footer>
  7684. &lt;hgroup>
  7685. &lt;h1>Lorem ipsum&lt;/h1>
  7686. &lt;h2>The ipsum of all lorems&lt;/h2>
  7687. &lt;/hgroup>
  7688. &lt;p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  7689. tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
  7690. veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
  7691. ea commodo consequat. Duis aute irure dolor in reprehenderit in
  7692. voluptate velit esse cillum dolore eu fugiat nulla
  7693. pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
  7694. culpa qui officia deserunt mollit anim id est laborum.&lt;/p>
  7695. &lt;footer>&lt;a href="../">Back to index...&lt;/a>&lt;/footer>
  7696. &lt;/body></pre>
  7697. </div>
  7698. <div class=example>
  7699. <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
  7700. footer and for a section footer.</p>
  7701. <pre>&lt;!DOCTYPE HTML>
  7702. &lt;HTML>&lt;HEAD>
  7703. &lt;TITLE>The Ramblings of a Scientist&lt;/TITLE>
  7704. &lt;BODY>
  7705. &lt;H1>The Ramblings of a Scientist&lt;/H1>
  7706. &lt;ARTICLE>
  7707. &lt;H1>Episode 15&lt;/H1>
  7708. &lt;VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
  7709. &lt;P>&lt;A HREF="/fm/015.ogv">Download video&lt;/A>.&lt;/P>
  7710. &lt;/VIDEO>
  7711. &lt;FOOTER> &lt;!-- footer for article -->
  7712. &lt;P>Published &lt;TIME DATETIME="2009-10-21T18:26-07:00">on 2009/10/21 at 6:26pm&lt;/TIME>&lt;/P>
  7713. &lt;/FOOTER>
  7714. &lt;/ARTICLE>
  7715. &lt;ARTICLE>
  7716. &lt;H1>My Favorite Trains&lt;/H1>
  7717. &lt;P>I love my trains. My favorite train of all time is a Köf.&lt;/P>
  7718. &lt;P>It is fun to see them pull some coal cars because they look so
  7719. dwarfed in comparison.&lt;/P>
  7720. &lt;FOOTER> &lt;!-- footer for article -->
  7721. &lt;P>Published &lt;TIME DATETIME="2009-09-15T14:54-07:00">on 2009/09/15 at 2:54pm&lt;/TIME>&lt;/P>
  7722. &lt;/FOOTER>
  7723. &lt;/ARTICLE>
  7724. &lt;FOOTER> &lt;!-- site wide footer -->
  7725. &lt;NAV>
  7726. &lt;P>&lt;A HREF="/credits.html">Credits&lt;/A> —
  7727. &lt;A HREF="/tos.html">Terms of Service&lt;/A> —
  7728. &lt;A HREF="/index.html">Blog Index&lt;/A>&lt;/P>
  7729. &lt;/NAV>
  7730. &lt;P>Copyright © 2009 Gordon Freeman&lt;/P>
  7731. &lt;/FOOTER>
  7732. &lt;/BODY>
  7733. &lt;/HTML></pre>
  7734. </div>
  7735. <div class=example>
  7736. <p>Some site designs have what is sometimes referred to as "fat footers" — footers that
  7737. contain a lot of material, including images, links to other articles, links to pages for sending
  7738. feedback, special offers... in some ways, a whole "front page" in the footer.</p>
  7739. <p>This fragment shows the bottom of a page on a site with a "fat footer":</p>
  7740. <pre>...
  7741. &lt;footer>
  7742. &lt;nav>
  7743. &lt;section>
  7744. &lt;h1>Articles&lt;/h1>
  7745. &lt;p>&lt;img src="images/somersaults.jpeg" alt=""> Go to the gym with
  7746. our somersaults class! Our teacher Jim takes you through the paces
  7747. in this two-part article. &lt;a href="articles/somersaults/1">Part
  7748. 1&lt;/a> · &lt;a href="articles/somersaults/2">Part 2&lt;/a>&lt;/p>
  7749. &lt;p>&lt;img src="images/kindplus.jpeg"> Tired of walking on the edge of
  7750. a clif&lt;!-- sic -->? Our guest writer Lara shows you how to bumble
  7751. your way through the bars. &lt;a href="articles/kindplus/1">Read
  7752. more...&lt;/a>&lt;/p>
  7753. &lt;p>&lt;img src="images/crisps.jpeg"> The chips are down, now all
  7754. that's left is a potato. What can you do with it? &lt;a
  7755. href="articles/crisps/1">Read more...&lt;/a>&lt;/p>
  7756. &lt;/section>
  7757. &lt;ul>
  7758. &lt;li> &lt;a href="/about">About us...&lt;/a>
  7759. &lt;li> &lt;a href="/feedback">Send feedback!&lt;/a>
  7760. &lt;li> &lt;a href="/sitemap">Sitemap&lt;/a>
  7761. &lt;/ul>
  7762. &lt;/nav>
  7763. &lt;p>&lt;small>Copyright © 2015 The Snacker —
  7764. &lt;a href="/tos">Terms of Service&lt;/a>&lt;/small>&lt;/p>
  7765. &lt;/footer>
  7766. &lt;/body></pre>
  7767. </div>
  7768. <h4 id=the-address-element>4.3.10 The <dfn><code>address</code></dfn> element</h4>
  7769. <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
  7770. content</a> descendants, no <a href=#sectioning-content-2 id=the-address-element:sectioning-content-2>sectioning content</a>
  7771. 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
  7772. <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>
  7773. <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
  7774. 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
  7775. element</a>, then the contact information applies to the document as a whole.</p>
  7776. <div class=example>
  7777. <p>For example, a page at the W3C Web site related to HTML might
  7778. include the following contact information:</p>
  7779. <pre>&lt;ADDRESS>
  7780. &lt;A href="../People/Raggett/">Dave Raggett&lt;/A>,
  7781. &lt;A href="../People/Arnaud/">Arnaud Le Hors&lt;/A>,
  7782. contact persons for the &lt;A href="Activity">W3C HTML Activity&lt;/A>
  7783. &lt;/ADDRESS></pre>
  7784. </div>
  7785. <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
  7786. addresses), unless those addresses are in fact the relevant contact information. (The
  7787. <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>
  7788. <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
  7789. information.</p>
  7790. <div class=example>
  7791. <p>For example, the following is non-conforming use of the
  7792. <code id=the-address-element:the-address-element-5><a href=#the-address-element>address</a></code> element:</p>
  7793. <pre class=bad>&lt;ADDRESS>Last Modified: 1999/12/24 23:37:50&lt;/ADDRESS></pre>
  7794. </div>
  7795. <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
  7796. <code id=the-address-element:the-footer-element-2><a href=#the-footer-element>footer</a></code> element.</p>
  7797. <p>The contact information for a node <var>node</var> is a collection of
  7798. <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>
  7799. <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>
  7800. <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
  7801. <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>
  7802. <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>
  7803. <p>The contact information of <var>node</var> is the same as the contact information of
  7804. 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
  7805. nearest.</p>
  7806. <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
  7807. element</a><dd>
  7808. <p>The contact information of <var>node</var> is the same as the contact information of
  7809. <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>
  7810. <dt>Otherwise<dd>
  7811. <p>There is no contact information for <var>node</var>.</p>
  7812. </dl>
  7813. <p>User agents may expose the contact information of a node to the user, or use it for other
  7814. purposes, such as indexing sections based on the sections' contact information.</p>
  7815. <div class=example>
  7816. <p>In this example the footer contains contact information and a copyright notice.</p>
  7817. <pre>&lt;footer>
  7818. &lt;address>
  7819. For more details, contact
  7820. &lt;a href="mailto:js@example.com">John Smith&lt;/a>.
  7821. &lt;/address>
  7822. &lt;p>&lt;small>© copyright 2038 Example Corp.&lt;/small>&lt;/p>
  7823. &lt;/footer></pre>
  7824. </div>
  7825. <h4 id=headings-and-sections>4.3.11 <dfn>Headings and sections</dfn></h4>
  7826. <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
  7827. headings.</p>
  7828. <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
  7829. content</a> <a href=#represents id=headings-and-sections:represents>represents</a> the heading for that section. Subsequent headings of equal
  7830. 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>
  7831. start implied subsections that are part of the previous one. In both cases, the element
  7832. <a href=#represents id=headings-and-sections:represents-2>represents</a> the heading of the implied section.</p>
  7833. <p>Certain elements are said to be <dfn id=sectioning-root>sectioning roots</dfn>, including
  7834. <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,
  7835. but the sections and headings inside these elements do not contribute to the outlines of their
  7836. ancestors.</p>
  7837. <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>
  7838. <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
  7839. 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
  7840. content</a>, whichever is nearest, regardless of what implied sections other headings may have
  7841. created.</p>
  7842. <div class=example>
  7843. <p>For the following fragment:</p>
  7844. <pre>&lt;body>
  7845. &lt;h1>Foo&lt;/h1>
  7846. &lt;h2>Bar&lt;/h2>
  7847. &lt;blockquote>
  7848. &lt;h3>Bla&lt;/h3>
  7849. &lt;/blockquote>
  7850. &lt;p>Baz&lt;/p>
  7851. &lt;h2>Quux&lt;/h2>
  7852. &lt;section>
  7853. &lt;h3>Thud&lt;/h3>
  7854. &lt;/section>
  7855. &lt;p>Grunt&lt;/p>
  7856. &lt;/body></pre>
  7857. <p>...the structure would be:</p>
  7858. <ol><li>
  7859. 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)
  7860. <ol><li>
  7861. Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
  7862. <li>
  7863. Quux (heading starting implied section with no content other than the heading itself)
  7864. <li>
  7865. Thud (heading of explicit <code id=headings-and-sections:the-section-element><a href=#the-section-element>section</a></code> section)
  7866. </ol>
  7867. </ol>
  7868. <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
  7869. paragraph ("Grunt") is back at the top level.</p>
  7870. </div>
  7871. <p>Sections may contain headings of any <a href=#rank id=headings-and-sections:rank-3>rank</a>, but authors are strongly encouraged to
  7872. 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>
  7873. for the section's nesting level.</p>
  7874. <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
  7875. content</a>, instead of relying on the implicit sections generated by having multiple headings
  7876. in one element of <a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2-5>sectioning content</a>.</p>
  7877. <div class=example>
  7878. <p>For example, the following is correct:</p>
  7879. <pre>&lt;body>
  7880. &lt;h4>Apples&lt;/h4>
  7881. &lt;p>Apples are fruit.&lt;/p>
  7882. &lt;section>
  7883. &lt;h2>Taste&lt;/h2>
  7884. &lt;p>They taste lovely.&lt;/p>
  7885. &lt;h6>Sweet&lt;/h6>
  7886. &lt;p>Red apples are sweeter than green ones.&lt;/p>
  7887. &lt;h1>Colour&lt;/h1>
  7888. &lt;p>Apples come in various colours.&lt;/p>
  7889. &lt;/section>
  7890. &lt;/body></pre>
  7891. <p>However, the same document would be more clearly expressed as:</p>
  7892. <pre>&lt;body>
  7893. &lt;h1>Apples&lt;/h1>
  7894. &lt;p>Apples are fruit.&lt;/p>
  7895. &lt;section>
  7896. &lt;h2>Taste&lt;/h2>
  7897. &lt;p>They taste lovely.&lt;/p>
  7898. &lt;section>
  7899. &lt;h3>Sweet&lt;/h3>
  7900. &lt;p>Red apples are sweeter than green ones.&lt;/p>
  7901. &lt;/section>
  7902. &lt;/section>
  7903. &lt;section>
  7904. &lt;h2>Colour&lt;/h2>
  7905. &lt;p>Apples come in various colours.&lt;/p>
  7906. &lt;/section>
  7907. &lt;/body></pre>
  7908. <p>Both of the documents above are semantically identical and would produce the same outline in
  7909. compliant user agents.</p>
  7910. <p>This third example is also semantically identical, and might be easier to maintain (e.g. if
  7911. sections are often moved around in editing):</p>
  7912. <pre>&lt;body>
  7913. &lt;h1>Apples&lt;/h1>
  7914. &lt;p>Apples are fruit.&lt;/p>
  7915. &lt;section>
  7916. &lt;h1>Taste&lt;/h1>
  7917. &lt;p>They taste lovely.&lt;/p>
  7918. &lt;section>
  7919. &lt;h1>Sweet&lt;/h1>
  7920. &lt;p>Red apples are sweeter than green ones.&lt;/p>
  7921. &lt;/section>
  7922. &lt;/section>
  7923. &lt;section>
  7924. &lt;h1>Colour&lt;/h1>
  7925. &lt;p>Apples come in various colours.&lt;/p>
  7926. &lt;/section>
  7927. &lt;/body></pre>
  7928. <p>This final example would need explicit style rules to be rendered well in legacy browsers.
  7929. Legacy browsers without CSS support would render all the headings as top-level headings.</p>
  7930. </div>
  7931. <h5 id=outlines>4.3.11.1 Creating an outline</h5>
  7932. <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>
  7933. 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
  7934. 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
  7935. is <i>exited</i> during the walk.</p>
  7936. <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
  7937. 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
  7938. is said to be <dfn id="the-outline's-owner">the outline's owner</dfn>.</p>
  7939. <p>A <dfn id=concept-section>section</dfn> is a container that corresponds to some nodes in
  7940. the original DOM tree. Each section can have one heading associated with it, and can contain any
  7941. number of further nested sections. The algorithm for the outline also
  7942. associates each node in the DOM tree with a particular section and potentially a heading.
  7943. (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
  7944. such elements — they are merely conceptual sections.)</p>
  7945. <div class=example>
  7946. <p>The following markup fragment:</p>
  7947. <pre>&lt;body>
  7948. &lt;h1>A&lt;/h1>
  7949. &lt;p>B&lt;/p>
  7950. &lt;h2>C&lt;/h2>
  7951. &lt;p>D&lt;/p>
  7952. &lt;h2>E&lt;/h2>
  7953. &lt;p>F&lt;/p>
  7954. &lt;/body></pre>
  7955. <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
  7956. entire document):</p>
  7957. <ol class=brief><li>
  7958. <p>Section created for <code id=outlines:the-body-element-2><a href=#the-body-element>body</a></code> node.</p>
  7959. <p>Associated with heading "A".</p>
  7960. <p>Also associated with paragraph "B".</p>
  7961. <p>Nested sections:</p>
  7962. <ol class=brief><li>
  7963. <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>
  7964. <p>Associated with heading "C".</p>
  7965. <p>Also associated with paragraph "D".</p>
  7966. <p>No nested sections.</p>
  7967. <li>
  7968. <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>
  7969. <p>Associated with heading "E".</p>
  7970. <p>Also associated with paragraph "F".</p>
  7971. <p>No nested sections.</p>
  7972. </ol>
  7973. </ol>
  7974. </div>
  7975. <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
  7976. content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-3>sectioning root</a> element to determine that element's
  7977. <a href=#outline id=outlines:outline-2>outline</a> is as follows:</p>
  7978. <ol><li><p>Let <var>current outline target</var> be null. (It holds the element whose
  7979. <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
  7980. section.)<li><p>Create a stack to hold elements, which is used to handle nesting. Initialise this stack to
  7981. empty.<li>
  7982. <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
  7983. content</a> element or <a href=#sectioning-root id=outlines:sectioning-root-4>sectioning root</a> element at the root of the subtree for
  7984. which an outline is to be created, and trigger the first relevant step below for each element as
  7985. the walk enters and exits it.</p>
  7986. <dl class=switch><dt>When exiting an element, if that element is the element at the top of the stack<dd>
  7987. <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
  7988. element with a <code id=outlines:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute.</p>
  7989. <p>Pop that element from the stack.</p>
  7990. <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
  7991. <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>
  7992. <p>Push the element being entered onto the stack. (This causes the algorithm to skip that
  7993. element and any descendants of the element.)</p>
  7994. <dt>When entering a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-5>sectioning content</a> element<dd>
  7995. <p>Run these steps:</p>
  7996. <ol><li>
  7997. <p>If <var>current outline target</var> is not null, run these substeps:</p>
  7998. <ol><li><p>If the <var>current section</var> has no heading, create an implied
  7999. 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>
  8000. <li><p>Let <var>current outline target</var> be the element that is being
  8001. 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>
  8002. element.<li><p>Associate <var>current outline target</var> with <var>current
  8003. section</var>.<li><p>Let there be a new <a href=#outline id=outlines:outline-4>outline</a> for the new <var>current outline
  8004. target</var>, initialised with just the new <var>current section</var> as the only
  8005. <a href=#concept-section id=outlines:concept-section-4>section</a> in the outline.</ol>
  8006. <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>
  8007. <p>Run these steps:</p>
  8008. <ol><li><p>If the <var>current section</var> has no heading, create an implied heading
  8009. 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
  8010. target</var> be that element.<li><p>Let <var>current section</var> be the last section in the
  8011. <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
  8012. exited to the <var>current section</var>. (This does not change which section is
  8013. the last section in the <a href=#outline id=outlines:outline-7>outline</a>.)</ol>
  8014. <dt>When entering a <a href=#sectioning-root id=outlines:sectioning-root-5>sectioning root</a> element<dd>
  8015. <p>Run these steps:</p>
  8016. <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
  8017. 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>
  8018. element.<li><p>Let there be a new <a href=#outline id=outlines:outline-8>outline</a> for the new <var>current outline
  8019. target</var>, initialised with just the new <var>current section</var> as the only
  8020. <a href=#concept-section id=outlines:concept-section-6>section</a> in the outline.</ol>
  8021. <dt>When exiting a <a href=#sectioning-root id=outlines:sectioning-root-6>sectioning root</a> element, if the stack is not empty<dd>
  8022. <p>Run these steps:</p>
  8023. <ol><li><p>If the <var>current section</var> has no heading, create an implied heading
  8024. and let that be the heading for the <var>current section</var>.<li><p>Let <var>current section</var> be <var>current outline
  8025. target</var>'s <i>parent section</i>.<li><p>Pop the top element from the stack, and let the <var>current outline
  8026. target</var> be that element.</ol>
  8027. <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>
  8028. element (when the stack is empty)<dd>
  8029. <p class=note>The <var>current outline target</var> is the element being exited,
  8030. 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>
  8031. element at the root of the subtree for which an outline is being generated.</p>
  8032. <p>If the <var>current section</var> has no heading, create an implied heading and
  8033. let that be the heading for the <var>current section</var>.</p>
  8034. <p>Skip to the next step in the overall set of steps. (The walk is over.)</p>
  8035. <dt>When entering a <a href=#heading-content-2 id=outlines:heading-content-2-3>heading content</a> element<dd>
  8036. <p>If the <var>current section</var> has no heading, let the element being entered be
  8037. the heading for the <var>current section</var>.</p>
  8038. <p>Otherwise, if the element being entered has a <a href=#rank id=outlines:rank>rank</a> equal to or higher than the
  8039. heading of the last section of the <a href=#outline id=outlines:outline-9>outline</a> of the <var>current outline
  8040. 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
  8041. section of that outline. Let <var>current section</var> be that new section. Let the
  8042. element being entered be the new heading for the <var>current section</var>.</p>
  8043. <p>Otherwise, run these substeps:</p>
  8044. <ol><li><p>Let <var>candidate section</var> be <var>current
  8045. 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
  8046. the <a href=#rank id=outlines:rank-3>rank</a> of the heading of the <var>candidate section</var>, then create a new
  8047. <a href=#concept-section id=outlines:concept-section-8>section</a>, and append it to <var>candidate
  8048. section</var>. (This does not change which section is the last section in the outline.) Let
  8049. <var>current section</var> be this new section. Let the element being entered be the
  8050. new heading for the <var>current section</var>. Abort these substeps.</p>
  8051. <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
  8052. 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
  8053. section</var>.<li><p>Return to the step labeled <i>heading loop</i>.</ol>
  8054. <p>Push the element being entered onto the stack. (This causes the algorithm to skip any
  8055. descendants of the element.)</p>
  8056. <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>
  8057. has the lowest rank.</p>
  8058. <dt>Otherwise<dd><p>Do nothing.</dl>
  8059. <p id=associatedSection>In addition, whenever the walk exits a node, after doing the steps
  8060. above, if the node is not associated with a <a href=#concept-section id=outlines:concept-section-10>section</a> yet,
  8061. associate the node with the <a href=#concept-section id=outlines:concept-section-11>section</a> <var>current
  8062. section</var>.</p>
  8063. <li><p>Associate all non-element nodes that are in the subtree for which an outline is being
  8064. created with the <a href=#concept-section id=outlines:concept-section-12>section</a> with which their parent element is
  8065. 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>
  8066. <p>The tree of sections created by the algorithm above, or a proper subset thereof, must be used
  8067. when generating document outlines, for example when generating tables of contents.</p>
  8068. <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
  8069. <a href=#outline id=outlines:outline-13>outline</a> of the entire document.</p>
  8070. <p>When creating an interactive table of contents, entries should jump the user to the relevant
  8071. <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
  8072. 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
  8073. content</a> element, if the <a href=#concept-section id=outlines:concept-section-15>section</a> in the tree was
  8074. generated for a heading in the above process.</p>
  8075. <p class=note>Selecting the first <a href=#concept-section id=outlines:concept-section-16>section</a> of the document
  8076. therefore always takes the user to the top of the document, regardless of where the first heading
  8077. in the <code id=outlines:the-body-element-3><a href=#the-body-element>body</a></code> is to be found.</p>
  8078. <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
  8079. 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
  8080. <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>
  8081. <p>User agents should provide default headings for sections that do not have explicit section
  8082. headings.</p>
  8083. <div class=example>
  8084. <p>Consider the following snippet:</p>
  8085. <pre>&lt;body>
  8086. &lt;nav>
  8087. &lt;p>&lt;a href="/">Home&lt;/a>&lt;/p>
  8088. &lt;/nav>
  8089. &lt;p>Hello world.&lt;/p>
  8090. &lt;aside>
  8091. &lt;p>My cat is cute.&lt;/p>
  8092. &lt;/aside>
  8093. &lt;/body></pre>
  8094. <p>Although it contains no headings, this snippet has three sections: a document (the
  8095. <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
  8096. agent could present the outline as follows:</p>
  8097. <ol class=brief><li>Untitled document
  8098. <ol><li>Navigation<li>Sidebar</ol>
  8099. </ol>
  8100. <p>These default headings ("Untitled document", "Navigation", "Sidebar") are not specified by
  8101. this specification, and might vary with the user's language, the page's language, the user's
  8102. preferences, the user agent implementor's preferences, etc.</p>
  8103. </div>
  8104. <div class=note>
  8105. <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
  8106. 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
  8107. the nodes as they are entered and exited. <a href=#refsECMA262>[ECMA262]</a></p>
  8108. <pre>function (root, enter, exit) {
  8109. var node = root;
  8110. start: while (node) {
  8111. enter(node);
  8112. if (node.firstChild) {
  8113. node = node.firstChild;
  8114. continue start;
  8115. }
  8116. while (node) {
  8117. exit(node);
  8118. if (node == root) {
  8119. node = null;
  8120. } else if (node.nextSibling) {
  8121. node = node.nextSibling;
  8122. continue start;
  8123. } else {
  8124. node = node.parentNode;
  8125. }
  8126. }
  8127. }
  8128. }</pre>
  8129. </div>
  8130. <h5 id=sample-outlines>4.3.11.2 Sample outlines</h5>
  8131. <p><i>This section is non-normative.</i></p>
  8132. <div class=example>
  8133. <p>The following document shows a straight-forward application of the <a href=#outline id=sample-outlines:outline>outline</a>
  8134. algorithm. First, here is the document, which is a book with very short chapters and
  8135. subsections:</p>
  8136. <pre>&lt;!DOCTYPE HTML>
  8137. &lt;title>The Tax Book (all in one page)&lt;/title>
  8138. &lt;h1>The Tax Book&lt;/h1>
  8139. &lt;h2>Earning money&lt;/h2>
  8140. &lt;p>Earning money is good.&lt;/p>
  8141. &lt;h3>Getting a job&lt;/h3>
  8142. &lt;p>To earn money you typically need a job.&lt;/p>
  8143. &lt;h2>Spending money&lt;/h2>
  8144. &lt;p>Spending is what money is mainly used for.&lt;/p>
  8145. &lt;h3>Cheap things&lt;/h3>
  8146. &lt;p>Buying cheap things often not cost-effective.&lt;/p>
  8147. &lt;h3>Expensive things&lt;/h3>
  8148. &lt;p>The most expensive thing is often not the most cost-effective either.&lt;/p>
  8149. &lt;h2>Investing money&lt;/h2>
  8150. &lt;p>You can lend your money to other people.&lt;/p>
  8151. &lt;h2>Losing money&lt;/h2>
  8152. &lt;p>If you spend money or invest money, sooner or later you will lose money.
  8153. &lt;h3>Poor judgement&lt;/h3>
  8154. &lt;p>Usually if you lose money it's because you made a mistake.&lt;/p></pre>
  8155. <p>This book would form the following outline:</p>
  8156. <ol class=brief><li> The Tax Book
  8157. <ol class=brief><li> Earning money
  8158. <ol class=brief><li> Getting a job
  8159. </ol>
  8160. <li> Spending money
  8161. <ol class=brief><li> Cheap things
  8162. <li> Expensive things
  8163. </ol>
  8164. <li> Investing money
  8165. <li> Losing money
  8166. <ol class=brief><li> Poor judgement
  8167. </ol>
  8168. </ol>
  8169. </ol>
  8170. <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>
  8171. </div>
  8172. <div class=example>
  8173. <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
  8174. effect:</p>
  8175. <pre>&lt;!DOCTYPE HTML>
  8176. &lt;title>The Tax Book (all in one page)&lt;/title>
  8177. &lt;h1>The Tax Book&lt;/h1>
  8178. &lt;section>
  8179. &lt;h1>Earning money&lt;/h1>
  8180. &lt;p>Earning money is good.&lt;/p>
  8181. &lt;section>
  8182. &lt;h1>Getting a job&lt;/h1>
  8183. &lt;p>To earn money you typically need a job.&lt;/p>
  8184. &lt;/section>
  8185. &lt;/section>
  8186. &lt;section>
  8187. &lt;h1>Spending money&lt;/h1>
  8188. &lt;p>Spending is what money is mainly used for.&lt;/p>
  8189. &lt;section>
  8190. &lt;h1>Cheap things&lt;/h1>
  8191. &lt;p>Buying cheap things often not cost-effective.&lt;/p>
  8192. &lt;/section>
  8193. &lt;section>
  8194. &lt;h1>Expensive things&lt;/h1>
  8195. &lt;p>The most expensive thing is often not the most cost-effective either.&lt;/p>
  8196. &lt;/section>
  8197. &lt;/section>
  8198. &lt;section>
  8199. &lt;h1>Investing money&lt;/h1>
  8200. &lt;p>You can lend your money to other people.&lt;/p>
  8201. &lt;/section>
  8202. &lt;section>
  8203. &lt;h1>Losing money&lt;/h1>
  8204. &lt;p>If you spend money or invest money, sooner or later you will lose money.
  8205. &lt;section>
  8206. &lt;h1>Poor judgement&lt;/h1>
  8207. &lt;p>Usually if you lose money it's because you made a mistake.&lt;/p>
  8208. &lt;/section>
  8209. &lt;/section></pre>
  8210. <p>This book would form the same outline:</p>
  8211. <ol class=brief><li> The Tax Book
  8212. <ol class=brief><li> Earning money
  8213. <ol class=brief><li> Getting a job
  8214. </ol>
  8215. <li> Spending money
  8216. <ol class=brief><li> Cheap things
  8217. <li> Expensive things
  8218. </ol>
  8219. <li> Investing money
  8220. <li> Losing money
  8221. <ol class=brief><li> Poor judgement
  8222. </ol>
  8223. </ol>
  8224. </ol>
  8225. </div>
  8226. <div class=example>
  8227. <p>A document can contain multiple top-level headings:</p>
  8228. <pre>&lt;!DOCTYPE HTML>
  8229. &lt;title>Alphabetic Fruit&lt;/title>
  8230. &lt;h1>Apples&lt;/h1>
  8231. &lt;p>Pomaceous.&lt;/p>
  8232. &lt;h1>Bananas&lt;/h1>
  8233. &lt;p>Edible.&lt;/p>
  8234. &lt;h1>Carambola&lt;/h1>
  8235. &lt;p>Star.&lt;/p></pre>
  8236. <p>This would form the following simple outline consisting of three top-level sections:</p>
  8237. <ol class=brief><li> Apples
  8238. <li> Bananas
  8239. <li> Carambola
  8240. </ol>
  8241. <p>Effectively, the <code id=sample-outlines:the-body-element><a href=#the-body-element>body</a></code> element is split into three.</p>
  8242. </div>
  8243. <div class=example>
  8244. <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
  8245. <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>
  8246. <p>Consider for example the following, which is just the previous example but with the contents
  8247. 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>
  8248. <pre>&lt;!DOCTYPE HTML>
  8249. &lt;title>Alphabetic Fruit&lt;/title>
  8250. &lt;section>
  8251. &lt;h1>Apples&lt;/h1>
  8252. &lt;p>Pomaceous.&lt;/p>
  8253. &lt;h1>Bananas&lt;/h1>
  8254. &lt;p>Edible.&lt;/p>
  8255. &lt;h1>Carambola&lt;/h1>
  8256. &lt;p>Star.&lt;/p>
  8257. &lt;/section></pre>
  8258. <p>The resulting outline would be:</p>
  8259. <ol class=brief><li> <i>(untitled page)</i>
  8260. <ol class=brief><li> Apples
  8261. <li> Bananas
  8262. <li> Carambola
  8263. </ol>
  8264. </ol>
  8265. <p>This result is described as <i>unintuitive</i> because it results in three subsections even
  8266. 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
  8267. 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>
  8268. <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>
  8269. element, since it has no explicit heading.)</p>
  8270. </div>
  8271. <div class=example>
  8272. <p>Headings never rise above other sections. Thus, in the following example, the first
  8273. <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
  8274. second half of the page:</p>
  8275. <pre>&lt;!DOCTYPE HTML>
  8276. &lt;title>Feathers on The Site of Encyclopedic Knowledge&lt;/title>
  8277. &lt;section>
  8278. &lt;h1>A plea from our caretakers&lt;/h1>
  8279. &lt;p>Please, we beg of you, send help! We're stuck in the server room!&lt;/p>
  8280. &lt;/section>
  8281. &lt;h1>Feathers&lt;/h1>
  8282. &lt;p>Epidermal growths.&lt;/p>
  8283. </pre>
  8284. <p>The resulting outline would be:</p>
  8285. <ol class=brief><li> <i>(untitled page)</i>
  8286. <ol class=brief><li> A plea from our caretakers
  8287. </ol>
  8288. <li> Feathers
  8289. </ol>
  8290. </div>
  8291. <div class=example>
  8292. <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
  8293. 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
  8294. 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>
  8295. <pre>&lt;!DOCTYPE HTML>
  8296. &lt;title>We're adopting a child! — Ray's blog&lt;/title>
  8297. &lt;h1>Ray's blog&lt;/h1>
  8298. &lt;article>
  8299. &lt;header>
  8300. &lt;nav>
  8301. &lt;a href="?t=-1d">Yesterday&lt;/a>;
  8302. &lt;a href="?t=-7d">Last week&lt;/a>;
  8303. &lt;a href="?t=-1m">Last month&lt;/a>
  8304. &lt;/nav>
  8305. &lt;h1>We're adopting a child!&lt;/h1>
  8306. &lt;/header>
  8307. &lt;main>
  8308. &lt;p>As of today, Janine and I have signed the papers to become
  8309. the proud parents of baby Diane! We've been looking forward to
  8310. this day for weeks.&lt;/p>
  8311. &lt;/main>
  8312. &lt;/article></pre>
  8313. <p>The resulting outline would be:</p>
  8314. <ol class=brief><li> Ray's blog
  8315. <ol class=brief><li> <i>Untitled article</i>
  8316. <ol class=brief><li> <i>Untitled navigation section</i>
  8317. </ol>
  8318. <li> We're adopting a child!
  8319. </ol>
  8320. </ol>
  8321. <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>
  8322. elements have no effect whatsoever on the document outline.</p>
  8323. </div>
  8324. <div class=example>
  8325. <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>
  8326. <pre>&lt;!DOCTYPE HTML>
  8327. &lt;title>Chronotype: CS Student&lt;/title>
  8328. &lt;hgroup>
  8329. &lt;h1> The morning &lt;/h1>
  8330. &lt;h2> 06:00 to 12:00 &lt;/h2>
  8331. &lt;/hgroup>
  8332. &lt;p>We sleep.&lt;/p>
  8333. &lt;hgroup>
  8334. &lt;h1> The afternoon &lt;/h1>
  8335. &lt;h2> 12:00 to 18:00 &lt;/h2>
  8336. &lt;/hgroup>
  8337. &lt;p>We study.&lt;/p>
  8338. &lt;hgroup>
  8339. &lt;h2>Additional Commentary&lt;/h2>
  8340. &lt;h3>Because not all this is necessarily true&lt;/h3>
  8341. &lt;h6>Ok it's almost certainly not true&lt;/h6>
  8342. &lt;/hgroup>
  8343. &lt;p>Yeah we probably play, rather than study.&lt;/p>
  8344. &lt;hgroup>
  8345. &lt;h1> The evening &lt;/h1>
  8346. &lt;h2> 18:00 to 00:00 &lt;/h2>
  8347. &lt;/hgroup>
  8348. &lt;p>We play.&lt;/p>
  8349. &lt;hgroup>
  8350. &lt;h1> The night &lt;/h1>
  8351. &lt;h2> 00:00 to 06:00 &lt;/h2>
  8352. &lt;/hgroup>
  8353. &lt;p>We play some more.&lt;/p></pre>
  8354. <p>The resulting outline would be:</p>
  8355. <ol class=brief><li> The morning <small>06:00 to 12:00</small>
  8356. <li> The afternoon <small>12:00 to 18:00</small>
  8357. <ol class=brief><li> Additional Commentary <small>Because not all this is necessarily true <small>Ok it's almost certainly not true</small></small>
  8358. </ol>
  8359. <li> The evening <small>18:00 to 00:00</small>
  8360. <li> The night <small>00:00 to 06:00</small>
  8361. </ol>
  8362. <p>Exactly how this is represented by user agents, as most interface issues, is left as a matter
  8363. 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
  8364. <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
  8365. following would be equally valid:</p>
  8366. <ol class=brief><li> The morning — 06:00 to 12:00
  8367. <li> The afternoon — 12:00 to 18:00
  8368. <ol class=brief><li> Additional Commentary — Because not all this is necessarily true — Ok it's almost certainly not true
  8369. </ol>
  8370. <li> The evening — 18:00 to 00:00
  8371. <li> The night — 00:00 to 06:00
  8372. </ol>
  8373. <p>But so would the following:</p>
  8374. <ol class=brief><li> The morning
  8375. <li> The afternoon
  8376. <ol class=brief><li> Additional Commentary
  8377. </ol>
  8378. <li> The evening
  8379. <li> The night
  8380. </ol>
  8381. <p>The following would also be valid, though maybe less practical in most contexts:</p>
  8382. <ol class=brief><li> <p>The morning
  8383. <p> 06:00 to 12:00
  8384. <li> <p>The afternoon
  8385. <p> 12:00 to 18:00
  8386. <ol class=brief><li> <p> Additional Commentary
  8387. <p> Because not all this is necessarily true
  8388. <p> Ok it's almost certainly not true
  8389. </ol>
  8390. <li> <p>The evening
  8391. <p> 18:00 to 00:00
  8392. <li> <p>The night
  8393. <p> 00:00 to 06:00
  8394. </ol>
  8395. </div>
  8396. <h5 id=exposing-outlines-to-users>4.3.11.3 Exposing outlines to users</h5>
  8397. <p>User agents are encouraged to expose page outlines to users to aid in navigation. This is
  8398. especially true for non-visual media, e.g. screen readers.</p>
  8399. <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
  8400. content</a>, user agents are also encouraged to offer a mode that navigates the page using
  8401. <a href=#heading-content-2 id=exposing-outlines-to-users:heading-content-2>heading content</a> alone.</p>
  8402. <div class=example>
  8403. <p>For instance, a user agent could map the arrow keys as follows:</p>
  8404. <dl><dt><kbd><kbd>Shift</kbd>+<kbd>← Left</kbd></kbd>
  8405. <dd>Go to previous section, including subsectons of previous sections
  8406. <dt><kbd><kbd>Shift</kbd>+<kbd>→ Right</kbd></kbd>
  8407. <dd>Go to next section, including subsections of the current section
  8408. <dt><kbd><kbd>Shift</kbd>+<kbd>↑ Up</kbd></kbd>
  8409. <dd>Go to parent section of the current section
  8410. <dt><kbd><kbd>Shift</kbd>+<kbd>↓ Down</kbd></kbd>
  8411. <dd>Go to next section, skipping subsections of the current section
  8412. </dl>
  8413. <p>Plus in addition, the user agent could map the <kbd><kbd>j</kbd></kbd> and
  8414. <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
  8415. content</a>, regardless of the section's outline depth and ignoring sections with no
  8416. headings.</p>
  8417. </div>
  8418. <h4 id=usage-summary-2>4.3.12 Usage summary</h4>
  8419. <p><i>This section is non-normative.</i></p>
  8420. <table class=vertical-summary-table><thead><tr><th rowspan=2>Element
  8421. <th>Purpose
  8422. <tr><th>Example
  8423. <tbody><tr><td rowspan=2><code id=usage-summary-2:the-body-element><a href=#the-body-element>body</a></code>
  8424. <td>The main content of the document.
  8425. <tr><td><pre class=example>&lt;!DOCTYPE HTML>
  8426. &lt;html>
  8427. &lt;head> &lt;title>Steve Hill's Home Page&lt;/title> &lt;/head>
  8428. <strong>&lt;body></strong> &lt;p>Hard Trance is My Life.&lt;/p> <strong>&lt;/body></strong>
  8429. &lt;/html></pre>
  8430. <tr><td rowspan=2><code id=usage-summary-2:the-article-element><a href=#the-article-element>article</a></code>
  8431. <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.
  8432. <tr><td><pre class=example><strong>&lt;article></strong>
  8433. &lt;img src="/tumblr_masqy2s5yn1rzfqbpo1_500.jpg" alt="Yellow smiley face with the caption 'masif'">
  8434. &lt;p>My fave Masif tee so far!&lt;/p>
  8435. &lt;footer>Posted 2 days ago&lt;/footer>
  8436. <strong>&lt;/article></strong>
  8437. <strong>&lt;article></strong>
  8438. &lt;img src="/tumblr_m9tf6wSr6W1rzfqbpo1_500.jpg" alt="">
  8439. &lt;p>Happy 2nd birthday Masif Saturdays!!!&lt;/p>
  8440. &lt;footer>Posted 3 weeks ago&lt;/footer>
  8441. <strong>&lt;/article></strong></pre>
  8442. <tr><td rowspan=2><code id=usage-summary-2:the-section-element><a href=#the-section-element>section</a></code>
  8443. <td>A generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
  8444. <tr><td><pre class=example>&lt;h1>Biography&lt;/h1>
  8445. <strong>&lt;section></strong>
  8446. &lt;h1>The facts&lt;/h1>
  8447. &lt;p>1500+ shows, 14+ countries&lt;/p>
  8448. <strong>&lt;/section></strong>
  8449. <strong>&lt;section></strong>
  8450. &lt;h1>2010/2011 figures per year&lt;/h1>
  8451. &lt;p>100+ shows, 8+ countries&lt;/p>
  8452. <strong>&lt;/section></strong></pre>
  8453. <tr><td rowspan=2><code id=usage-summary-2:the-nav-element><a href=#the-nav-element>nav</a></code>
  8454. <td>A section of a page that links to other pages or to parts within the page: a section with navigation links.
  8455. <tr><td><pre class=example><strong>&lt;nav></strong>
  8456. &lt;p>&lt;a href="/">Home&lt;/a>
  8457. &lt;p>&lt;a href="/biog.html">Bio&lt;/a>
  8458. &lt;p>&lt;a href="/discog.html">Discog&lt;/a>
  8459. <strong>&lt;/nav></strong></pre>
  8460. <tr><td rowspan=2><code id=usage-summary-2:the-aside-element><a href=#the-aside-element>aside</a></code>
  8461. <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.
  8462. <tr><td><pre class=example>&lt;h1>Music&lt;/h1>
  8463. &lt;p>As any burner can tell you, the event has a lot of trance.&lt;/p>
  8464. <strong>&lt;aside></strong>You can buy the music we played at our &lt;a href="buy.html">playlist page&lt;/a>.<strong>&lt;/aside></strong>
  8465. &lt;p>This year we played a kind of trance that originated in Belgium, Germany, and the Netherlands in the mid 90s.&lt;/p></pre>
  8466. <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>
  8467. <td>A section heading
  8468. <tr><td><pre class=example><strong>&lt;h1></strong>The Guide To Music On The Playa<strong>&lt;/h1></strong>
  8469. <strong>&lt;h2></strong>The Main Stage<strong>&lt;/h2></strong>
  8470. &lt;p>If you want to play on a stage, you should bring one.&lt;/p>
  8471. <strong>&lt;h2></strong>Amplified Music<strong>&lt;/h2></strong>
  8472. &lt;p>Amplifiers up to 300W or 90dB are welcome.&lt;/p></pre>
  8473. <tr><td rowspan=2><code id=usage-summary-2:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>
  8474. <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.
  8475. <tr><td><pre class=example><strong>&lt;hgroup></strong>
  8476. &lt;h1>Burning Music&lt;/h1>
  8477. &lt;h2>The Guide To Music On The Playa&lt;/h2>
  8478. <strong>&lt;/hgroup></strong>
  8479. &lt;section>
  8480. <strong>&lt;hgroup></strong>
  8481. &lt;h1>Main Stage&lt;/h1>
  8482. &lt;h2>The Fiction Of A Music Festival&lt;/h2>
  8483. <strong>&lt;/hgroup></strong>
  8484. &lt;p>If you want to play on a stage, you should bring one.&lt;/p>
  8485. &lt;/section>
  8486. &lt;section>
  8487. <strong>&lt;hgroup></strong>
  8488. &lt;h1>Loudness!&lt;/h1>
  8489. &lt;h2>Questions About Amplified Music&lt;/h2>
  8490. <strong>&lt;/hgroup></strong>
  8491. &lt;p>Amplifiers up to 300W or 90dB are welcome.&lt;/p>
  8492. &lt;/section></pre>
  8493. <tr><td rowspan=2><code id=usage-summary-2:the-header-element><a href=#the-header-element>header</a></code>
  8494. <td>A group of introductory or navigational aids.
  8495. <tr><td><pre class=example>&lt;article>
  8496. <strong>&lt;header></strong>
  8497. &lt;h1>Hard Trance is My Life&lt;/h1>
  8498. &lt;p>By DJ Steve Hill and Technikal&lt;/p>
  8499. <strong>&lt;/header></strong>
  8500. &lt;p>The album with the amusing punctuation has red artwork.&lt;/p>
  8501. &lt;/article></pre>
  8502. <tr><td rowspan=2><code id=usage-summary-2:the-footer-element><a href=#the-footer-element>footer</a></code>
  8503. <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.
  8504. <tr><td><pre class=example>&lt;article>
  8505. &lt;h1>Hard Trance is My Life&lt;/h1>
  8506. &lt;p>The album with the amusing punctuation has red artwork.&lt;/p>
  8507. <strong>&lt;footer></strong>
  8508. &lt;p>Artists: DJ Steve Hill and Technikal&lt;/p>
  8509. <strong>&lt;/footer></strong>
  8510. &lt;/article></pre>
  8511. </table>
  8512. <h5 id=article-or-section>4.3.12.1 Article or section?</h5>
  8513. <p><i>This section is non-normative.</i></p>
  8514. <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.
  8515. But how does one know which is which? Mostly the real answer is "it depends on author intent".</p>
  8516. <p>For example, one could imagine a book with a "Granny Smith" chapter that just said "These
  8517. 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>
  8518. because there'd be lots of other chapters on (maybe) other kinds of apples.</p>
  8519. <p>On the other hand, one could imagine a tweet or reddit comment or tumblr post or newspaper
  8520. classified ad that just said "Granny Smith. These juicy, green apples make a great filling for
  8521. 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>
  8522. <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,
  8523. therefore it is its own <code id=article-or-section:the-article-element-4><a href=#the-article-element>article</a></code>.</p>
  8524. <h3 id=grouping-content>4.4 Grouping content</h3>
  8525. <h4 id=the-p-element>4.4.1 The <dfn><code>p</code></dfn> element</h4>
  8526. <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
  8527. <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>,
  8528. <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>,
  8529. <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>,
  8530. <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>,
  8531. <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>,
  8532. <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
  8533. <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
  8534. 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>
  8535. <pre class=idl>interface <dfn id=htmlparagraphelement>HTMLParagraphElement</dfn> : <a href=#htmlelement id=the-p-element:htmlelement>HTMLElement</a> {
  8536. // <a href="#HTMLParagraphElement-partial">also has obsolete members</a>
  8537. };</pre>
  8538. </dl>
  8539. <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>
  8540. <p class=note>While paragraphs are usually represented in visual media by blocks of text that
  8541. are physically separated from adjacent blocks through blank lines, a style sheet or user agent
  8542. would be equally justified in presenting paragraph breaks in a different manner, for instance
  8543. using inline pilcrows (¶).</p>
  8544. <div class=example>
  8545. <p>The following examples are conforming HTML fragments:</p>
  8546. <pre>&lt;p>The little kitten gently seated himself on a piece of
  8547. carpet. Later in his life, this would be referred to as the time the
  8548. cat sat on the mat.&lt;/p></pre>
  8549. <pre>&lt;fieldset>
  8550. &lt;legend>Personal information&lt;/legend>
  8551. &lt;p>
  8552. &lt;label>Name: &lt;input name="n">&lt;/label>
  8553. &lt;label>&lt;input name="anon" type="checkbox"> Hide from other users&lt;/label>
  8554. &lt;/p>
  8555. &lt;p>&lt;label>Address: &lt;textarea name="a">&lt;/textarea>&lt;/label>&lt;/p>
  8556. &lt;/fieldset></pre>
  8557. <pre>&lt;p>There was once an example from Femley,&lt;br>
  8558. Whose markup was of dubious quality.&lt;br>
  8559. The validator complained,&lt;br>
  8560. So the author was pained,&lt;br>
  8561. To move the error from the markup to the rhyming.&lt;/p></pre>
  8562. </div>
  8563. <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
  8564. appropriate.</p>
  8565. <div class=example>
  8566. <p>The following example is technically correct:</p>
  8567. <pre>&lt;section>
  8568. &lt;!-- ... -->
  8569. &lt;p>Last modified: 2001-04-23&lt;/p>
  8570. &lt;p>Author: fred@example.com&lt;/p>
  8571. &lt;/section></pre>
  8572. <p>However, it would be better marked-up as:</p>
  8573. <pre>&lt;section>
  8574. &lt;!-- ... -->
  8575. &lt;footer>Last modified: 2001-04-23&lt;/footer>
  8576. &lt;address>Author: fred@example.com&lt;/address>
  8577. &lt;/section></pre>
  8578. <p>Or:</p>
  8579. <pre>&lt;section>
  8580. &lt;!-- ... -->
  8581. &lt;footer>
  8582. &lt;p>Last modified: 2001-04-23&lt;/p>
  8583. &lt;address>Author: fred@example.com&lt;/address>
  8584. &lt;/footer>
  8585. &lt;/section></pre>
  8586. </div>
  8587. <div class=note>
  8588. <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
  8589. 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
  8590. how it should be marked up.</p>
  8591. <div class=example>
  8592. <p>For instance, this fantastic sentence has bullets relating to</p>
  8593. <ul><li>wizards,
  8594. <li>faster-than-light travel, and
  8595. <li>telepathy,
  8596. </ul>
  8597. <p>and is further discussed below.</p>
  8598. </div>
  8599. <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
  8600. logical concept, but a structural one. In the fantastic example above, there are actually
  8601. <em>five</em> <a href=#paragraph id=the-p-element:paragraph-3>paragraphs</a> as defined by this specification: one
  8602. before the list, one for each bullet, and one after the list.</p>
  8603. <div class=example>
  8604. <p>The markup for the above example could therefore be:</p>
  8605. <pre>&lt;p>For instance, this fantastic sentence has bullets relating to&lt;/p>
  8606. &lt;ul>
  8607. &lt;li>wizards,
  8608. &lt;li>faster-than-light travel, and
  8609. &lt;li>telepathy,
  8610. &lt;/ul>
  8611. &lt;p>and is further discussed below.&lt;/p></pre>
  8612. </div>
  8613. <p>Authors wishing to conveniently style such "logical" paragraphs consisting of multiple
  8614. "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>
  8615. element.</p>
  8616. <div class=example>
  8617. <p>Thus for instance the above example could become the following:</p>
  8618. <pre>&lt;div>For instance, this fantastic sentence has bullets relating to
  8619. &lt;ul>
  8620. &lt;li>wizards,
  8621. &lt;li>faster-than-light travel, and
  8622. &lt;li>telepathy,
  8623. &lt;/ul>
  8624. and is further discussed below.&lt;/div></pre>
  8625. <p>This example still has five structural paragraphs, but now the author can style just the
  8626. <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>
  8627. </div>
  8628. </div>
  8629. <h4 id=the-hr-element>4.4.2 The <dfn><code>hr</code></dfn> element</h4>
  8630. <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>
  8631. <pre class=idl>interface <dfn id=htmlhrelement>HTMLHRElement</dfn> : <a href=#htmlelement id=the-hr-element:htmlelement>HTMLElement</a> {
  8632. // <a href="#HTMLHRElement-partial">also has obsolete members</a>
  8633. };</pre>
  8634. </dl>
  8635. <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
  8636. break, e.g. a scene change in a story, or a transition to another topic within a section of a
  8637. reference book.</p>
  8638. <div class=example>
  8639. <p>The following fictional extract from a project manual shows two sections that use the
  8640. <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>
  8641. <pre>&lt;section>
  8642. &lt;h1>Communication&lt;/h1>
  8643. &lt;p>There are various methods of communication. This section
  8644. covers a few of the important ones used by the project.&lt;/p>
  8645. <strong>&lt;hr></strong>
  8646. &lt;p>Communication stones seem to come in pairs and have mysterious
  8647. properties:&lt;/p>
  8648. &lt;ul>
  8649. &lt;li>They can transfer thoughts in two directions once activated
  8650. if used alone.&lt;/li>
  8651. &lt;li>If used with another device, they can transfer one's
  8652. consciousness to another body.&lt;/li>
  8653. &lt;li>If both stones are used with another device, the
  8654. consciousnesses switch bodies.&lt;/li>
  8655. &lt;/ul>
  8656. <strong>&lt;hr></strong>
  8657. &lt;p>Radios use the electromagnetic spectrum in the meter range and
  8658. longer.&lt;/p>
  8659. <strong>&lt;hr></strong>
  8660. &lt;p>Signal flares use the electromagnetic spectrum in the
  8661. nanometer range.&lt;/p>
  8662. &lt;/section>
  8663. &lt;section>
  8664. &lt;h1>Food&lt;/h1>
  8665. &lt;p>All food at the project is rationed:&lt;/p>
  8666. &lt;dl>
  8667. &lt;dt>Potatoes&lt;/dt>
  8668. &lt;dd>Two per day&lt;/dd>
  8669. &lt;dt>Soup&lt;/dt>
  8670. &lt;dd>One bowl per day&lt;/dd>
  8671. &lt;/dl>
  8672. <strong>&lt;hr></strong>
  8673. &lt;p>Cooking is done by the chefs on a set rotation.&lt;/p>
  8674. &lt;/section></pre>
  8675. <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
  8676. <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
  8677. themselves.</p>
  8678. </div>
  8679. <div class=example>
  8680. <p>The following extract from <cite>Pandora's Star</cite> by Peter F. Hamilton shows two
  8681. paragraphs that precede a scene change and the paragraph that follows it. The scene change,
  8682. represented in the printed book by a gap containing a solitary centered star between the second
  8683. 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>
  8684. <pre lang=en-GB>&lt;p>Dudley was ninety-two, in his second life, and fast approaching
  8685. time for another rejuvenation. Despite his body having the physical
  8686. age of a standard fifty-year-old, the prospect of a long degrading
  8687. campaign within academia was one he regarded with dread. For a
  8688. supposedly advanced civilization, the Intersolar Commonwealth could be
  8689. appallingly backward at times, not to mention cruel.&lt;/p>
  8690. &lt;p>&lt;i>Maybe it won't be that bad&lt;/i>, he told himself. The lie was
  8691. comforting enough to get him through the rest of the night's
  8692. shift.&lt;/p>
  8693. <strong>&lt;hr></strong>
  8694. &lt;p>The Carlton AllLander drove Dudley home just after dawn. Like the
  8695. astronomer, the vehicle was old and worn, but perfectly capable of
  8696. doing its job. It had a cheap diesel engine, common enough on a
  8697. semi-frontier world like Gralmond, although its drive array was a
  8698. thoroughly modern photoneural processor. With its high suspension and
  8699. deep-tread tyres it could plough along the dirt track to the
  8700. observatory in all weather and seasons, including the metre-deep snow
  8701. of Gralmond's winters.&lt;/p></pre>
  8702. </div>
  8703. <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
  8704. <a href=#outline id=the-hr-element:outline>outline</a>.</p>
  8705. <h4 id=the-pre-element>4.4.3 The <dfn><code>pre</code></dfn> element</h4>
  8706. <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>
  8707. <pre class=idl>interface <dfn id=htmlpreelement>HTMLPreElement</dfn> : <a href=#htmlelement id=the-pre-element:htmlelement>HTMLElement</a> {
  8708. // <a href="#HTMLPreElement-partial">also has obsolete members</a>
  8709. };</pre>
  8710. </dl>
  8711. <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
  8712. structure is represented by typographic conventions rather than by elements.</p>
  8713. <p class=note>In <a href=#syntax id=the-pre-element:syntax>the HTML syntax</a>, a leading newline character immediately following
  8714. the <code id=the-pre-element:the-pre-element-2><a href=#the-pre-element>pre</a></code> element start tag is stripped.</p>
  8715. <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>
  8716. <ul><li>Including an e-mail, with paragraphs indicated by blank lines, lists indicated by lines
  8717. prefixed with a bullet, and so on.<li>Including fragments of computer code, with structure indicated according to the conventions
  8718. of that language.<li>Displaying ASCII art.</ul>
  8719. <p class=note>Authors are encouraged to consider how preformatted text will be experienced when
  8720. the formatting is lost, as will be the case for users of speech synthesizers, braille displays,
  8721. and the like. For cases like ASCII art, it is likely that an alternative presentation, such as a
  8722. textual description, would be more universally accessible to the readers of the document.</p>
  8723. <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
  8724. <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
  8725. 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
  8726. 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>
  8727. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  8728. bidirectional algorithm</a>.</p>
  8729. <div class=example>
  8730. <p>In the following snippet, a sample of computer code is presented.</p>
  8731. <pre>&lt;p>This is the &lt;code>Panel&lt;/code> constructor:&lt;/p>
  8732. &lt;pre>&lt;code>function Panel(element, canClose, closeHandler) {
  8733. this.element = element;
  8734. this.canClose = canClose;
  8735. this.closeHandler = function () { if (closeHandler) closeHandler() };
  8736. }&lt;/code>&lt;/pre></pre>
  8737. </div>
  8738. <div class=example>
  8739. <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
  8740. 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>
  8741. <pre>&lt;pre>&lt;samp>You are in an open field west of a big white house with a boarded
  8742. front door.
  8743. There is a small mailbox here.
  8744. >&lt;/samp> &lt;kbd>open mailbox&lt;/kbd>
  8745. &lt;samp>Opening the mailbox reveals:
  8746. A leaflet.
  8747. >&lt;/samp>&lt;/pre></pre>
  8748. </div>
  8749. <div class=example>
  8750. <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
  8751. unusual formatting, which forms an intrinsic part of the poem itself.</p>
  8752. <pre>&lt;pre> maxling
  8753. it is with a heart
  8754. heavy
  8755. that i admit loss of a feline
  8756. so loved
  8757. a friend lost to the
  8758. unknown
  8759. (night)
  8760. ~cdr 11dec07&lt;/pre></pre>
  8761. </div>
  8762. <h4 id=the-blockquote-element>4.4.4 The <dfn><code>blockquote</code></dfn> element</h4>
  8763. <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>
  8764. <pre class=idl>interface <dfn id=htmlquoteelement>HTMLQuoteElement</dfn> : <a href=#htmlelement id=the-blockquote-element:htmlelement>HTMLElement</a> {
  8765. attribute DOMString <a href=#dom-quote-cite id=the-blockquote-element:dom-quote-cite>cite</a>;
  8766. };</pre>
  8767. <p class=note>The <code id=the-blockquote-element:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code> interface is
  8768. also used by the <code id=the-blockquote-element:the-q-element><a href=#the-q-element>q</a></code> element.</p>
  8769. </dl>
  8770. <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
  8771. another source.</p>
  8772. <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
  8773. it has one, may be cited in the <dfn id=attr-blockquote-cite><code>cite</code></dfn>
  8774. attribute.</p>
  8775. <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
  8776. <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
  8777. 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
  8778. citation links, but they are primarily intended for private use (e.g. by server-side scripts
  8779. collecting statistics about a site's use of quotations), not for readers.</p>
  8780. <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
  8781. conventional manner for the text's language.</p>
  8782. <div class=example>
  8783. <p>For example, in English this is traditionally done using square brackets. Consider a page with
  8784. the sentence "Fred ate the cracker. He then said he liked apples and fish."; it could be quoted
  8785. as follows:</p>
  8786. <pre>&lt;blockquote>
  8787. &lt;p>[Fred] then said he liked [...] fish.&lt;/p>
  8788. &lt;/blockquote></pre>
  8789. </div>
  8790. <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>
  8791. element.</p>
  8792. <div class=example>
  8793. <p>For example, here the attribution is given in a paragraph after the quote:</p>
  8794. <pre>&lt;blockquote>
  8795. &lt;p>I contend that we are both atheists. I just believe in one fewer
  8796. god than you do. When you understand why you dismiss all the other
  8797. possible gods, you will understand why I dismiss yours.&lt;/p>
  8798. &lt;/blockquote>
  8799. &lt;p>— Stephen Roberts&lt;/p></pre>
  8800. <p>The other examples below show other ways of showing attribution.</p>
  8801. </div>
  8802. <p>The <dfn id=dom-quote-cite><code>cite</code></dfn> IDL attribute must <a href=#reflect id=the-blockquote-element:reflect>reflect</a>
  8803. the element's <code>cite</code> content attribute.</p>
  8804. <div class=example>
  8805. <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>
  8806. 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
  8807. 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>
  8808. itself):</p>
  8809. <pre>&lt;figure>
  8810. &lt;blockquote>
  8811. &lt;p>The truth may be puzzling. It may take some work to grapple with.
  8812. It may be counterintuitive. It may contradict deeply held
  8813. prejudices. It may not be consonant with what we desperately want to
  8814. be true. But our preferences do not determine what's true. We have a
  8815. method, and that method helps us to reach not absolute truth, only
  8816. asymptotic approaches to the truth — never there, just closer
  8817. and closer, always finding vast new oceans of undiscovered
  8818. possibilities. Cleverly designed experiments are the key.&lt;/p>
  8819. &lt;/blockquote>
  8820. &lt;figcaption>Carl Sagan, in "&lt;cite>Wonder and Skepticism&lt;/cite>", from
  8821. the &lt;cite>Skeptical Enquirer&lt;/cite> Volume 19, Issue 1 (January-February
  8822. 1995)&lt;/figcaption>
  8823. &lt;/figure></pre>
  8824. </div>
  8825. <div class=example>
  8826. <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>
  8827. <pre>&lt;p>His next piece was the aptly named &lt;cite>Sonnet 130&lt;/cite>:&lt;/p>
  8828. &lt;blockquote cite="http://quotes.example.org/s/sonnet130.html">
  8829. &lt;p>My mistress' eyes are nothing like the sun,&lt;br>
  8830. Coral is far more red, than her lips red,&lt;br>
  8831. ...</pre>
  8832. </div>
  8833. <div class=example>
  8834. <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
  8835. 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
  8836. threading.</p>
  8837. <pre>&lt;article>
  8838. &lt;h1>&lt;a href="http://bacon.example.com/?blog=109431">Bacon on a crowbar&lt;/a>&lt;/h1>
  8839. &lt;article>
  8840. &lt;header>&lt;strong>t3yw&lt;/strong> 12 points 1 hour ago&lt;/header>
  8841. &lt;p>I bet a narwhal would love that.&lt;/p>
  8842. &lt;footer>&lt;a href="?pid=29578">permalink&lt;/a>&lt;/footer>
  8843. &lt;article>
  8844. &lt;header>&lt;strong>greg&lt;/strong> 8 points 1 hour ago&lt;/header>
  8845. &lt;blockquote>&lt;p>I bet a narwhal would love that.&lt;/p>&lt;/blockquote>
  8846. &lt;p>Dude narwhals don't eat bacon.&lt;/p>
  8847. &lt;footer>&lt;a href="?pid=29579">permalink&lt;/a>&lt;/footer>
  8848. &lt;article>
  8849. &lt;header>&lt;strong>t3yw&lt;/strong> 15 points 1 hour ago&lt;/header>
  8850. &lt;blockquote>
  8851. &lt;blockquote>&lt;p>I bet a narwhal would love that.&lt;/p>&lt;/blockquote>
  8852. &lt;p>Dude narwhals don't eat bacon.&lt;/p>
  8853. &lt;/blockquote>
  8854. &lt;p>Next thing you'll be saying they don't get capes and wizard
  8855. hats either!&lt;/p>
  8856. &lt;footer>&lt;a href="?pid=29580">permalink&lt;/a>&lt;/footer>
  8857. &lt;article>
  8858. &lt;article>
  8859. &lt;header>&lt;strong>boing&lt;/strong> -5 points 1 hour ago&lt;/header>
  8860. &lt;p>narwhals are worse than ceiling cat&lt;/p>
  8861. &lt;footer>&lt;a href="?pid=29581">permalink&lt;/a>&lt;/footer>
  8862. &lt;/article>
  8863. &lt;/article>
  8864. &lt;/article>
  8865. &lt;/article>
  8866. &lt;article>
  8867. &lt;header>&lt;strong>fred&lt;/strong> 1 points 23 minutes ago&lt;/header>
  8868. &lt;blockquote>&lt;p>I bet a narwhal would love that.&lt;/p>&lt;/blockquote>
  8869. &lt;p>I bet they'd love to peel a banana too.&lt;/p>
  8870. &lt;footer>&lt;a href="?pid=29582">permalink&lt;/a>&lt;/footer>
  8871. &lt;/article>
  8872. &lt;/article>
  8873. &lt;/article></pre>
  8874. </div>
  8875. <div class=example>
  8876. <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
  8877. 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>
  8878. <pre>&lt;p>He began his list of "lessons" with the following:&lt;/p>
  8879. &lt;blockquote>One should never assume that his side of
  8880. the issue will be recognized, let alone that it will
  8881. be conceded to have merits.&lt;/blockquote>
  8882. &lt;p>He continued with a number of similar points, ending with:&lt;/p>
  8883. &lt;blockquote>Finally, one should be prepared for the threat
  8884. of breakdown in negotiations at any given moment and not
  8885. be cowed by the possibility.&lt;/blockquote>
  8886. &lt;p>We shall now discuss these points...</pre>
  8887. </div>
  8888. <p class=note><a href=#conversations>Examples of how to represent a conversation</a> are shown
  8889. 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>
  8890. elements for this purpose.</p>
  8891. <h4 id=the-ol-element>4.4.5 The <dfn><code>ol</code></dfn> element</h4>
  8892. <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>
  8893. <pre class=idl>interface <dfn id=htmlolistelement>HTMLOListElement</dfn> : <a href=#htmlelement id=the-ol-element:htmlelement>HTMLElement</a> {
  8894. attribute boolean <a href=#dom-ol-reversed id=the-ol-element:dom-ol-reversed>reversed</a>;
  8895. attribute long <a href=#dom-ol-start id=the-ol-element:dom-ol-start>start</a>;
  8896. attribute DOMString <a href=#dom-ol-type id=the-ol-element:dom-ol-type>type</a>;
  8897. // <a href="#HTMLOListElement-partial">also has obsolete members</a>
  8898. };</pre>
  8899. </dl>
  8900. <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
  8901. intentionally ordered, such that changing the order would change the meaning of the document.</p>
  8902. <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>
  8903. element, in <a href=#tree-order id=the-ol-element:tree-order>tree order</a>.</p>
  8904. <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
  8905. attribute</a>. If present, it indicates that the list is a descending list (..., 3, 2, 1). If
  8906. the attribute is omitted, the list is an ascending list (1, 2, 3, ...).</p>
  8907. <p>The <dfn id=attr-ol-start><code>start</code></dfn> attribute, if present, must be a
  8908. <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>
  8909. <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
  8910. attribute's value. The default value, used if the attribute is missing or if the value cannot be
  8911. 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>
  8912. elements otherwise.</p>
  8913. <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>
  8914. 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
  8915. 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
  8916. 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>
  8917. <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
  8918. 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>
  8919. is absent, or minus one if it is present.</p>
  8920. <p>The <dfn id=attr-ol-type><code>type</code></dfn> attribute can be used to specify the kind
  8921. of marker to use in the list, in the cases where that matters (e.g. because items are to be
  8922. referenced by their number/letter). The attribute, if specified, must have a value that is a
  8923. <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
  8924. rows of the following table. The <code id=the-ol-element:attr-ol-type-2><a href=#attr-ol-type>type</a></code>
  8925. attribute represents the state given in the cell in the second column of the row whose first cell
  8926. matches the attribute's value; if none of the cells match, or if the attribute is omitted, then
  8927. the attribute represents the <a href=#attr-ol-type-state-decimal id=the-ol-element:attr-ol-type-state-decimal>decimal</a>
  8928. state.</p>
  8929. <table><thead><tr><th>Keyword
  8930. <th>State
  8931. <th>Description
  8932. <th colspan=8>Examples for values 1-3 and 3999-4001
  8933. <tbody><tr><td><dfn id=attr-ol-type-keyword-decimal><code>1</code></dfn> (U+0031)
  8934. <td><dfn id=attr-ol-type-state-decimal>decimal</dfn>
  8935. <td>Decimal numbers
  8936. <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>...
  8937. <tr><td><dfn id=attr-ol-type-keyword-lower-alpha><code>a</code></dfn> (U+0061)
  8938. <td><dfn id=attr-ol-type-state-lower-alpha>lower-alpha</dfn>
  8939. <td>Lowercase latin alphabet
  8940. <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>...
  8941. <tr><td><dfn id=attr-ol-type-keyword-upper-alpha><code>A</code></dfn> (U+0041)
  8942. <td><dfn id=attr-ol-type-state-upper-alpha>upper-alpha</dfn>
  8943. <td>Uppercase latin alphabet
  8944. <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>...
  8945. <tr><td><dfn id=attr-ol-type-keyword-lower-roman><code>i</code></dfn> (U+0069)
  8946. <td><dfn id=attr-ol-type-state-lower-roman>lower-roman</dfn>
  8947. <td>Lowercase roman numerals
  8948. <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>...
  8949. <tr><td><dfn id=attr-ol-type-keyword-upper-roman><code>I</code></dfn> (U+0049)
  8950. <td><dfn id=attr-ol-type-state-upper-roman>upper-roman</dfn>
  8951. <td>Uppercase roman numerals
  8952. <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>...
  8953. </table>
  8954. <p>User agents should render the items of the list in a manner consistent with the state of the
  8955. <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
  8956. 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>
  8957. <p class=note>For CSS user agents, a mapping for this attribute to the 'list-style-type' CSS
  8958. property is given <a href=#decohints>in the rendering section</a> (the mapping is
  8959. straightforward: the states above have the same names as their corresponding CSS values).</p>
  8960. <p class=note>It is possible to redefine the default CSS list styles used to implement this
  8961. attribute in CSS user agents; doing so will affect how list items are rendered.</p>
  8962. <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
  8963. 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
  8964. attribute has the same default as its content attribute.</p>
  8965. <div class=example>
  8966. <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>
  8967. 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>
  8968. 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>
  8969. <pre>&lt;p>I have lived in the following countries (given in the order of when
  8970. I first lived there):&lt;/p>
  8971. &lt;ol>
  8972. &lt;li>Switzerland
  8973. &lt;li>United Kingdom
  8974. &lt;li>United States
  8975. &lt;li>Norway
  8976. &lt;/ol></pre>
  8977. <p>Note how changing the order of the list changes the meaning of the document. In the following
  8978. example, changing the relative order of the first two items has changed the birthplace of the
  8979. author:</p>
  8980. <pre>&lt;p>I have lived in the following countries (given in the order of when
  8981. I first lived there):&lt;/p>
  8982. &lt;ol>
  8983. &lt;li>United Kingdom
  8984. &lt;li>Switzerland
  8985. &lt;li>United States
  8986. &lt;li>Norway
  8987. &lt;/ol></pre>
  8988. </div>
  8989. <h4 id=the-ul-element>4.4.6 The <dfn><code>ul</code></dfn> element</h4>
  8990. <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>
  8991. <pre class=idl>interface <dfn id=htmlulistelement>HTMLUListElement</dfn> : <a href=#htmlelement id=the-ul-element:htmlelement>HTMLElement</a> {
  8992. // <a href="#HTMLUListElement-partial">also has obsolete members</a>
  8993. };</pre>
  8994. </dl>
  8995. <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
  8996. items is not important — that is, where changing the order would not materially change the
  8997. meaning of the document.</p>
  8998. <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>
  8999. element.</p>
  9000. <div class=example>
  9001. <p>The following markup shows a list where the order does not matter, and where the
  9002. <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
  9003. <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>
  9004. element.</p>
  9005. <pre>&lt;p>I have lived in the following countries:&lt;/p>
  9006. &lt;ul>
  9007. &lt;li>Norway
  9008. &lt;li>Switzerland
  9009. &lt;li>United Kingdom
  9010. &lt;li>United States
  9011. &lt;/ul></pre>
  9012. <p>Note that changing the order of the list does not change the meaning of the document. The
  9013. items in the snippet above are given in alphabetical order, but in the snippet below they are
  9014. given in order of the size of their current account balance in 2007, without changing the meaning
  9015. of the document whatsoever:</p>
  9016. <pre>&lt;p>I have lived in the following countries:&lt;/p>
  9017. &lt;ul>
  9018. &lt;li>Switzerland
  9019. &lt;li>Norway
  9020. &lt;li>United Kingdom
  9021. &lt;li>United States
  9022. &lt;/ul></pre>
  9023. </div>
  9024. <h4 id=the-li-element>4.4.7 The <dfn><code>li</code></dfn> element</h4>
  9025. <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
  9026. <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
  9027. 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>
  9028. <pre class=idl>interface <dfn id=htmllielement>HTMLLIElement</dfn> : <a href=#htmlelement id=the-li-element:htmlelement>HTMLElement</a> {
  9029. attribute long <a href=#dom-li-value id=the-li-element:dom-li-value>value</a>;
  9030. // <a href="#HTMLLIElement-partial">also has obsolete members</a>
  9031. };</pre>
  9032. </dl>
  9033. <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
  9034. <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
  9035. parent element's list, as defined for those elements. Otherwise, the list item has no defined
  9036. 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>
  9037. <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
  9038. <dfn id=ordinal-value>ordinal value</dfn>.</p>
  9039. <p>The <dfn id=attr-li-value><code>value</code></dfn> attribute, if present, must be a
  9040. <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>
  9041. <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
  9042. attribute's value. If the attribute's value cannot be converted to a number, the attribute must be
  9043. treated as if it was absent. The attribute has no default value.</p>
  9044. <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
  9045. 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
  9046. effect.</p>
  9047. <p>The <dfn id=dom-li-value><code>value</code></dfn> IDL attribute must <a href=#reflect id=the-li-element:reflect>reflect</a>
  9048. the value of the <code id=the-li-element:attr-li-value-4><a href=#attr-li-value>value</a></code> content attribute.</p>
  9049. <div class=example>
  9050. <p>The following example, the top ten movies are listed (in reverse order). Note the way the list
  9051. 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>
  9052. element.</p>
  9053. <pre>&lt;figure>
  9054. &lt;figcaption>The top 10 movies of all time&lt;/figcaption>
  9055. &lt;ol>
  9056. &lt;li value="10">&lt;cite>Josie and the Pussycats&lt;/cite>, 2001&lt;/li>
  9057. &lt;li value="9">&lt;cite lang="sh">Црна мачка, бели мачор&lt;/cite>, 1998&lt;/li>
  9058. &lt;li value="8">&lt;cite>A Bug's Life&lt;/cite>, 1998&lt;/li>
  9059. &lt;li value="7">&lt;cite>Toy Story&lt;/cite>, 1995&lt;/li>
  9060. &lt;li value="6">&lt;cite>Monsters, Inc&lt;/cite>, 2001&lt;/li>
  9061. &lt;li value="5">&lt;cite>Cars&lt;/cite>, 2006&lt;/li>
  9062. &lt;li value="4">&lt;cite>Toy Story 2&lt;/cite>, 1999&lt;/li>
  9063. &lt;li value="3">&lt;cite>Finding Nemo&lt;/cite>, 2003&lt;/li>
  9064. &lt;li value="2">&lt;cite>The Incredibles&lt;/cite>, 2004&lt;/li>
  9065. &lt;li value="1">&lt;cite>Ratatouille&lt;/cite>, 2007&lt;/li>
  9066. &lt;/ol>
  9067. &lt;/figure></pre>
  9068. <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>
  9069. <pre>&lt;figure>
  9070. &lt;figcaption>The top 10 movies of all time&lt;/figcaption>
  9071. &lt;ol reversed>
  9072. &lt;li>&lt;cite>Josie and the Pussycats&lt;/cite>, 2001&lt;/li>
  9073. &lt;li>&lt;cite lang="sh">Црна мачка, бели мачор&lt;/cite>, 1998&lt;/li>
  9074. &lt;li>&lt;cite>A Bug's Life&lt;/cite>, 1998&lt;/li>
  9075. &lt;li>&lt;cite>Toy Story&lt;/cite>, 1995&lt;/li>
  9076. &lt;li>&lt;cite>Monsters, Inc&lt;/cite>, 2001&lt;/li>
  9077. &lt;li>&lt;cite>Cars&lt;/cite>, 2006&lt;/li>
  9078. &lt;li>&lt;cite>Toy Story 2&lt;/cite>, 1999&lt;/li>
  9079. &lt;li>&lt;cite>Finding Nemo&lt;/cite>, 2003&lt;/li>
  9080. &lt;li>&lt;cite>The Incredibles&lt;/cite>, 2004&lt;/li>
  9081. &lt;li>&lt;cite>Ratatouille&lt;/cite>, 2007&lt;/li>
  9082. &lt;/ol>
  9083. &lt;/figure></pre>
  9084. </div>
  9085. <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
  9086. <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
  9087. heading starts a new section, so a heading in a list implicitly splits the list into spanning
  9088. multiple sections.</p>
  9089. <h4 id=the-dl-element>4.4.8 The <dfn><code>dl</code></dfn> element</h4>
  9090. <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>
  9091. <pre class=idl>interface <dfn id=htmldlistelement>HTMLDListElement</dfn> : <a href=#htmlelement id=the-dl-element:htmlelement>HTMLElement</a> {
  9092. // <a href="#HTMLDListElement-partial">also has obsolete members</a>
  9093. };</pre>
  9094. </dl>
  9095. <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
  9096. more name-value groups (a description list). A name-value group consists of one or more names
  9097. (<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
  9098. 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>
  9099. 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>
  9100. <p>Name-value groups may be terms and definitions, metadata topics and values, questions and
  9101. answers, or any other groups of name-value data.</p>
  9102. <p>The values within a group are alternatives; multiple paragraphs forming part of the same value
  9103. 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>
  9104. <p>The order of the list of groups, and of the names and values within each group, may be
  9105. significant.</p>
  9106. <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
  9107. contains no groups.</p>
  9108. <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
  9109. 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
  9110. 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>
  9111. 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>
  9112. <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
  9113. <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>
  9114. <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
  9115. <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>
  9116. <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
  9117. <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>
  9118. <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
  9119. <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>
  9120. <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
  9121. 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
  9122. versa. Conformance checkers can spot such mistakes and might be able to advise authors how to
  9123. correctly use the markup.</p>
  9124. <div class=example>
  9125. <p>In the following example, one entry ("Authors") is linked to two values ("John" and
  9126. "Luke").</p>
  9127. <pre>&lt;dl>
  9128. &lt;dt> Authors
  9129. &lt;dd> John
  9130. &lt;dd> Luke
  9131. &lt;dt> Editor
  9132. &lt;dd> Frank
  9133. &lt;/dl></pre>
  9134. </div>
  9135. <div class=example>
  9136. <p>In the following example, one definition is linked to two terms.</p>
  9137. <pre>&lt;dl>
  9138. &lt;dt lang="en-US"> &lt;dfn>color&lt;/dfn> &lt;/dt>
  9139. &lt;dt lang="en-GB"> &lt;dfn>colour&lt;/dfn> &lt;/dt>
  9140. &lt;dd> A sensation which (in humans) derives from the ability of
  9141. the fine structure of the eye to distinguish three differently
  9142. filtered analyses of a view. &lt;/dd>
  9143. &lt;/dl></pre>
  9144. </div>
  9145. <div class=example>
  9146. <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
  9147. of sorts. At the end of the example, one group has two metadata labels ("Authors" and "Editors")
  9148. and two values ("Robert Rothman" and "Daniel Jackson").</p>
  9149. <pre>&lt;dl>
  9150. &lt;dt> Last modified time &lt;/dt>
  9151. &lt;dd> 2004-12-23T23:33Z &lt;/dd>
  9152. &lt;dt> Recommended update interval &lt;/dt>
  9153. &lt;dd> 60s &lt;/dd>
  9154. &lt;dt> Authors &lt;/dt>
  9155. &lt;dt> Editors &lt;/dt>
  9156. &lt;dd> Robert Rothman &lt;/dd>
  9157. &lt;dd> Daniel Jackson &lt;/dd>
  9158. &lt;/dl></pre>
  9159. </div>
  9160. <div class=example>
  9161. <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.
  9162. The order of the instructions here is important (in the other examples, the order of the blocks
  9163. was not important).</p>
  9164. <pre>&lt;p>Determine the victory points as follows (use the
  9165. first matching case):&lt;/p>
  9166. &lt;dl>
  9167. &lt;dt> If you have exactly five gold coins &lt;/dt>
  9168. &lt;dd> You get five victory points &lt;/dd>
  9169. &lt;dt> If you have one or more gold coins, and you have one or more silver coins &lt;/dt>
  9170. &lt;dd> You get two victory points &lt;/dd>
  9171. &lt;dt> If you have one or more silver coins &lt;/dt>
  9172. &lt;dd> You get one victory point &lt;/dd>
  9173. &lt;dt> Otherwise &lt;/dt>
  9174. &lt;dd> You get no victory points &lt;/dd>
  9175. &lt;/dl></pre>
  9176. </div>
  9177. <div class=example>
  9178. <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
  9179. of <code id=the-dl-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> to indicate the word being defined.</p>
  9180. <pre>&lt;dl>
  9181. &lt;dt>&lt;dfn>Apartment&lt;/dfn>, n.&lt;/dt>
  9182. &lt;dd>An execution context grouping one or more threads with one or
  9183. more COM objects.&lt;/dd>
  9184. &lt;dt>&lt;dfn>Flat&lt;/dfn>, n.&lt;/dt>
  9185. &lt;dd>A deflated tire.&lt;/dd>
  9186. &lt;dt>&lt;dfn>Home&lt;/dfn>, n.&lt;/dt>
  9187. &lt;dd>The user's login directory.&lt;/dd>
  9188. &lt;/dl></pre>
  9189. </div>
  9190. <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>
  9191. <h4 id=the-dt-element>4.4.9 The <dfn><code>dt</code></dfn> element</h4>
  9192. <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
  9193. <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
  9194. <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>
  9195. <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
  9196. 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>
  9197. <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
  9198. not indicate that its contents are a term being defined, but this can be indicated using the
  9199. <code id=the-dt-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> element.</p>
  9200. <div class=example>
  9201. <p>This example shows a list of frequently asked questions (a FAQ) marked up using the
  9202. <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>
  9203. <pre>&lt;article>
  9204. &lt;h1>FAQ&lt;/h1>
  9205. &lt;dl>
  9206. &lt;dt>What do we want?&lt;/dt>
  9207. &lt;dd>Our data.&lt;/dd>
  9208. &lt;dt>When do we want it?&lt;/dt>
  9209. &lt;dd>Now.&lt;/dd>
  9210. &lt;dt>Where is it?&lt;/dt>
  9211. &lt;dd>We are not sure.&lt;/dd>
  9212. &lt;/dl>
  9213. &lt;/article></pre>
  9214. </div>
  9215. <h4 id=the-dd-element>4.4.10 The <dfn><code>dd</code></dfn> element</h4>
  9216. <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
  9217. <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
  9218. <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>
  9219. <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
  9220. 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>
  9221. <div class=example>
  9222. <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
  9223. 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
  9224. <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>
  9225. <pre>&lt;dl>
  9226. &lt;dt>&lt;dfn>happiness&lt;/dfn>&lt;/dt>
  9227. &lt;dd class="pronunciation">/'hæ p. nes/&lt;/dd>
  9228. &lt;dd class="part-of-speech">&lt;i>&lt;abbr>n.&lt;/abbr>&lt;/i>&lt;/dd>
  9229. &lt;dd>The state of being happy.&lt;/dd>
  9230. &lt;dd>Good fortune; success. &lt;q>Oh &lt;b>happiness&lt;/b>! It worked!&lt;/q>&lt;/dd>
  9231. &lt;dt>&lt;dfn>rejoice&lt;/dfn>&lt;/dt>
  9232. &lt;dd class="pronunciation">/ri jois'/&lt;/dd>
  9233. &lt;dd>&lt;i class="part-of-speech">&lt;abbr>v.intr.&lt;/abbr>&lt;/i> To be delighted oneself.&lt;/dd>
  9234. &lt;dd>&lt;i class="part-of-speech">&lt;abbr>v.tr.&lt;/abbr>&lt;/i> To cause one to be delighted.&lt;/dd>
  9235. &lt;/dl></pre>
  9236. </div>
  9237. <h4 id=the-figure-element>4.4.11 The <dfn><code>figure</code></dfn> element</h4>
  9238. <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>
  9239. <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>,
  9240. optionally with a caption, that is self-contained (like a complete sentence) and is typically
  9241. referenced as a single unit from the main flow of the document.</p>
  9242. <p class=note>Self-contained in this context does not necessarily mean independent. For example,
  9243. each sentence in a paragraph is self-contained; an image that is part of a sentence would be
  9244. 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>
  9245. <p>The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc.</p>
  9246. <div class=note>
  9247. <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
  9248. it by its caption (e.g. by figure number), it enables such content to be easily moved away from
  9249. that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix, without
  9250. affecting the flow of the document.</p>
  9251. <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
  9252. photograph above" or "as the next figure shows", then moving the figure would disrupt the page's
  9253. meaning. Authors are encouraged to consider using labels to refer to figures, rather than using
  9254. such relative references, so that the page can easily be restyled without affecting the page's
  9255. meaning.</p>
  9256. </div>
  9257. <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
  9258. 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
  9259. <code id=the-figure-element:the-figcaption-element-4><a href=#the-figcaption-element>figcaption</a></code> element, then there is no caption.</p>
  9260. <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
  9261. the page is to display the figure, for example a photograph on an image sharing site, the
  9262. <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
  9263. caption for that figure. For content that is only tangentially related, or that serves a separate
  9264. 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
  9265. 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
  9266. <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
  9267. <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
  9268. the purposes of enticing readers or highlighting key topics.</p>
  9269. <div class=example>
  9270. <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>
  9271. <pre>&lt;p>In &lt;a href="#l4">listing 4&lt;/a> we see the primary core interface
  9272. API declaration.&lt;/p>
  9273. &lt;figure id="l4">
  9274. &lt;figcaption>Listing 4. The primary core interface API declaration.&lt;/figcaption>
  9275. &lt;pre>&lt;code>interface PrimaryCore {
  9276. boolean verifyDataLine();
  9277. void sendData(in sequence&amp;lt;byte> data);
  9278. void initSelfDestruct();
  9279. }&lt;/code>&lt;/pre>
  9280. &lt;/figure>
  9281. &lt;p>The API is designed to use UTF-8.&lt;/p></pre>
  9282. </div>
  9283. <div class=example>
  9284. <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
  9285. page (as in a gallery).</p>
  9286. <pre>&lt;!DOCTYPE HTML>
  9287. &lt;title>Bubbles at work — My Gallery™&lt;/title>
  9288. &lt;figure>
  9289. &lt;img src="bubbles-work.jpeg"
  9290. alt="Bubbles, sitting in his office chair, works on his
  9291. latest project intently.">
  9292. &lt;figcaption>Bubbles at work&lt;/figcaption>
  9293. &lt;/figure>
  9294. &lt;nav>&lt;a href="19414.html">Prev&lt;/a> — &lt;a href="19416.html">Next&lt;/a>&lt;/nav></pre>
  9295. </div>
  9296. <div class=example>
  9297. <p>In this example, we see an image that is <em>not</em> a figure, as well as an image and a
  9298. video that are. The first image is literally part of the example's second sentence, so it's not a
  9299. 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>
  9300. <pre>&lt;h2>Malinko's comics&lt;/h2>
  9301. &lt;p>This case centered on some sort of "intellectual property"
  9302. infringement related to a comic (see Exhibit A). The suit started
  9303. after a trailer ending with these words:
  9304. &lt;blockquote>
  9305. &lt;img src="promblem-packed-action.png" alt="ROUGH COPY! Promblem-Packed Action!">
  9306. &lt;/blockquote>
  9307. &lt;p>...was aired. A lawyer, armed with a Bigger Notebook, launched a
  9308. preemptive strike using snowballs. A complete copy of the trailer is
  9309. included with Exhibit B.
  9310. &lt;figure>
  9311. &lt;img src="ex-a.png" alt="Two squiggles on a dirty piece of paper.">
  9312. &lt;figcaption>Exhibit A. The alleged &lt;cite>rough copy&lt;/cite> comic.&lt;/figcaption>
  9313. &lt;/figure>
  9314. &lt;figure>
  9315. &lt;video src="ex-b.mov">&lt;/video>
  9316. &lt;figcaption>Exhibit B. The &lt;cite>Rough Copy&lt;/cite> trailer.&lt;/figcaption>
  9317. &lt;/figure>
  9318. &lt;p>The case was resolved out of court.</pre>
  9319. </div>
  9320. <div class=example>
  9321. <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>
  9322. <pre>&lt;figure>
  9323. &lt;p>'Twas brillig, and the slithy toves&lt;br>
  9324. Did gyre and gimble in the wabe;&lt;br>
  9325. All mimsy were the borogoves,&lt;br>
  9326. And the mome raths outgrabe.&lt;/p>
  9327. &lt;figcaption>&lt;cite>Jabberwocky&lt;/cite> (first verse). Lewis Carroll, 1832-98&lt;/figcaption>
  9328. &lt;/figure></pre>
  9329. </div>
  9330. <div class=example>
  9331. <p>In this example, which could be part of a much larger work discussing a castle, nested
  9332. <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
  9333. each figure in the group:</p>
  9334. <pre>&lt;figure>
  9335. &lt;figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.&lt;/figcaption>
  9336. &lt;figure>
  9337. &lt;figcaption>Etching. Anonymous, ca. 1423.&lt;/figcaption>
  9338. &lt;img src="castle1423.jpeg" alt="The castle has one tower, and a tall wall around it.">
  9339. &lt;/figure>
  9340. &lt;figure>
  9341. &lt;figcaption>Oil-based paint on canvas. Maria Towle, 1858.&lt;/figcaption>
  9342. &lt;img src="castle1858.jpeg" alt="The castle now has two towers and two walls.">
  9343. &lt;/figure>
  9344. &lt;figure>
  9345. &lt;figcaption>Film photograph. Peter Jankle, 1999.&lt;/figcaption>
  9346. &lt;img src="castle1999.jpeg" alt="The castle lies in ruins, the original tower all that remains in one piece.">
  9347. &lt;/figure>
  9348. &lt;/figure></pre>
  9349. </div>
  9350. <div class=example>
  9351. <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
  9352. <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>
  9353. <pre>&lt;figure>
  9354. &lt;img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
  9355. alt="The castle has one tower, and a tall wall around it.">
  9356. &lt;img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
  9357. alt="The castle now has two towers and two walls.">
  9358. &lt;img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
  9359. alt="The castle lies in ruins, the original tower all that remains in one piece.">
  9360. &lt;figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.&lt;/figcaption>
  9361. &lt;/figure></pre>
  9362. </div>
  9363. <div class=example>
  9364. <p>The figure is sometimes referenced only implicitly from the content:</p>
  9365. <pre>&lt;article>
  9366. &lt;h1>Fiscal negotiations stumble in Congress as deadline nears&lt;/h1>
  9367. &lt;figure>
  9368. &lt;img src="obama-reid.jpeg" alt="Obama and Reid sit together smiling in the Oval Office.">
  9369. &lt;figcaption>Barrak Obama and Harry Reid. White House press photograph.&lt;/figcaption>
  9370. &lt;/figure>
  9371. &lt;p>Negotiations in Congress to end the fiscal impasse sputtered on Tuesday, leaving both chambers
  9372. grasping for a way to reopen the government and raise the country's borrowing authority with a
  9373. Thursday deadline drawing near.&lt;/p>
  9374. ...
  9375. &lt;/article></pre>
  9376. </div>
  9377. <h4 id=the-figcaption-element>4.4.12 The <dfn><code>figcaption</code></dfn> element</h4>
  9378. <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>
  9379. <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
  9380. 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>
  9381. <h4 id=the-main-element>4.4.13 The <dfn><code>main</code></dfn> element</h4>
  9382. <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>
  9383. <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
  9384. element. It <a href=#represents id=the-main-element:represents>represents</a> its children.</p>
  9385. <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
  9386. <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
  9387. document <a href=#outline id=the-main-element:outline>outline</a>.</p>
  9388. <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
  9389. document. Indeed, there are many cases where it would make sense to have multiple
  9390. <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
  9391. need to indicate the dominant contents of each such element.</p>
  9392. <div class=example>
  9393. <p>In this example, the author has used a presentation where each component of the page is
  9394. rendered in a box. To wrap the main content of the page (as opposed to the header, the footer,
  9395. 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>
  9396. <pre>&lt;!DOCTYPE html>
  9397. &lt;title>RPG System 17&lt;/title>
  9398. &lt;style>
  9399. header, nav, aside, main, footer {
  9400. margin: 0.5em; border: thin solid; padding: 0.5em;
  9401. background: #EFF; color: black; box-shadow: 0 0 0.25em #033;
  9402. }
  9403. h1, h2, p { margin: 0; }
  9404. nav, main { float: left; }
  9405. aside { float: right; }
  9406. footer { clear: both; }
  9407. &lt;/style>
  9408. &lt;header>
  9409. &lt;h1>System Eighteen&lt;/h1>
  9410. &lt;/header>
  9411. &lt;nav>
  9412. &lt;a href="../16/">← System 17&lt;/a>
  9413. &lt;a href="../18/">RPXIX →&lt;/a>
  9414. &lt;/nav>
  9415. &lt;aside>
  9416. &lt;p>This system has no HP mechanic, so there's no healing.
  9417. &lt;/aside>
  9418. &lt;main>
  9419. &lt;h2>Character creation&lt;/h2>
  9420. &lt;p>Attributes (magic, strength, agility) are purchased at the cost of one point per level.&lt;/p>
  9421. &lt;h2>Rolls&lt;/h2>
  9422. &lt;p>Each encounter, roll the dice for all your skills. If you roll more than the opponent, you win.&lt;/p>
  9423. &lt;/main>
  9424. &lt;footer>
  9425. &lt;p>Copyright © 2013
  9426. &lt;/footer></pre>
  9427. </div>
  9428. <h4 id=the-div-element>4.4.14 The <dfn><code>div</code></dfn> element</h4>
  9429. <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>
  9430. <pre class=idl>interface <dfn id=htmldivelement>HTMLDivElement</dfn> : <a href=#htmlelement id=the-div-element:htmlelement>HTMLElement</a> {
  9431. // <a href="#HTMLDivElement-partial">also has obsolete members</a>
  9432. };</pre>
  9433. </dl>
  9434. <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
  9435. 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
  9436. semantics common to a group of consecutive elements.</p>
  9437. <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
  9438. of last resort, for when no other element is suitable. Use of more appropriate elements instead of
  9439. 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
  9440. for authors.</p>
  9441. <div class=example>
  9442. <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
  9443. <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
  9444. controls using <code id=the-div-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>.</p>
  9445. <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
  9446. multiple paragraphs within a section that are all to be annotated in a similar way. In the
  9447. 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
  9448. paragraphs at once, instead of setting the language on the two paragraph elements separately:</p>
  9449. <pre>&lt;article lang="en-US">
  9450. &lt;h1>My use of language and my cats&lt;/h1>
  9451. &lt;p>My cat's behavior hasn't changed much since her absence, except
  9452. that she plays her new physique to the neighbors regularly, in an
  9453. attempt to get pets.&lt;/p>
  9454. &lt;div lang="en-GB">
  9455. &lt;p>My other cat, coloured black and white, is a sweetie. He followed
  9456. us to the pool today, walking down the pavement with us. Yesterday
  9457. he apparently visited our neighbours. I wonder if he recognises that
  9458. their flat is a mirror image of ours.&lt;/p>
  9459. &lt;p>Hm, I just noticed that in the last paragraph I used British
  9460. English. But I'm supposed to write in American English. So I
  9461. shouldn't say "pavement" or "flat" or "colour"...&lt;/p>
  9462. &lt;/div>
  9463. &lt;p>I should say "sidewalk" and "apartment" and "color"!&lt;/p>
  9464. &lt;/article></pre>
  9465. </div>
  9466. <h3 id=text-level-semantics>4.5 Text-level semantics</h3>
  9467. <h4 id=the-a-element>4.5.1 The <dfn><code>a</code></dfn> element</h4>
  9468. <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>
  9469. <pre class=idl>interface <dfn id=htmlanchorelement>HTMLAnchorElement</dfn> : <a href=#htmlelement id=the-a-element:htmlelement>HTMLElement</a> {
  9470. attribute DOMString <a href=#dom-a-target id=the-a-element:dom-a-target>target</a>;
  9471. attribute DOMString <a href=#dom-a-download id=the-a-element:dom-a-download>download</a>;
  9472. [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>;
  9473. attribute DOMString <a href=#dom-a-rel id=the-a-element:dom-a-rel>rel</a>;
  9474. 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>;
  9475. attribute DOMString <a href=#dom-a-hreflang id=the-a-element:dom-a-hreflang>hreflang</a>;
  9476. attribute DOMString <a href=#dom-a-type id=the-a-element:dom-a-type>type</a>;
  9477. attribute DOMString <a href=#dom-a-text id=the-a-element:dom-a-text>text</a>;
  9478. // <a href="#HTMLAnchorElement-partial">also has obsolete members</a>
  9479. };
  9480. <a href=#htmlanchorelement id=the-a-element:htmlanchorelement>HTMLAnchorElement</a> implements <a href=#urlutils id=the-a-element:urlutils>URLUtils</a>;</pre>
  9481. </dl>
  9482. <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,
  9483. 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
  9484. contents.</p>
  9485. <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,
  9486. then the element <a href=#represents id=the-a-element:represents-2>represents</a> a placeholder for where a link might otherwise have been
  9487. placed, if it had been relevant, consisting of just the element's contents.</p>
  9488. <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>,
  9489. <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>
  9490. 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
  9491. present.</p>
  9492. <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,
  9493. 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>
  9494. <div class=example>
  9495. <p>If a site uses a consistent navigation toolbar on every page, then the link that would
  9496. 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>
  9497. <pre>&lt;nav>
  9498. &lt;ul>
  9499. &lt;li> &lt;a href="/">Home&lt;/a> &lt;/li>
  9500. &lt;li> &lt;a href="/news">News&lt;/a> &lt;/li>
  9501. &lt;li> &lt;a>Examples&lt;/a> &lt;/li>
  9502. &lt;li> &lt;a href="/legal">Legal&lt;/a> &lt;/li>
  9503. &lt;/ul>
  9504. &lt;/nav></pre>
  9505. </div>
  9506. <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>
  9507. attributes affect what happens when users <a href=#following-hyperlinks-2 id=the-a-element:following-hyperlinks-2>follow
  9508. hyperlinks</a> or <a href=#downloading-hyperlinks id=the-a-element:downloading-hyperlinks>download hyperlinks</a> created using
  9509. 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>
  9510. attributes may be used to indicate to the user the likely nature of the target resource before the
  9511. user follows the link.</p>
  9512. <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>
  9513. <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>
  9514. <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
  9515. 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>
  9516. 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
  9517. 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
  9518. in there not being a chosen browsing context, then run these substeps:</p>
  9519. <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
  9520. <code id=the-a-element:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.<li><p>Abort these steps without following the hyperlink.</ol>
  9521. <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>
  9522. element with an <code id=the-a-element:attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> attribute specified, then server-side
  9523. image map processing must be performed, as follows:</p>
  9524. <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
  9525. <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,
  9526. if it has one, or the left edge of the image otherwise, to the location of the click, and let
  9527. <var>y</var> be the distance in CSS pixels from the top edge of the image's top
  9528. border, if it has one, or the top edge of the image otherwise, to the location of the click.
  9529. 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
  9530. 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>,
  9531. a U+002C COMMA character (,), and the value of <var>y</var> expressed as a base-ten
  9532. integer using <a href=#ascii-digits id=the-a-element:ascii-digits-2>ASCII digits</a>.</ol>
  9533. <li><p>Finally, the user agent must <a href=#following-hyperlinks-2 id=the-a-element:following-hyperlinks-2-2>follow the
  9534. hyperlink</a> or <a href=#downloading-hyperlinks id=the-a-element:downloading-hyperlinks-2>download the hyperlink</a> created
  9535. 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
  9536. the steps above defined a <var id=the-a-element:hyperlink-suffix><a href=#hyperlink-suffix>hyperlink suffix</a></var>, then take that
  9537. into account when following or downloading the hyperlink.</ol>
  9538. <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>
  9539. <p>Same as <code id=the-a-element:textcontent><a href=#textcontent>textContent</a></code>.</p>
  9540. </dl>
  9541. <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>,
  9542. <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
  9543. attributes of the same name.</p>
  9544. <p>The IDL attribute <dfn id=dom-a-rellist><code>relList</code></dfn> must
  9545. <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>
  9546. <p>The <dfn id=dom-a-text><code>text</code></dfn> IDL attribute, on getting, must return the
  9547. 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
  9548. 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>
  9549. <hr>
  9550. <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>
  9551. <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
  9552. 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,
  9553. as the given value.</p>
  9554. <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
  9555. 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>
  9556. <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
  9557. encoding</a> is the <a href="#document's-character-encoding" id="the-a-element:document's-character-encoding">document's character encoding</a>.</p>
  9558. <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
  9559. 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
  9560. the string <var>value</var>.</p>
  9561. <div class=example>
  9562. <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
  9563. forth, even entire sections, so long as there is no interactive content within (e.g. buttons or
  9564. other links). This example shows how this can be used to make an entire advertising block into a
  9565. link:</p>
  9566. <pre>&lt;aside class="advertising">
  9567. &lt;h1>Advertising&lt;/h1>
  9568. &lt;a href="http://ad.example.com/?adid=1929&amp;amp;pubid=1422">
  9569. &lt;section>
  9570. &lt;h1>Mellblomatic 9000!&lt;/h1>
  9571. &lt;p>Turn all your widgets into mellbloms!&lt;/p>
  9572. &lt;p>Only $9.99 plus shipping and handling.&lt;/p>
  9573. &lt;/section>
  9574. &lt;/a>
  9575. &lt;a href="http://ad.example.com/?adid=375&amp;amp;pubid=1422">
  9576. &lt;section>
  9577. &lt;h1>The Mellblom Browser&lt;/h1>
  9578. &lt;p>Web browsing at the speed of light.&lt;/p>
  9579. &lt;p>No other browser goes faster!&lt;/p>
  9580. &lt;/section>
  9581. &lt;/a>
  9582. &lt;/aside></pre>
  9583. </div>
  9584. <h4 id=the-em-element>4.5.2 The <dfn><code>em</code></dfn> element</h4>
  9585. <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>
  9586. <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>
  9587. <p>The level of stress that a particular piece of content has is given by its number of ancestor
  9588. <code id=the-em-element:the-em-element-2><a href=#the-em-element>em</a></code> elements.</p>
  9589. <p>The placement of stress emphasis changes the meaning of the sentence. The element thus forms an
  9590. integral part of the content. The precise way in which stress is used in this way depends on the
  9591. language.</p>
  9592. <div class=example>
  9593. <p>These examples show how changing the stress emphasis changes the meaning. First, a general
  9594. statement of fact, with no stress:</p>
  9595. <pre>&lt;p>Cats are cute animals.&lt;/p></pre>
  9596. <p>By emphasizing the first word, the statement implies that the kind of animal under discussion
  9597. is in question (maybe someone is asserting that dogs are cute):</p>
  9598. <pre>&lt;p>&lt;em>Cats&lt;/em> are cute animals.&lt;/p></pre>
  9599. <p>Moving the stress to the verb, one highlights that the truth of the entire sentence is in
  9600. question (maybe someone is saying cats are not cute):</p>
  9601. <pre>&lt;p>Cats &lt;em>are&lt;/em> cute animals.&lt;/p></pre>
  9602. <p>By moving it to the adjective, the exact nature of the cats is reasserted (maybe someone
  9603. suggested cats were <em>mean</em> animals):</p>
  9604. <pre>&lt;p>Cats are &lt;em>cute&lt;/em> animals.&lt;/p></pre>
  9605. <p>Similarly, if someone asserted that cats were vegetables, someone correcting this might
  9606. emphasise the last word:</p>
  9607. <pre>&lt;p>Cats are cute &lt;em>animals&lt;/em>.&lt;/p></pre>
  9608. <p>By emphasizing the entire sentence, it becomes clear that the speaker is fighting hard to get
  9609. the point across. This kind of stress emphasis also typically affects the punctuation, hence the
  9610. exclamation mark here.</p>
  9611. <pre>&lt;p>&lt;em>Cats are cute animals!&lt;/em>&lt;/p></pre>
  9612. <p>Anger mixed with emphasizing the cuteness could lead to markup such as:</p>
  9613. <pre>&lt;p>&lt;em>Cats are &lt;em>cute&lt;/em> animals!&lt;/em>&lt;/p></pre>
  9614. </div>
  9615. <div class=note>
  9616. <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
  9617. stand out from the rest of the paragraph, as if it was in a different mood or voice. For this,
  9618. the <code id=the-em-element:the-i-element><a href=#the-i-element>i</a></code> element is more appropriate.</p>
  9619. <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
  9620. <code id=the-em-element:the-strong-element><a href=#the-strong-element>strong</a></code> element is more appropriate.</p>
  9621. </div>
  9622. <h4 id=the-strong-element>4.5.3 The <dfn><code>strong</code></dfn> element</h4>
  9623. <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>
  9624. <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
  9625. urgency for its contents.</p>
  9626. <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,
  9627. or paragraph to distinguish the part that really matters from other parts that might be more
  9628. detailed, more jovial, or merely boilerplate. (This is distinct from marking up subheadings, for
  9629. which the <code id=the-strong-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element is appropriate.)</p>
  9630. <p class=example>For example, the first word of the previous paragraph is marked up with
  9631. <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
  9632. paragraph.</p>
  9633. <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
  9634. or caution notice.</p>
  9635. <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
  9636. the user needs to see sooner than other parts of the document.</p>
  9637. <p>The relative level of importance of a piece of content is given by its number of ancestor
  9638. <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
  9639. contents.</p>
  9640. <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
  9641. the meaning of the sentence.</p>
  9642. <div class=example>
  9643. <p>Here, the word "chapter" and the actual chapter number are mere boilerplate, and the actual
  9644. 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>
  9645. <pre>&lt;h1>Chapter 1: &lt;strong>The Praxis&lt;/strong>&lt;/h1></pre>
  9646. <p>In the following example, the name of the diagram in the caption is marked up with
  9647. <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
  9648. (after):</p>
  9649. <pre>&lt;figcaption>Figure 1. &lt;strong>Ant colony dynamics&lt;/strong>. The ants in this colony are
  9650. affected by the heat source (upper left) and the food source (lower right).&lt;/figcaption></pre>
  9651. <p>In this example, the heading is really "Flowers, Bees, and Honey", but the author has added a
  9652. 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
  9653. the first part to distinguish it from the latter part.</p>
  9654. <pre>&lt;h1>&lt;strong>Flowers, Bees, and Honey&lt;/strong> and other things I don't understand&lt;/h1></pre>
  9655. </div>
  9656. <div class=example>
  9657. <p>Here is an example of a warning notice in a game, with the
  9658. various parts marked up according to how important they are:</p>
  9659. <pre>&lt;p>&lt;strong>Warning.&lt;/strong> This dungeon is dangerous.
  9660. &lt;strong>Avoid the ducks.&lt;/strong> Take any gold you find.
  9661. &lt;strong>&lt;strong>Do not take any of the diamonds&lt;/strong>,
  9662. they are explosive and &lt;strong>will destroy anything within
  9663. ten meters.&lt;/strong>&lt;/strong> You have been warned.&lt;/p></pre>
  9664. </div>
  9665. <div class=example>
  9666. <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
  9667. the user is intended to read first.</p>
  9668. <pre>&lt;p>Welcome to Remy, the reminder system.&lt;/p>
  9669. &lt;p>Your tasks for today:&lt;/p>
  9670. &lt;ul>
  9671. &lt;li>&lt;p>&lt;strong>Turn off the oven.&lt;/strong>&lt;/p>&lt;/li>
  9672. &lt;li>&lt;p>Put out the trash.&lt;/p>&lt;/li>
  9673. &lt;li>&lt;p>Do the laundry.&lt;/p>&lt;/li>
  9674. &lt;/ul></pre>
  9675. </div>
  9676. <h4 id=the-small-element>4.5.4 The <dfn><code>small</code></dfn> element</h4>
  9677. <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>
  9678. <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>
  9679. <p class=note>Small print typically features disclaimers, caveats, legal restrictions, or
  9680. copyrights. Small print is also sometimes used for attribution, or for satisfying licensing
  9681. requirements.</p>
  9682. <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
  9683. 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>
  9684. element. To mark text as not emphasized or important, simply do not mark it up with the
  9685. <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>
  9686. <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
  9687. paragraphs, lists, or sections of text. It is only intended for short runs of text. The text of a
  9688. page listing terms of use, for instance, would not be a suitable candidate for the
  9689. <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
  9690. of the page.</p>
  9691. <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
  9692. <code id=the-small-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element.</p>
  9693. <div class=example>
  9694. <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
  9695. not included in a price of a hotel room:</p>
  9696. <pre class=example>&lt;dl>
  9697. &lt;dt>Single room
  9698. &lt;dd>199 € &lt;small>breakfast included, VAT not included&lt;/small>
  9699. &lt;dt>Double room
  9700. &lt;dd>239 € &lt;small>breakfast included, VAT not included&lt;/small>
  9701. &lt;/dl></pre>
  9702. </div>
  9703. <div class=example>
  9704. <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
  9705. article.</p>
  9706. <pre>&lt;p>Example Corp today announced record profits for the
  9707. second quarter &lt;small>(Full Disclosure: Foo News is a subsidiary of
  9708. Example Corp)&lt;/small>, leading to speculation about a third quarter
  9709. merger with Demo Group.&lt;/p></pre>
  9710. <p>This is distinct from a sidebar, which might be multiple paragraphs long and is removed from
  9711. the main flow of text. In the following example, we see a sidebar from the same article. This
  9712. sidebar also has small print, indicating the source of the information in the sidebar.</p>
  9713. <pre>&lt;aside>
  9714. &lt;h1>Example Corp&lt;/h1>
  9715. &lt;p>This company mostly creates small software and Web
  9716. sites.&lt;/p>
  9717. &lt;p>The Example Corp company mission is "To provide entertainment
  9718. and news on a sample basis".&lt;/p>
  9719. &lt;p>&lt;small>Information obtained from &lt;a
  9720. href="http://example.com/about.html">example.com&lt;/a> home
  9721. page.&lt;/small>&lt;/p>
  9722. &lt;/aside></pre>
  9723. </div>
  9724. <div class=example>
  9725. <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>
  9726. small print.</p>
  9727. <pre>&lt;p>&lt;strong>&lt;small>Continued use of this service will result in a kiss.&lt;/small>&lt;/strong>&lt;/p></pre>
  9728. </div>
  9729. <h4 id=the-s-element>4.5.5 The <dfn><code>s</code></dfn> element</h4>
  9730. <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>
  9731. <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
  9732. longer relevant.</p>
  9733. <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
  9734. 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>
  9735. <div class=example>
  9736. <p>In this example a recommended retail price has been marked as no longer relevant as the
  9737. product in question has a new sale price.</p>
  9738. <pre>&lt;p>Buy our Iced Tea and Lemonade!&lt;/p>
  9739. &lt;p>&lt;s>Recommended retail price: $3.99 per bottle&lt;/s>&lt;/p>
  9740. &lt;p>&lt;strong>Now selling for just $2.99 a bottle!&lt;/strong>&lt;/p></pre>
  9741. </div>
  9742. <h4 id=the-cite-element>4.5.6 The <dfn><code>cite</code></dfn> element</h4>
  9743. <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>
  9744. <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.
  9745. a book,
  9746. a paper,
  9747. an essay,
  9748. a poem,
  9749. a score,
  9750. a song,
  9751. a script,
  9752. a film,
  9753. a TV show,
  9754. a game,
  9755. a sculpture,
  9756. a painting,
  9757. a theatre production,
  9758. a play,
  9759. an opera,
  9760. a musical,
  9761. an exhibition,
  9762. a legal case report,
  9763. a computer program,
  9764. etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can
  9765. just be a work that is mentioned in passing.</p>
  9766. <p>A person's name is not the title of a work — even if people call that person a piece of
  9767. work — and the element must therefore not be used to mark up people's names. (In some cases,
  9768. 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
  9769. names of famous people are keywords rendered with a different style to draw attention to them. In
  9770. 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
  9771. used.)</p>
  9772. <div class=example>
  9773. <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>
  9774. <pre>&lt;p>My favorite book is &lt;cite>The Reality Dysfunction&lt;/cite> by
  9775. Peter F. Hamilton. My favorite comic is &lt;cite>Pearls Before
  9776. Swine&lt;/cite> by Stephan Pastis. My favorite track is &lt;cite>Jive
  9777. Samba&lt;/cite> by the Cannonball Adderley Sextet.&lt;/p></pre>
  9778. </div>
  9779. <div class=example>
  9780. <p>This is correct usage:</p>
  9781. <pre>&lt;p>According to the Wikipedia article &lt;cite>HTML&lt;/cite>, as it
  9782. stood in mid-February 2008, leaving attribute values unquoted is
  9783. unsafe. This is obviously an over-simplification.&lt;/p></pre>
  9784. <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
  9785. containing far more than the title of the work:</p>
  9786. <pre class=bad>&lt;!-- do not copy this example, it is an example of bad usage! -->
  9787. &lt;p>According to &lt;cite>the Wikipedia article on HTML&lt;/cite>, as it
  9788. stood in mid-February 2008, leaving attribute values unquoted is
  9789. unsafe. This is obviously an over-simplification.&lt;/p></pre>
  9790. </div>
  9791. <div class=example>
  9792. <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
  9793. it is only used to mark the title:</p>
  9794. <pre>&lt;p>&lt;cite>Universal Declaration of Human Rights&lt;/cite>, United Nations,
  9795. December 1948. Adopted by General Assembly resolution 217 A (III).&lt;/p></pre>
  9796. </div>
  9797. <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
  9798. is appropriate).</p>
  9799. <div class=example>
  9800. <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>
  9801. <pre class=bad>&lt;p>&lt;cite>This is wrong!&lt;/cite>, said Ian.&lt;/p></pre>
  9802. <p>This is also incorrect usage, because a person is not a work:</p>
  9803. <pre class=bad>&lt;p>&lt;q>This is still wrong!&lt;/q>, said &lt;cite>Ian&lt;/cite>.&lt;/p></pre>
  9804. <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>
  9805. <pre>&lt;p>&lt;q>This is correct&lt;/q>, said Ian.&lt;/p></pre>
  9806. <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
  9807. keywords in certain kinds of documents:</p>
  9808. <pre>&lt;p>And then &lt;b>Ian&lt;/b> said &lt;q>this might be right, in a
  9809. gossip column, maybe!&lt;/q>.&lt;/p></pre>
  9810. </div>
  9811. <h4 id=the-q-element>4.5.7 The <dfn><code>q</code></dfn> element</h4>
  9812. <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>
  9813. <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
  9814. content</a> quoted from another source.</p>
  9815. <p>Quotation punctuation (such as quotation marks) that is quoting the contents of the element
  9816. 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
  9817. inserted into the rendering by the user agent.</p>
  9818. <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
  9819. it has one, may be cited in the <dfn id=attr-q-cite><code>cite</code></dfn> attribute. The
  9820. source may be fictional, as when quoting characters in a novel or screenplay.</p>
  9821. <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
  9822. potentially surrounded by spaces</a>. To obtain the corresponding citation
  9823. link, the value of the attribute must be <a href=#resolve-a-url id=the-q-element:resolve-a-url>resolved</a> relative to
  9824. the element. User agents may allow users to follow such citation links, but they are
  9825. primarily intended for private use (e.g. by server-side scripts collecting statistics about a
  9826. site's use of quotations), not for readers.</p>
  9827. <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
  9828. 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
  9829. sarcastic statements.</p>
  9830. <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
  9831. 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>
  9832. <div class=example>
  9833. <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>
  9834. <pre>&lt;p>The man said &lt;q>Things that are impossible just take
  9835. longer&lt;/q>. I disagreed with him.&lt;/p></pre>
  9836. </div>
  9837. <div class=example>
  9838. <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
  9839. explicit citation outside:</p>
  9840. <pre>&lt;p>The W3C page &lt;cite>About W3C&lt;/cite> says the W3C's
  9841. mission is &lt;q cite="http://www.w3.org/Consortium/">To lead the
  9842. World Wide Web to its full potential by developing protocols and
  9843. guidelines that ensure long-term growth for the Web&lt;/q>. I
  9844. disagree with this mission.&lt;/p></pre>
  9845. </div>
  9846. <div class=example>
  9847. <p>In the following example, the quotation itself contains a quotation:</p>
  9848. <pre>&lt;p>In &lt;cite>Example One&lt;/cite>, he writes &lt;q>The man
  9849. said &lt;q>Things that are impossible just take longer&lt;/q>. I
  9850. disagreed with him&lt;/q>. Well, I disagree even more!&lt;/p></pre>
  9851. </div>
  9852. <div class=example>
  9853. <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>
  9854. <pre>&lt;p>His best argument was ❝I disagree❞, which
  9855. I thought was laughable.&lt;/p></pre>
  9856. </div>
  9857. <div class=example>
  9858. <p>In the following example, there is no quote — the quotation marks are used to name a
  9859. 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>
  9860. <pre>&lt;p>The word "ineffable" could have been used to describe the disaster
  9861. resulting from the campaign's mismanagement.&lt;/p></pre>
  9862. </div>
  9863. <h4 id=the-dfn-element>4.5.8 The <dfn><code>dfn</code></dfn> element</h4>
  9864. <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>
  9865. <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>
  9866. element must also contain the definition(s) for the <a href=#defining-term id=the-dfn-element:defining-term>term</a> given
  9867. by the <code id=the-dfn-element:the-dfn-element-4><a href=#the-dfn-element>dfn</a></code> element.</p>
  9868. <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
  9869. is the term being defined. Otherwise, if it contains exactly one element child node and no child
  9870. <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
  9871. the term being defined. Otherwise, it is the exact <code id=the-dfn-element:textcontent><a href=#textcontent>textContent</a></code> of the
  9872. <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>
  9873. <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
  9874. present, then it must contain only the term being defined.</p>
  9875. <p class=note>The <code id=the-dfn-element:attr-title><a href=#attr-title>title</a></code> attribute of ancestor elements does not
  9876. affect <code id=the-dfn-element:the-dfn-element-8><a href=#the-dfn-element>dfn</a></code> elements.</p>
  9877. <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
  9878. the term defined by the <code id=the-dfn-element:the-dfn-element-10><a href=#the-dfn-element>dfn</a></code> element.</p>
  9879. <div class=example>
  9880. <p>In the following fragment, the term "Garage Door Opener" is first defined in the first
  9881. paragraph, then used in the second. In both cases, its abbreviation is what is actually
  9882. displayed.</p>
  9883. <pre>&lt;p>The <strong>&lt;dfn>&lt;abbr title="Garage Door Opener">GDO&lt;/abbr>&lt;/dfn></strong>
  9884. is a device that allows off-world teams to open the iris.&lt;/p>
  9885. &lt;!-- ... later in the document: -->
  9886. &lt;p>Teal'c activated his <strong>&lt;abbr title="Garage Door Opener">GDO&lt;/abbr></strong>
  9887. and so Hammond ordered the iris to be opened.&lt;/p></pre>
  9888. <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>
  9889. <pre>&lt;p>The &lt;dfn <strong>id=gdo</strong>>&lt;abbr title="Garage Door Opener">GDO&lt;/abbr>&lt;/dfn>
  9890. is a device that allows off-world teams to open the iris.&lt;/p>
  9891. &lt;!-- ... later in the document: -->
  9892. &lt;p>Teal'c activated his <strong>&lt;a href=#gdo></strong>&lt;abbr title="Garage Door Opener">GDO&lt;/abbr><strong>&lt;/a></strong>
  9893. and so Hammond ordered the iris to be opened.&lt;/p></pre>
  9894. </div>
  9895. <h4 id=the-abbr-element>4.5.9 The <dfn><code>abbr</code></dfn> element</h4>
  9896. <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>
  9897. <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
  9898. with its expansion. The <dfn id=attr-abbr-title><code>title</code></dfn> attribute may be
  9899. used to provide an expansion of the abbreviation. The attribute, if specified, must contain an
  9900. expansion of the abbreviation, and nothing else.</p>
  9901. <div class=example>
  9902. <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.
  9903. This paragraph <a href=#defining-term id=the-abbr-element:defining-term>defines the term</a> "Web Hypertext Application
  9904. Technology Working Group".</p>
  9905. <pre>&lt;p>The &lt;dfn id=whatwg>&lt;abbr
  9906. title="Web Hypertext Application Technology Working Group">WHATWG&lt;/abbr>&lt;/dfn>
  9907. is a loose unofficial collaboration of Web browser manufacturers and
  9908. interested parties who wish to develop new technologies designed to
  9909. allow authors to write and deploy Applications over the World Wide
  9910. Web.&lt;/p></pre>
  9911. <p>An alternative way to write this would be:</p>
  9912. <pre>&lt;p>The &lt;dfn id=whatwg>Web Hypertext Application Technology
  9913. Working Group&lt;/dfn> (&lt;abbr
  9914. title="Web Hypertext Application Technology Working Group">WHATWG&lt;/abbr>)
  9915. is a loose unofficial collaboration of Web browser manufacturers and
  9916. interested parties who wish to develop new technologies designed to
  9917. allow authors to write and deploy Applications over the World Wide
  9918. Web.&lt;/p></pre>
  9919. </div>
  9920. <div class=example>
  9921. <p>This paragraph has two abbreviations. Notice how only one is defined; the other, with no
  9922. 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>
  9923. <pre>&lt;p>The
  9924. &lt;abbr title="Web Hypertext Application Technology Working Group">WHATWG&lt;/abbr>
  9925. started working on HTML5 in 2004.&lt;/p></pre>
  9926. </div>
  9927. <div class=example>
  9928. <p>This paragraph links an abbreviation to its definition.</p>
  9929. <pre>&lt;p>The &lt;a href="#whatwg">&lt;abbr
  9930. title="Web Hypertext Application Technology Working Group">WHATWG&lt;/abbr>&lt;/a>
  9931. community does not have much representation from Asia.&lt;/p></pre>
  9932. </div>
  9933. <div class=example>
  9934. <p>This paragraph marks up an abbreviation without giving an expansion, possibly as a hook to
  9935. apply styles for abbreviations (e.g. smallcaps).</p>
  9936. <pre>&lt;p>Philip` and Dashiva both denied that they were going to
  9937. get the issue counts from past revisions of the specification to
  9938. backfill the &lt;abbr>WHATWG&lt;/abbr> issue graph.&lt;/p></pre>
  9939. </div>
  9940. <p>If an abbreviation is pluralized, the expansion's grammatical number (plural vs singular) must
  9941. match the grammatical number of the contents of the element.</p>
  9942. <div class=example>
  9943. <p>Here the plural is outside the element, so the expansion is in the singular:</p>
  9944. <pre>&lt;p>Two &lt;abbr title="Working Group">WG&lt;/abbr>s worked on
  9945. this specification: the &lt;abbr>WHATWG&lt;/abbr> and the
  9946. &lt;abbr>HTMLWG&lt;/abbr>.&lt;/p></pre>
  9947. <p>Here the plural is inside the element, so the expansion is in the plural:</p>
  9948. <pre>&lt;p>Two &lt;abbr title="Working Groups">WGs&lt;/abbr> worked on
  9949. this specification: the &lt;abbr>WHATWG&lt;/abbr> and the
  9950. &lt;abbr>HTMLWG&lt;/abbr>.&lt;/p></pre>
  9951. </div>
  9952. <p>Abbreviations do not have to be marked up using this element. It is expected to be useful in
  9953. the following cases:</p>
  9954. <ul><li>Abbreviations for which the author wants to give expansions, where using the
  9955. <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
  9956. 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
  9957. 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
  9958. time the abbreviation is used.<li>Abbreviations whose presence needs to be semantically annotated, e.g. so that they can be
  9959. 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
  9960. can be used without a <code id=the-abbr-element:attr-title-3><a href=#attr-title>title</a></code> attribute.</ul>
  9961. <p>Providing an expansion in a <code id=the-abbr-element:attr-title-4><a href=#attr-title>title</a></code> attribute once
  9962. 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
  9963. 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
  9964. 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>
  9965. <h4 id=the-ruby-element>4.5.10 The <dfn><code>ruby</code></dfn> element</h4>
  9966. <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>
  9967. <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
  9968. ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily
  9969. used in East Asian typography as a guide for pronunciation or to include other annotations. In
  9970. Japanese, this form of typography is also known as <i>furigana</i>.</p>
  9971. <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
  9972. sequences:</p>
  9973. <ol class=brief><li>One or the other of the following:
  9974. <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
  9975. <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
  9976. </ul>
  9977. <li>One or the other of the following:
  9978. <ul class=brief><li>One or more <code id=the-ruby-element:the-rt-element><a href=#the-rt-element>rt</a></code> elements
  9979. <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
  9980. </ul>
  9981. </ol>
  9982. <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
  9983. annotations, including in particular (though by no means limited to) those described below. For
  9984. more details on Japanese Ruby in particular, and how to render Ruby for Japanese, see
  9985. <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
  9986. <p class=note>At the time of writing, CSS does not yet provide a way to fully control the
  9987. 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
  9988. the styles described below in due course.</p>
  9989. <dl><dt>Mono-ruby for individual base characters in Japanese
  9990. <dd>
  9991. <p>One or more hiragana or katakana characters (the ruby annotation) are placed with each
  9992. ideographic character (the base text). This is used to provide readings of kanji characters.
  9993. <div class=example>
  9994. <pre>&lt;ruby>B&lt;rt>annotation&lt;/ruby></pre>
  9995. </div>
  9996. <div class=example>
  9997. <p>In this example, notice how each annotation corresponds to a single base character.
  9998. <pre>&lt;ruby>君&lt;rt>くん&lt;/ruby>&lt;ruby>子&lt;rt>し&lt;/ruby>は&lt;ruby>和&lt;rt>わ&lt;/ruby>して&lt;ruby>同&lt;rt>どう&lt;/ruby>ぜず。</pre>
  9999. <p lang=ja><ruby>君<rt>くん</ruby><ruby>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。
  10000. <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
  10001. segments of base text and two annotations (one for each) rather than two back-to-back
  10002. <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
  10003. above):
  10004. <pre>&lt;ruby>君&lt;rt>くん&lt;/rt>子&lt;rt>し&lt;/ruby>は&lt;ruby>和&lt;rt>わ&lt;/ruby>して&lt;ruby>同&lt;rt>どう&lt;/ruby>ぜず。</pre>
  10005. </div>
  10006. <dt>Mono-ruby for compound words (jukugo)
  10007. <dd>
  10008. <p>This is similar to the previous case: each ideographic character in the compound word (the
  10009. base text) has its reading given in hiragana or katakana characters (the ruby annotation). The
  10010. difference is that the base text segments form a compound word rather than being separate from
  10011. each other.
  10012. <div class=example>
  10013. <pre>&lt;ruby>B&lt;rt>annotation&lt;/rt>B&lt;rt>annotation&lt;/ruby></pre>
  10014. </div>
  10015. <div class=example>
  10016. <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>
  10017. <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>
  10018. <pre>&lt;ruby>鬼&lt;rt>き&lt;/rt>門&lt;rt>もん&lt;/rt>&lt;/ruby>の&lt;ruby>方&lt;rt>ほう&lt;/rt>角&lt;rt>がく&lt;/rt>&lt;/ruby>を&lt;ruby>凝&lt;rt>ぎょう&lt;/rt>視&lt;rt>し&lt;/rt>&lt;/ruby>する</pre>
  10019. <p lang=ja><ruby>鬼<rt>き</rt>門<rt>もん</ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</ruby>する
  10020. </div>
  10021. <dt>Jukugo-ruby
  10022. <dd>
  10023. <p>This is semantically identical to the previous case (each individual ideographic character in
  10024. the base compound word has its reading given in an annotation in hiragana or katakana
  10025. characters), but the rendering is the more complicated Jukugo Ruby rendering.
  10026. <div class=example>
  10027. <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>
  10028. <pre>&lt;ruby>鬼&lt;rt>き&lt;/rt>門&lt;rt>もん&lt;/rt>&lt;/ruby>の&lt;ruby>方&lt;rt>ほう&lt;/rt>角&lt;rt>がく&lt;/rt>&lt;/ruby>を&lt;ruby>凝&lt;rt>ぎょう&lt;/rt>視&lt;rt>し&lt;/rt>&lt;/ruby>する</pre>
  10029. </div>
  10030. <p class=note>For more details on <a href=http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby>Jukugo Ruby rendering</a>, see
  10031. Appendix F in the <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
  10032. <dt>Group ruby for describing meanings
  10033. <dd>
  10034. <p>The annotation describes the meaning of the base text, rather than (or in addition to) the
  10035. pronunciation. As such, both the base text and the annotation can be multiple characters long.
  10036. <div class=example> <pre>&lt;ruby>BASE&lt;rt>annotation&lt;/ruby></pre> </div>
  10037. <div class=example>
  10038. <p>Here a compound ideographic word has its corresponding katakana given as an annotation.
  10039. <pre>&lt;ruby>境界面&lt;rt>インターフェース&lt;/ruby></pre>
  10040. <p lang=ja><ruby>境界面<rt>インターフェース</ruby>
  10041. </div>
  10042. <div class=example>
  10043. <p>Here a compound ideographic word has its translation in English provided as an annotation.
  10044. <pre>&lt;ruby lang="ja">編集者&lt;rt lang="en">editor&lt;/ruby></pre>
  10045. <p><ruby lang=ja>編集者<rt lang=en>editor</ruby>
  10046. </div>
  10047. <dt>Group ruby for Jukuji readings
  10048. <dd>
  10049. <p>A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping
  10050. would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words
  10051. where a direct mapping of pronunciation to individual letters is, in some dialects, rather
  10052. unclear.)
  10053. <div class=example>
  10054. <p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby:
  10055. <pre>&lt;ruby>紫陽花&lt;rt>あじさい&lt;/ruby></pre>
  10056. <p lang=ja><ruby>紫陽花<rt>あじさい</ruby>
  10057. </div>
  10058. <dt>Text with both phonetic and semantic annotations (double-sided ruby)
  10059. <dd>
  10060. <p>Sometimes, ruby styles described above are combined.
  10061. <p>If this results in two annotations covering the same single base segment, then the
  10062. annotations can just be placed back to back.
  10063. <div class=example>
  10064. <pre>&lt;ruby>BASE&lt;rt>annotation 1&lt;rt>annotation 2&lt;/ruby></pre>
  10065. </div>
  10066. <div class=example>
  10067. <pre>&lt;ruby>B&lt;rt>a&lt;rt>a&lt;/ruby>&lt;ruby>A&lt;rt>a&lt;rt>a&lt;/ruby>&lt;ruby>S&lt;rt>a&lt;rt>a&lt;/ruby>&lt;ruby>E&lt;rt>a&lt;rt>a&lt;/ruby></pre>
  10068. </div>
  10069. <div class=example>
  10070. <p>In this contrived example, some symbols are given names in English and French.
  10071. <pre>&lt;ruby>
  10072. ♥ &lt;rt> Heart &lt;rt lang=fr> Cœur
  10073. ☘ &lt;rt> Shamrock &lt;rt lang=fr> Trèfle
  10074. ✶ &lt;rt> Star &lt;rt lang=fr> Étoile
  10075. &lt;/ruby></pre>
  10076. </div>
  10077. <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>
  10078. 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
  10079. given an annotation at the "outer" level.
  10080. <div class=example>
  10081. <pre>&lt;ruby>&lt;ruby>B&lt;rt>a&lt;/rt>A&lt;rt>n&lt;/rt>S&lt;rt>t&lt;/rt>E&lt;rt>n&lt;/rt>&lt;/ruby>&lt;rt>annotation&lt;/ruby></pre>
  10082. </div>
  10083. <div class=example>
  10084. <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.
  10085. <pre>&lt;ruby>&lt;ruby>東&lt;rt>とう&lt;/rt>南&lt;rt>なん&lt;/rt>&lt;/ruby>&lt;rt>たつみ&lt;/rt>&lt;/ruby>の方角</pre>
  10086. <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</ruby><rt>たつみ</ruby>の方角
  10087. </div>
  10088. <div class=example>
  10089. <p>This is the same example, but the meaning is given in English instead of Japanese:
  10090. <pre>&lt;ruby>&lt;ruby>東&lt;rt>とう&lt;/rt>南&lt;rt>なん&lt;/rt>&lt;/ruby>&lt;rt lang=en>Southeast&lt;/rt>&lt;/ruby>の方角</pre>
  10091. <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</ruby><rt lang=en>Southeast</ruby>の方角
  10092. </div>
  10093. </dl>
  10094. <hr>
  10095. <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,
  10096. content is segmented and segments are placed into three categories: base text segments, annotation
  10097. segments, and ignored segments. Ignored segments do not form part of the document's semantics
  10098. (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
  10099. latter of which are used for legacy user agents that do not support ruby at all). Base text
  10100. segments can overlap (with a limit of two segments overlapping any one position in the DOM, and
  10101. with any segment having an earlier start point than an overlapping segment also having an equal or
  10102. later end point, and any segment have a later end point than an overlapping segment also having an
  10103. 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
  10104. segment can be associated with a base text segment, and each base text segment can have annotation
  10105. segments associated with it. (In a conforming document, each base text segment is associated with
  10106. at least one annotation segment, and each annotation segment is associated with one base text
  10107. 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
  10108. text it contains, along with the mapping from those base text segments to annotation segments.
  10109. Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly
  10110. one element. <a href=#refsDOM>[DOM]</a></p>
  10111. <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>
  10112. element is the result that would be obtained from running the following algorithm:</p>
  10113. <ol><li><p>Let <var>base text segments</var> be an empty list of base text segments, each
  10114. potentially with a list of base text subsegments.<li><p>Let <var>annotation segments</var> be an empty list of annotation segments, each
  10115. 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
  10116. 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
  10117. 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
  10118. child nodes in <var>current parent</var>, then jump to the step labeled <i>end
  10119. mode</i>.</p>
  10120. <li><p>If the <var>index</var>th node in <var>current parent</var> is an
  10121. <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
  10122. 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
  10123. 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
  10124. 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
  10125. the step labeled <i>start mode</i>.<li><p>If the <var>index</var>th node in <var>current parent</var> is an
  10126. <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
  10127. 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
  10128. the number of child nodes in <var>current parent</var>, then jump to the step labeled
  10129. <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
  10130. 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
  10131. the step labeled <i>annotation mode increment</i>.<li><p>If the <var>index</var>th node in <var>current parent</var> is an
  10132. <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
  10133. <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
  10134. 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
  10135. equal to the number of child nodes in <var>current parent</var> then jump to the step
  10136. labeled <i>end mode</i>.<li><p>If the <var>lookahead index</var>th node in <var>current parent</var> is
  10137. 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
  10138. <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
  10139. 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
  10140. whitespace</a>, then jump to the step labeled <i>base mode</i> (without further incrementing
  10141. <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
  10142. 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
  10143. post-increment</i>.<li><p><i>End</i>: Return <var>base text segments</var> and <var>annotation
  10144. 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
  10145. of those lists is implicitly in an <i>ignored segment</i>.</ol>
  10146. <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
  10147. steps at that point in the algorithm:</p>
  10148. <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
  10149. point</a> (<var>current parent</var>, <var>start index</var>) and whose
  10150. <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
  10151. 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
  10152. <var>annotation range</var>.</p>
  10153. <li><p>Add <var>new text segment</var> to <var>base text
  10154. segments</var>.<li><p>Let <var>current base text</var> be <var>new text
  10155. segment</var>.<li><p>Let <var>start index</var> be null.</ol>
  10156. <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
  10157. at that point in the algorithm:</p>
  10158. <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
  10159. index</var>.<li><p>Let <var>start index</var> be null.</ol>
  10160. <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
  10161. that point in the algorithm:</p>
  10162. <ol><li><p>Let <var>index</var> be the position of <var>current parent</var> in
  10163. <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
  10164. index</var>.<li><p>Let <var>saved start index</var> be null.</ol>
  10165. <p>When the steps above say to <dfn id=push-a-ruby-annotation>push a ruby annotation</dfn>, it means to run the following
  10166. steps at that point in the algorithm:</p>
  10167. <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
  10168. 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>
  10169. (<var>current parent</var>, <var>index</var> plus one) (i.e. that contains only
  10170. <var>rt</var>).<li><p>Let <var>new annotation segment</var> be an annotation segment described by the
  10171. range <var>annotation range</var>.<li><p>If <var>current base text</var> is not null, associate <var>new
  10172. annotation segment</var> with <var>current base text</var>.<li><p>Add <var>new annotation segment</var> to <var>annotation
  10173. segments</var>.</ol>
  10174. <div class=example>
  10175. <p>In this example, each ideograph in the Japanese text <span lang=ja>漢字</span> is annotated with its reading in hiragana.</p>
  10176. <pre lang=ja>...
  10177. &lt;ruby>漢&lt;rt>かん&lt;/rt>字&lt;rt>じ&lt;/rt>&lt;/ruby>
  10178. ...</pre>
  10179. <p>This might be rendered as:</p>
  10180. <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>
  10181. </div>
  10182. <div class=example>
  10183. <p>In this example, each ideograph in the traditional Chinese text <span lang=zh-TW>漢字</span> is annotated with its bopomofo reading.</p>
  10184. <pre lang=zh-TW>&lt;ruby>漢&lt;rt>ㄏㄢˋ&lt;/rt>字&lt;rt>ㄗˋ&lt;/rt>&lt;/ruby></pre>
  10185. <p>This might be rendered as:</p>
  10186. <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>
  10187. </div>
  10188. <div class=example>
  10189. <p>In this example, each ideograph in the simplified Chinese text <span lang=zh-CN>汉字</span> is annotated with its pinyin reading.</p>
  10190. <pre lang=zh-CN>...&lt;ruby>汉&lt;rt>hàn&lt;/rt>字&lt;rt>zì&lt;/rt>&lt;/ruby>...</pre>
  10191. <p>This might be rendered as:</p>
  10192. <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>
  10193. </div>
  10194. <div class=example>
  10195. <p>In this more contrived example, the acronym "HTML" has four annotations: one for the whole
  10196. acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext",
  10197. one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to
  10198. "Language".</p>
  10199. <pre>&lt;ruby>
  10200. &lt;ruby>HT&lt;rt>Hypertext&lt;/rt>M&lt;rt>Markup&lt;/rt>L&lt;rt>Language&lt;/rt>&lt;/ruby>
  10201. &lt;rt>An abstract language for describing documents and applications
  10202. &lt;/ruby></pre>
  10203. </div>
  10204. <h4 id=the-rt-element>4.5.11 The <dfn><code>rt</code></dfn> element</h4>
  10205. <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
  10206. <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,
  10207. 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>
  10208. <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
  10209. 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>
  10210. 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>
  10211. <a href=#represents id=the-rt-element:represents-2>represents</a>.</p>
  10212. <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
  10213. <a href=#represents id=the-rt-element:represents-3>represents</a> the same thing as its children.</p>
  10214. <h4 id=the-rp-element>4.5.12 The <dfn><code>rp</code></dfn> element</h4>
  10215. <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
  10216. <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,
  10217. 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>
  10218. <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
  10219. text component of a ruby annotation, to be shown by user agents that don't support ruby
  10220. annotations.</p>
  10221. <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>
  10222. 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
  10223. 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
  10224. children.</p>
  10225. <div class=example>
  10226. <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
  10227. 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>
  10228. <pre lang=ja>...
  10229. &lt;ruby>漢&lt;rp> (&lt;/rp>&lt;rt>かん&lt;/rt>&lt;rp>) &lt;/rp>字&lt;rp> (&lt;/rp>&lt;rt>じ&lt;/rt>&lt;rp>) &lt;/rp>&lt;/ruby>
  10230. ...</pre>
  10231. <p>In conforming user agents the rendering would be as above, but in user agents that do not
  10232. support ruby, the rendering would be:</p>
  10233. <pre lang=ja>... 漢 (かん) 字 (じ) ...</pre>
  10234. </div>
  10235. <div class=example>
  10236. <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
  10237. between the annotations. Here is another copy of an earlier contrived example showing some
  10238. 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
  10239. well:
  10240. <pre>&lt;ruby>
  10241. ♥&lt;rp>: &lt;/rp>&lt;rt>Heart&lt;/rt>&lt;rp>, &lt;/rp>&lt;rt lang=fr>Cœur&lt;/rt>&lt;rp>.&lt;/rp>
  10242. ☘&lt;rp>: &lt;/rp>&lt;rt>Shamrock&lt;/rt>&lt;rp>, &lt;/rp>&lt;rt lang=fr>Trèfle&lt;/rt>&lt;rp>.&lt;/rp>
  10243. ✶&lt;rp>: &lt;/rp>&lt;rt>Star&lt;/rt>&lt;rp>, &lt;/rp>&lt;rt lang=fr>Étoile&lt;/rt>&lt;rp>.&lt;/rp>
  10244. &lt;/ruby></pre>
  10245. <p>This would make the example render as follows in non-ruby-capable user agents:
  10246. <pre>♥: Heart, <span lang=fr>Cœur</span>. ☘: Shamrock, <span lang=fr>Trèfle</span>. ✶: Star, <span lang=fr>Étoile</span>.</pre>
  10247. </div>
  10248. <h4 id=the-data-element>4.5.13 The <dfn><code>data</code></dfn> element</h4>
  10249. <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>
  10250. <pre class=idl>interface <dfn id=htmldataelement>HTMLDataElement</dfn> : <a href=#htmlelement id=the-data-element:htmlelement>HTMLElement</a> {
  10251. attribute DOMString <a href=#dom-data-value id=the-data-element:dom-data-value>value</a>;
  10252. };</pre>
  10253. </dl>
  10254. <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
  10255. 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>
  10256. attribute.</p>
  10257. <p>The <dfn id=attr-data-value><code>value</code></dfn> attribute must be present. Its value
  10258. must be a representation of the element's contents in a machine-readable format.</p>
  10259. <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>
  10260. element can be used instead.</p>
  10261. <p>The element can be used for several purposes.</p>
  10262. <p>When combined with microformats or the <a href=#microdata>microdata attributes</a> defined in
  10263. this specification, the element serves to provide both a machine-readable value for the purposes
  10264. of data processors, and a human-readable value for the purposes of rendering in a Web browser. In
  10265. 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
  10266. determined by the microformats or microdata vocabulary in use.</p>
  10267. <p>The element can also, however, be used in conjunction with scripts in the page, for when a
  10268. script has a literal value to store alongside a human-readable value. In such cases, the format to
  10269. 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>
  10270. attributes can also be useful in such situations.)</p>
  10271. <p>The <dfn id=dom-data-value><code>value</code></dfn> IDL attribute must
  10272. <a href=#reflect id=the-data-element:reflect>reflect</a> the content attribute of the same name.</p>
  10273. <div class=example>
  10274. <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
  10275. <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
  10276. numbers being presented in textual form in one column and in a decomposed form in another.</p>
  10277. <pre>&lt;table sortable>
  10278. &lt;thead> &lt;tr> &lt;th> Game &lt;th> Corporations &lt;th> Map Size
  10279. &lt;tbody>
  10280. &lt;tr> &lt;td> 1830 &lt;td> &lt;data value="8">Eight&lt;/data> &lt;td> &lt;data value="93">19+74 hexes (93 total)&lt;/data>
  10281. &lt;tr> &lt;td> 1856 &lt;td> &lt;data value="11">Eleven&lt;/data> &lt;td> &lt;data value="99">12+87 hexes (99 total)&lt;/data>
  10282. &lt;tr> &lt;td> 1870 &lt;td> &lt;data value="10">Ten&lt;/data> &lt;td> &lt;data value="149">4+145 hexes (149 total)&lt;/data>
  10283. &lt;/table></pre>
  10284. </div>
  10285. <h4 id=the-time-element>4.5.14 The <dfn><code>time</code></dfn> element</h4>
  10286. <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>
  10287. <pre class=idl>interface <dfn id=htmltimeelement>HTMLTimeElement</dfn> : <a href=#htmlelement id=the-time-element:htmlelement>HTMLElement</a> {
  10288. attribute DOMString <a href=#dom-time-datetime id=the-time-element:dom-time-datetime>dateTime</a>;
  10289. };</pre>
  10290. </dl>
  10291. <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
  10292. 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>
  10293. attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and
  10294. durations, as described below.</p>
  10295. <p>The <dfn id=attr-time-datetime><code>datetime</code></dfn> attribute may be present. If
  10296. present, its value must be a representation of the element's contents in a machine-readable
  10297. format.</p>
  10298. <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
  10299. descendants.</p>
  10300. <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
  10301. <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
  10302. element's <code id=the-time-element:textcontent><a href=#textcontent>textContent</a></code>, if it does not.</p>
  10303. <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
  10304. syntaxes.</p>
  10305. <dl><dt>A <a href=#valid-month-string id=the-time-element:valid-month-string>valid month string</a><dd>
  10306. <pre class=example>&lt;time>2011-11&lt;/time></pre>
  10307. <dt>A <a href=#valid-date-string id=the-time-element:valid-date-string>valid date string</a><dd>
  10308. <pre class=example>&lt;time>2011-11-18&lt;/time></pre>
  10309. <dt>A <a href=#valid-yearless-date-string id=the-time-element:valid-yearless-date-string>valid yearless date string</a><dd>
  10310. <pre class=example>&lt;time>11-18&lt;/time></pre>
  10311. <dt>A <a href=#valid-time-string id=the-time-element:valid-time-string>valid time string</a><dd>
  10312. <pre class=example>&lt;time>14:54&lt;/time></pre>
  10313. <pre class=example>&lt;time>14:54:39&lt;/time></pre>
  10314. <pre class=example>&lt;time>14:54:39.929&lt;/time></pre>
  10315. <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>
  10316. <pre class=example>&lt;time>2011-11-18T14:54&lt;/time></pre>
  10317. <pre class=example>&lt;time>2011-11-18T14:54:39&lt;/time></pre>
  10318. <pre class=example>&lt;time>2011-11-18T14:54:39.929&lt;/time></pre>
  10319. <pre class=example>&lt;time>2011-11-18 14:54&lt;/time></pre>
  10320. <pre class=example>&lt;time>2011-11-18 14:54:39&lt;/time></pre>
  10321. <pre class=example>&lt;time>2011-11-18 14:54:39.929&lt;/time></pre>
  10322. <p class=note>Times with dates but without a time zone offset are useful for specifying events
  10323. that are observed at the same specific time in each time zone, throughout a day. For example,
  10324. the 2020 new year is celebrated at 2020-01-01 00:00 in each time zone, not at the same precise
  10325. moment across all time zones. For events that occur at the same time across all time zones, for
  10326. 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
  10327. more useful.</p>
  10328. <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>
  10329. <pre class=example>&lt;time>Z&lt;/time></pre>
  10330. <pre class=example>&lt;time>+0000&lt;/time></pre>
  10331. <pre class=example>&lt;time>+00:00&lt;/time></pre>
  10332. <pre class=example>&lt;time>-0800&lt;/time></pre>
  10333. <pre class=example>&lt;time>-08:00&lt;/time></pre>
  10334. <p class=note>For times without dates (or times referring to events that recur on multiple
  10335. dates), specifying the geographic location that controls the time is usually more useful than
  10336. specifying a time zone offset, because geographic locations change time zone offsets with
  10337. daylight savings time. In some cases, geographic locations even change time zone, e.g. when the
  10338. boundaries of those time zones are redrawn, as happened with Samoa at the end of 2011. There
  10339. exists a time zone database that describes the boundaries of time zones and what rules apply
  10340. within each such zone, known as the <i>time zone database</i>. <a href=#refsTZDATABASE>[TZDATABASE]</a></p>
  10341. <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>
  10342. <pre class=example>&lt;time>2011-11-18T14:54Z&lt;/time></pre>
  10343. <pre class=example>&lt;time>2011-11-18T14:54:39Z&lt;/time></pre>
  10344. <pre class=example>&lt;time>2011-11-18T14:54:39.929Z&lt;/time></pre>
  10345. <pre class=example>&lt;time>2011-11-18T14:54+0000&lt;/time></pre>
  10346. <pre class=example>&lt;time>2011-11-18T14:54:39+0000&lt;/time></pre>
  10347. <pre class=example>&lt;time>2011-11-18T14:54:39.929+0000&lt;/time></pre>
  10348. <pre class=example>&lt;time>2011-11-18T14:54+00:00&lt;/time></pre>
  10349. <pre class=example>&lt;time>2011-11-18T14:54:39+00:00&lt;/time></pre>
  10350. <pre class=example>&lt;time>2011-11-18T14:54:39.929+00:00&lt;/time></pre>
  10351. <pre class=example>&lt;time>2011-11-18T06:54-0800&lt;/time></pre>
  10352. <pre class=example>&lt;time>2011-11-18T06:54:39-0800&lt;/time></pre>
  10353. <pre class=example>&lt;time>2011-11-18T06:54:39.929-0800&lt;/time></pre>
  10354. <pre class=example>&lt;time>2011-11-18T06:54-08:00&lt;/time></pre>
  10355. <pre class=example>&lt;time>2011-11-18T06:54:39-08:00&lt;/time></pre>
  10356. <pre class=example>&lt;time>2011-11-18T06:54:39.929-08:00&lt;/time></pre>
  10357. <pre class=example>&lt;time>2011-11-18 14:54Z&lt;/time></pre>
  10358. <pre class=example>&lt;time>2011-11-18 14:54:39Z&lt;/time></pre>
  10359. <pre class=example>&lt;time>2011-11-18 14:54:39.929Z&lt;/time></pre>
  10360. <pre class=example>&lt;time>2011-11-18 14:54+0000&lt;/time></pre>
  10361. <pre class=example>&lt;time>2011-11-18 14:54:39+0000&lt;/time></pre>
  10362. <pre class=example>&lt;time>2011-11-18 14:54:39.929+0000&lt;/time></pre>
  10363. <pre class=example>&lt;time>2011-11-18 14:54+00:00&lt;/time></pre>
  10364. <pre class=example>&lt;time>2011-11-18 14:54:39+00:00&lt;/time></pre>
  10365. <pre class=example>&lt;time>2011-11-18 14:54:39.929+00:00&lt;/time></pre>
  10366. <pre class=example>&lt;time>2011-11-18 06:54-0800&lt;/time></pre>
  10367. <pre class=example>&lt;time>2011-11-18 06:54:39-0800&lt;/time></pre>
  10368. <pre class=example>&lt;time>2011-11-18 06:54:39.929-0800&lt;/time></pre>
  10369. <pre class=example>&lt;time>2011-11-18 06:54-08:00&lt;/time></pre>
  10370. <pre class=example>&lt;time>2011-11-18 06:54:39-08:00&lt;/time></pre>
  10371. <pre class=example>&lt;time>2011-11-18 06:54:39.929-08:00&lt;/time></pre>
  10372. <p class=note>Times with dates and a time zone offset are useful for specifying specific
  10373. events, or recurring virtual events where the time is not anchored to a specific geographic
  10374. location. For example, the precise time of an asteroid impact, or a particular meeting in a
  10375. series of meetings held at 1400 UTC every day, regardless of whether any particular part of the
  10376. world is observing daylight savings time or not. For events where the precise time varies by the
  10377. 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
  10378. string</a> combined with that geographic location is likely more useful.</p>
  10379. <dt>A <a href=#valid-week-string id=the-time-element:valid-week-string>valid week string</a><dd>
  10380. <pre class=example>&lt;time>2011-W47&lt;/time></pre>
  10381. <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>
  10382. <pre class=example>&lt;time>2011&lt;/time></pre>
  10383. <pre class=example>&lt;time>0001&lt;/time></pre>
  10384. <dt>A <a href=#valid-duration-string id=the-time-element:valid-duration-string>valid duration string</a><dd>
  10385. <pre class=example>&lt;time>PT4H18M3S&lt;/time></pre>
  10386. <pre class=example>&lt;time>4h 18m 3s&lt;/time></pre>
  10387. </dl>
  10388. <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
  10389. element's <a href=#datetime-value id=the-time-element:datetime-value-2>datetime value</a> by using the following algorithm:</p>
  10390. <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
  10391. <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
  10392. 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
  10393. <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
  10394. 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
  10395. 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
  10396. 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
  10397. <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
  10398. 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
  10399. 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
  10400. 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>
  10401. 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
  10402. 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
  10403. 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;
  10404. 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
  10405. <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
  10406. 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>,
  10407. at least one of which is not U+0030 DIGIT ZERO (0), then the machine-readable equivalent is the
  10408. 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
  10409. 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>,
  10410. that is the machine-readable equivalent; abort these steps.<li><p>There is no machine-readable equivalent.</ol>
  10411. <p class=note>The algorithms referenced above are intended to be designed such that for any
  10412. arbitrary string <var>s</var>, only one of the algorithms returns a value. A more
  10413. efficient approach might be to create a single algorithm that parses all these data types in one
  10414. pass; developing such an algorithm is left as an exercise to the reader.</p>
  10415. <p>The <dfn id=dom-time-datetime><code>dateTime</code></dfn> IDL attribute must
  10416. <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
  10417. attribute.</p>
  10418. <div class=example>
  10419. <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
  10420. following shows a hypothetical way of encoding an event using a variant on hCalendar that uses
  10421. the <code id=the-time-element:the-time-element-6><a href=#the-time-element>time</a></code> element:</p>
  10422. <pre>&lt;div class="vevent">
  10423. &lt;a class="url" href="http://www.web2con.com/">http://www.web2con.com/&lt;/a>
  10424. &lt;span class="summary">Web 2.0 Conference&lt;/span>:
  10425. &lt;time class="dtstart" datetime="2005-10-05">October 5&lt;/time> -
  10426. &lt;time class="dtend" datetime="2005-10-07">7&lt;/time>,
  10427. at the &lt;span class="location">Argent Hotel, San Francisco, CA&lt;/span>
  10428. &lt;/div></pre>
  10429. </div>
  10430. <div class=example>
  10431. <p>Here, a fictional microdata vocabulary based on the Atom vocabulary is used with the
  10432. <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>
  10433. <pre>&lt;article itemscope itemtype="http://n.example.org/rfc4287">
  10434. &lt;h1 itemprop="title">Big tasks&lt;/h1>
  10435. &lt;footer>Published &lt;time itemprop="published" datetime="2009-08-29">two days ago&lt;/time>.&lt;/footer>
  10436. &lt;p itemprop="content">Today, I went out and bought a bike for my kid.&lt;/p>
  10437. &lt;/article></pre>
  10438. </div>
  10439. <div class=example>
  10440. <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
  10441. time using the schema.org microdata vocabulary:</p>
  10442. <pre>&lt;article itemscope itemtype="http://schema.org/BlogPosting">
  10443. &lt;h1 itemprop="headline">Small tasks&lt;/h1>
  10444. &lt;footer>Published &lt;time itemprop="datePublished" datetime="2009-08-30">yesterday&lt;/time>.&lt;/footer>
  10445. &lt;p itemprop="articleBody">I put a bike bell on his bike.&lt;/p>
  10446. &lt;/article></pre>
  10447. </div>
  10448. <div class=example>
  10449. <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
  10450. ISO8601 format, for later processing by a script:</p>
  10451. <pre>&lt;p>Our first date was &lt;time datetime="2006-09-23">a Saturday&lt;/time>.&lt;/p></pre>
  10452. <p>In this second snippet, the value includes a time:</p>
  10453. <pre>&lt;p>We stopped talking at &lt;time datetime="2006-09-24T05:00-07:00">5am the next morning&lt;/time>.&lt;/p></pre>
  10454. <p>A script loaded by the page (and thus privy to the page's internal convention of marking up
  10455. 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
  10456. 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>
  10457. </div>
  10458. <div class=example>
  10459. <p>For example, this element conveys the string "Tuesday" with the additional semantic that the
  10460. 18th of November 2011 is the meaning that corresponds to "Tuesday":</p>
  10461. <pre>Today is &lt;time datetime="2011-11-18">Tuesday&lt;/time>.</pre>
  10462. </div>
  10463. <div class=example>
  10464. <p>In this example, a specific time in the Pacific Standard Time timezone is specified:</p>
  10465. <pre>Your next meeting is at &lt;time datetime="2011-11-18T15:00-08:00">3pm&lt;/time>.</pre>
  10466. </div>
  10467. <h4 id=the-code-element>4.5.15 The <dfn><code>code</code></dfn> element</h4>
  10468. <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>
  10469. <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
  10470. be an XML element name, a file name, a computer program, or any other string that a computer would
  10471. recognize.</p>
  10472. <p>There is no formal way to indicate the language of computer code being marked up. Authors who
  10473. 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
  10474. scripts can use the right rules, can use the <code id=the-code-element:classes><a href=#classes>class</a></code> attribute, e.g.
  10475. by adding a class prefixed with "<code>language-</code>" to the element.</p>
  10476. <div class=example>
  10477. <p>The following example shows how the element can be used in a paragraph to mark up element
  10478. names and computer code, including punctuation.</p>
  10479. <pre>&lt;p>The &lt;code>code&lt;/code> element represents a fragment of computer
  10480. code.&lt;/p>
  10481. &lt;p>When you call the &lt;code>activate()&lt;/code> method on the
  10482. &lt;code>robotSnowman&lt;/code> object, the eyes glow.&lt;/p>
  10483. &lt;p>The example below uses the &lt;code>begin&lt;/code> keyword to indicate
  10484. the start of a statement block. It is paired with an &lt;code>end&lt;/code>
  10485. keyword, which is followed by the &lt;code>.&lt;/code> punctuation character
  10486. (full stop) to indicate the end of the program.&lt;/p></pre>
  10487. </div>
  10488. <div class=example>
  10489. <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>
  10490. and <code id=the-code-element:the-code-element-3><a href=#the-code-element>code</a></code> elements.</p>
  10491. <pre>&lt;pre>&lt;code class="language-pascal">var i: Integer;
  10492. begin
  10493. i := 1;
  10494. end.&lt;/code>&lt;/pre></pre>
  10495. <p>A class is used in that example to indicate the language used.</p>
  10496. </div>
  10497. <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>
  10498. <h4 id=the-var-element>4.5.16 The <dfn><code>var</code></dfn> element</h4>
  10499. <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>
  10500. <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
  10501. variable in a mathematical expression or programming context, an identifier representing a
  10502. constant, a symbol identifying a physical quantity, a function parameter, or just be a term used
  10503. as a placeholder in prose.</p>
  10504. <div class=example>
  10505. <p>In the paragraph below, the letter "n" is being used as a
  10506. variable in prose:</p>
  10507. <pre>&lt;p>If there are &lt;var>n&lt;/var> pipes leading to the ice
  10508. cream factory then I expect at &lt;em>least&lt;/em> &lt;var>n&lt;/var>
  10509. flavors of ice cream to be available for purchase!&lt;/p></pre>
  10510. </div>
  10511. <p>For mathematics, in particular for anything beyond the simplest of expressions, MathML is more
  10512. 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
  10513. variables that are then mentioned in MathML expressions.</p>
  10514. <div class=example>
  10515. <p>In this example, an equation is shown, with a legend that references the variables in the
  10516. equation. The expression itself is marked up with MathML, but the variables are mentioned in the
  10517. figure's legend using <code id=the-var-element:the-var-element-3><a href=#the-var-element>var</a></code>.</p>
  10518. <pre>&lt;figure>
  10519. &lt;math>
  10520. &lt;mi>a&lt;/mi>
  10521. &lt;mo>=&lt;/mo>
  10522. &lt;msqrt>
  10523. &lt;msup>&lt;mi>b&lt;/mi>&lt;mn>2&lt;/mn>&lt;/msup>
  10524. &lt;mi>+&lt;/mi>
  10525. &lt;msup>&lt;mi>c&lt;/mi>&lt;mn>2&lt;/mn>&lt;/msup>
  10526. &lt;/msqrt>
  10527. &lt;/math>
  10528. &lt;figcaption>
  10529. Using Pythagoras' theorem to solve for the hypotenuse &lt;var>a&lt;/var> of
  10530. a triangle with sides &lt;var>b&lt;/var> and &lt;var>c&lt;/var>
  10531. &lt;/figcaption>
  10532. &lt;/figure></pre>
  10533. </div>
  10534. <div class=example>
  10535. <p>Here, the equation describing mass-energy equivalence is used in a sentence, and the
  10536. <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>
  10537. <pre>&lt;p>Then he turned to the blackboard and picked up the chalk. After a few moment's
  10538. thought, he wrote &lt;var>E&lt;/var> = &lt;var>m&lt;/var> &lt;var>c&lt;/var>&lt;sup>2&lt;/sup>. The teacher
  10539. looked pleased.&lt;/p></pre>
  10540. </div>
  10541. <h4 id=the-samp-element>4.5.17 The <dfn><code>samp</code></dfn> element</h4>
  10542. <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>
  10543. <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
  10544. program or computing system.</p>
  10545. <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>
  10546. <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
  10547. used to provide immediate output in a Web application.</p>
  10548. <div class=example>
  10549. <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
  10550. inline:</p>
  10551. <pre>&lt;p>The computer said &lt;samp>Too much cheese in tray
  10552. two&lt;/samp> but I didn't know what that meant.&lt;/p></pre>
  10553. </div>
  10554. <div class=example>
  10555. <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
  10556. <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
  10557. 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
  10558. 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
  10559. used.</p>
  10560. <pre>&lt;pre>&lt;samp>&lt;span class="prompt">jdoe@mowmow:~$&lt;/span> &lt;kbd>ssh demo.example.com&lt;/kbd>
  10561. Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1
  10562. 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
  10563. &lt;span class="prompt">jdoe@demo:~$&lt;/span> &lt;span class="cursor">_&lt;/span>&lt;/samp>&lt;/pre></pre>
  10564. </div>
  10565. <h4 id=the-kbd-element>4.5.18 The <dfn><code>kbd</code></dfn> element</h4>
  10566. <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>
  10567. <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,
  10568. although it may also be used to represent other input, such as voice commands).</p>
  10569. <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
  10570. the input as it was echoed by the system.</p>
  10571. <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
  10572. input based on system output, for example invoking a menu item.</p>
  10573. <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
  10574. represents an actual key or other single unit of input as appropriate for the input mechanism.</p>
  10575. <div class=example>
  10576. <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>
  10577. <pre>&lt;p>To make George eat an apple, press &lt;kbd>&lt;kbd>Shift&lt;/kbd>+&lt;kbd>F3&lt;/kbd>&lt;/kbd>&lt;/p></pre>
  10578. <p>In this second example, the user is told to pick a particular menu item. The outer
  10579. <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
  10580. 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
  10581. indicating that the steps are input based on something being displayed by the system, in this
  10582. case menu labels:</p>
  10583. <pre>&lt;p>To make George eat an apple, select
  10584. &lt;kbd>&lt;kbd>&lt;samp>File&lt;/samp>&lt;/kbd>|&lt;kbd>&lt;samp>Eat Apple...&lt;/samp>&lt;/kbd>&lt;/kbd>
  10585. &lt;/p></pre>
  10586. <p>Such precision isn't necessary; the following is equally fine:</p>
  10587. <pre>&lt;p>To make George eat an apple, select &lt;kbd>File | Eat Apple...&lt;/kbd>&lt;/p></pre>
  10588. </div>
  10589. <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>
  10590. <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>
  10591. <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>
  10592. element <a href=#represents id=the-sub-and-sup-elements:represents-2>represents</a> a subscript.</p>
  10593. <p>These elements must be used only to mark up typographical conventions with specific meanings,
  10594. not for typographical presentation for presentation's sake. For example, it would be inappropriate
  10595. 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
  10596. document preparation system. In general, authors should use these elements only if the
  10597. <em>absence</em> of those elements would change the meaning of the content.</p>
  10598. <p>In certain languages, superscripts are part of the typographical conventions for some
  10599. abbreviations.</p>
  10600. <div class=example>
  10601. <pre>&lt;p>The most beautiful women are
  10602. &lt;span lang="fr">&lt;abbr>M&lt;sup>lle&lt;/sup>&lt;/abbr> Gwendoline&lt;/span> and
  10603. &lt;span lang="fr">&lt;abbr>M&lt;sup>me&lt;/sup>&lt;/abbr> Denise&lt;/span>.&lt;/p></pre>
  10604. </div>
  10605. <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
  10606. have subscripts.</p>
  10607. <div class=example>
  10608. <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
  10609. variable in a family of variables:</p>
  10610. <pre>&lt;p>The coordinate of the &lt;var>i&lt;/var>th point is
  10611. (&lt;var>x&lt;sub>&lt;var>i&lt;/var>&lt;/sub>&lt;/var>, &lt;var>y&lt;sub>&lt;var>i&lt;/var>&lt;/sub>&lt;/var>).
  10612. For example, the 10th point has coordinate
  10613. (&lt;var>x&lt;sub>10&lt;/sub>&lt;/var>, &lt;var>y&lt;sub>10&lt;/sub>&lt;/var>).&lt;/p></pre>
  10614. </div>
  10615. <p>Mathematical expressions often use subscripts and superscripts. Authors are encouraged to use
  10616. 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
  10617. <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>
  10618. <div class=example>
  10619. <pre>&lt;var>E&lt;/var>=&lt;var>m&lt;/var>&lt;var>c&lt;/var>&lt;sup>2&lt;/sup></pre>
  10620. <pre>f(&lt;var>x&lt;/var>, &lt;var>n&lt;/var>) = log&lt;sub>4&lt;/sub>&lt;var>x&lt;/var>&lt;sup>&lt;var>n&lt;/var>&lt;/sup></pre>
  10621. </div>
  10622. <h4 id=the-i-element>4.5.20 The <dfn><code>i</code></dfn> element</h4>
  10623. <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>
  10624. <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
  10625. mood, or otherwise offset from the normal prose in a manner indicating a different quality of
  10626. text, such as a taxonomic designation, a technical term, an idiomatic phrase from another
  10627. language, transliteration, a thought, or a ship name in Western texts.</p>
  10628. <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>
  10629. <div class=example>
  10630. <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>
  10631. <pre>&lt;p>The &lt;i class="taxonomy">Felis silvestris catus&lt;/i> is cute.&lt;/p>
  10632. &lt;p>The term &lt;i>prose content&lt;/i> is defined above.&lt;/p>
  10633. &lt;p>There is a certain &lt;i lang="fr">je ne sais quoi&lt;/i> in the air.&lt;/p></pre>
  10634. <p>In the following example, a dream sequence is marked up using
  10635. <code id=the-i-element:the-i-element-3><a href=#the-i-element>i</a></code> elements.</p>
  10636. <pre>&lt;p>Raymond tried to sleep.&lt;/p>
  10637. &lt;p>&lt;i>The ship sailed away on Thursday&lt;/i>, he
  10638. dreamt. &lt;i>The ship had many people aboard, including a beautiful
  10639. princess called Carey. He watched her, day-in, day-out, hoping she
  10640. would notice him, but she never did.&lt;/i>&lt;/p>
  10641. &lt;p>&lt;i>Finally one night he picked up the courage to speak with
  10642. her—&lt;/i>&lt;/p>
  10643. &lt;p>Raymond woke with a start as the fire alarm rang out.&lt;/p></pre>
  10644. </div>
  10645. <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>
  10646. element to identify why the element is being used, so that if the style of a particular use (e.g.
  10647. dream sequences as opposed to taxonomic terms) is to be changed at a later date, the author
  10648. doesn't have to go through the entire document (or series of related documents) annotating each
  10649. use.</p>
  10650. <p>Authors are encouraged to consider whether other elements might be more applicable than the
  10651. <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,
  10652. 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>
  10653. <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
  10654. 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
  10655. necessarily be italicized.</p>
  10656. <h4 id=the-b-element>4.5.21 The <dfn><code>b</code></dfn> element</h4>
  10657. <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>
  10658. <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
  10659. drawn for utilitarian purposes without conveying any extra importance and with no implication of
  10660. an alternate voice or mood, such as key words in a document abstract, product names in a review,
  10661. actionable words in interactive text-driven software, or an article lede.</p>
  10662. <div class=example>
  10663. <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
  10664. marking them up as important:</p>
  10665. <pre>&lt;p>The &lt;b>frobonitor&lt;/b> and &lt;b>barbinator&lt;/b> components are fried.&lt;/p></pre>
  10666. </div>
  10667. <div class=example>
  10668. <p>In the following example, objects in a text adventure are highlighted as being special by use
  10669. of the <code id=the-b-element:the-b-element-3><a href=#the-b-element>b</a></code> element.</p>
  10670. <pre>&lt;p>You enter a small room. Your &lt;b>sword&lt;/b> glows
  10671. brighter. A &lt;b>rat&lt;/b> scurries past the corner wall.&lt;/p></pre>
  10672. </div>
  10673. <div class=example>
  10674. <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
  10675. 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
  10676. kittens adopting a rabbit as their own</a> could be marked up:</p>
  10677. <pre>&lt;article>
  10678. &lt;h2>Kittens 'adopted' by pet rabbit&lt;/h2>
  10679. &lt;p>&lt;b class="lede">Six abandoned kittens have found an
  10680. unexpected new mother figure — a pet rabbit.&lt;/b>&lt;/p>
  10681. &lt;p>Veterinary nurse Melanie Humble took the three-week-old
  10682. kittens to her Aberdeen home.&lt;/p>
  10683. <i>[...]</i></pre>
  10684. </div>
  10685. <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>
  10686. 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
  10687. style of a particular use is to be changed at a later date, the author doesn't have to go through
  10688. annotating each use.</p>
  10689. <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
  10690. 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,
  10691. 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
  10692. <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>
  10693. element.</p>
  10694. <div class=example>
  10695. <p>The following would be <em>incorrect</em> usage:</p>
  10696. <pre class=bad>&lt;p>&lt;b>WARNING!&lt;/b> Do not frob the barbinator!&lt;/p></pre>
  10697. <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
  10698. <code id=the-b-element:the-b-element-7><a href=#the-b-element>b</a></code>.</p>
  10699. </div>
  10700. <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
  10701. 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
  10702. necessarily be boldened.</p>
  10703. <h4 id=the-u-element>4.5.22 The <dfn><code>u</code></dfn> element</h4>
  10704. <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>
  10705. <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
  10706. explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in
  10707. Chinese text (a Chinese proper name mark), or labeling the text as being misspelt.</p>
  10708. <p>In most cases, another element is likely to be more appropriate: for marking stress emphasis,
  10709. 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
  10710. <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;
  10711. 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
  10712. <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
  10713. <code id=the-u-element:the-i-element><a href=#the-i-element>i</a></code> element should be used.</p>
  10714. <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
  10715. clashes with the conventional rendering of hyperlinks (underlining). Authors are encouraged to
  10716. 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>
  10717. <h4 id=the-mark-element>4.5.23 The <dfn><code>mark</code></dfn> element</h4>
  10718. <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>
  10719. <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
  10720. highlighted for reference purposes, due to its relevance in another context. When used in a
  10721. quotation or other block of text referred to from the prose, it indicates a highlight that was not
  10722. originally present but which has been added to bring the reader's attention to a part of the text
  10723. that might not have been considered important by the original author when the block was originally
  10724. written, but which is now under previously unexpected scrutiny. When used in the main prose of a
  10725. document, it indicates a part of the document that has been highlighted due to its likely
  10726. relevance to the user's current activity.</p>
  10727. <div class=example>
  10728. <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
  10729. particular part of a quotation:</p>
  10730. <pre>&lt;p lang="en-US">Consider the following quote:&lt;/p>
  10731. &lt;blockquote lang="en-GB">
  10732. &lt;p>Look around and you will find, no-one's really
  10733. &lt;mark>colour&lt;/mark> blind.&lt;/p>
  10734. &lt;/blockquote>
  10735. &lt;p lang="en-US">As we can tell from the &lt;em>spelling&lt;/em> of the word,
  10736. the person writing this quote is clearly not American.&lt;/p></pre>
  10737. <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,
  10738. possibly with a class, would be more appropriate.)</p>
  10739. </div>
  10740. <div class=example>
  10741. <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
  10742. matching some search string. If someone looked at a document, and the server knew that the user
  10743. was searching for the word "kitten", then the server might return the document with one paragraph
  10744. modified as follows:</p>
  10745. <pre>&lt;p>I also have some &lt;mark>kitten&lt;/mark>s who are visiting me
  10746. these days. They're really cute. I think they like my garden! Maybe I
  10747. should adopt a &lt;mark>kitten&lt;/mark>.&lt;/p></pre>
  10748. </div>
  10749. <div class=example>
  10750. <p>In the following snippet, a paragraph of text refers to a specific part of a code
  10751. fragment.</p>
  10752. <pre>&lt;p>The highlighted part below is where the error lies:&lt;/p>
  10753. &lt;pre>&lt;code>var i: Integer;
  10754. begin
  10755. i := &lt;mark>1.1&lt;/mark>;
  10756. end.&lt;/code>&lt;/pre></pre>
  10757. <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
  10758. appropriate. Combining both, one would get:</p>
  10759. <pre>&lt;p>The highlighted part below is where the error lies:&lt;/p>
  10760. &lt;pre>&lt;code>&lt;span class=keyword>var&lt;/span> &lt;span class=ident>i&lt;/span>: &lt;span class=type>Integer&lt;/span>;
  10761. &lt;span class=keyword>begin&lt;/span>
  10762. &lt;span class=ident>i&lt;/span> := &lt;span class=literal>&lt;mark>1.1&lt;/mark>&lt;/span>;
  10763. &lt;span class=keyword>end&lt;/span>.&lt;/code>&lt;/pre></pre>
  10764. </div>
  10765. <div class=example>
  10766. <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
  10767. text that was originally not emphasized. In this example, common typographic conventions have led
  10768. 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>
  10769. <pre>&lt;article>
  10770. &lt;style scoped>
  10771. blockquote mark, q mark {
  10772. font: inherit; font-style: italic;
  10773. text-decoration: none;
  10774. background: transparent; color: inherit;
  10775. }
  10776. .bubble em {
  10777. font: inherit; font-size: larger;
  10778. text-decoration: underline;
  10779. }
  10780. &lt;/style>
  10781. &lt;h1>She knew&lt;/h1>
  10782. &lt;p>Did you notice the subtle joke in the joke on panel 4?&lt;/p>
  10783. &lt;blockquote>
  10784. &lt;p class="bubble">I didn't &lt;em>want&lt;/em> to believe. &lt;mark>Of course
  10785. on some level I realised it was a known-plaintext attack.&lt;/mark> But I
  10786. couldn't admit it until I saw for myself.&lt;/p>
  10787. &lt;/blockquote>
  10788. &lt;p>(Emphasis mine.) I thought that was great. It's so pedantic, yet it
  10789. explains everything neatly.&lt;/p>
  10790. &lt;/article></pre>
  10791. <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
  10792. 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
  10793. highlighting a part for comment.</p>
  10794. </div>
  10795. <div class=example>
  10796. <p>The following example shows the difference between denoting the <em>importance</em> of a span
  10797. 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
  10798. (<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
  10799. relevant to the exam highlighted. The safety warnings, important though they may be, are
  10800. apparently not relevant to the exam.</p>
  10801. <pre>&lt;h3>Wormhole Physics Introduction&lt;/h3>
  10802. &lt;p>&lt;mark>A wormhole in normal conditions can be held open for a
  10803. maximum of just under 39 minutes.&lt;/mark> Conditions that can increase
  10804. the time include a powerful energy source coupled to one or both of
  10805. the gates connecting the wormhole, and a large gravity well (such as a
  10806. black hole).&lt;/p>
  10807. &lt;p>&lt;mark>Momentum is preserved across the wormhole. Electromagnetic
  10808. radiation can travel in both directions through a wormhole,
  10809. but matter cannot.&lt;/mark>&lt;/p>
  10810. &lt;p>When a wormhole is created, a vortex normally forms.
  10811. &lt;strong>Warning: The vortex caused by the wormhole opening will
  10812. annihilate anything in its path.&lt;/strong> Vortexes can be avoided when
  10813. using sufficiently advanced dialing technology.&lt;/p>
  10814. &lt;p>&lt;mark>An obstruction in a gate will prevent it from accepting a
  10815. wormhole connection.&lt;/mark>&lt;/p></pre>
  10816. </div>
  10817. <h4 id=the-bdi-element>4.5.24 The <dfn><code>bdi</code></dfn> element</h4>
  10818. <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>
  10819. <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
  10820. its surroundings for the purposes of bidirectional text formatting. <a href=#refsBIDI>[BIDI]</a></p>
  10821. <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
  10822. with other elements).</p>
  10823. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  10824. bidirectional algorithm</a>.</p>
  10825. <div class=example>
  10826. <p>This element is especially useful when embedding user-generated content with an unknown
  10827. directionality.</p>
  10828. <p>In this example, usernames are shown along with the number of posts that the user has
  10829. 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
  10830. end up confusing the text (the bidirectional algorithm would put the colon and the number "3"
  10831. next to the word "User" rather than next to the word "posts").</p>
  10832. <pre>&lt;ul>
  10833. &lt;li>User &lt;bdi>jcranmer&lt;/bdi>: 12 posts.
  10834. &lt;li>User &lt;bdi>hober&lt;/bdi>: 5 posts.
  10835. &lt;li>User &lt;bdi><bdo dir=rtl>إيان</bdo>&lt;/bdi>: 3 posts.
  10836. &lt;/ul></pre>
  10837. <figure>
  10838. <img src=http://images.whatwg.org/sample-bdi.png>
  10839. <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>
  10840. </figure>
  10841. <figure>
  10842. <img src=http://images.whatwg.org/sample-not-bdi.png>
  10843. <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>
  10844. </figure>
  10845. </div>
  10846. <h4 id=the-bdo-element>4.5.25 The <dfn><code>bdo</code></dfn> element</h4>
  10847. <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>
  10848. <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
  10849. control for its children. It allows authors to override the Unicode bidirectional algorithm by
  10850. explicitly specifying a direction override. <a href=#refsBIDI>[BIDI]</a></p>
  10851. <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
  10852. 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
  10853. 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>
  10854. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  10855. bidirectional algorithm</a>.</p>
  10856. <h4 id=the-span-element>4.5.26 The <dfn><code>span</code></dfn> element</h4>
  10857. <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>
  10858. <pre class=idl>interface <dfn id=htmlspanelement>HTMLSpanElement</dfn> : <a href=#htmlelement id=the-span-element:htmlelement>HTMLElement</a> {};</pre>
  10859. </dl>
  10860. <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
  10861. 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>,
  10862. <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
  10863. <a href=#represents id=the-span-element:represents>represents</a> its children.</p>
  10864. <div class=example>
  10865. <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
  10866. colour-coded from CSS:</p>
  10867. <pre>&lt;pre>&lt;code class="lang-c">&lt;span class="keyword">for&lt;/span> (&lt;span class="ident">j&lt;/span> = 0; &lt;span class="ident">j&lt;/span> &amp;lt; 256; &lt;span class="ident">j&lt;/span>++) {
  10868. &lt;span class="ident">i_t3&lt;/span> = (&lt;span class="ident">i_t3&lt;/span> &amp; 0x1ffff) | (&lt;span class="ident">j&lt;/span> &amp;lt;&amp;lt; 17);
  10869. &lt;span class="ident">i_t6&lt;/span> = (((((((&lt;span class="ident">i_t3&lt;/span> >> 3) ^ &lt;span class="ident">i_t3&lt;/span>) >> 1) ^ &lt;span class="ident">i_t3&lt;/span>) >> 8) ^ &lt;span class="ident">i_t3&lt;/span>) >> 5) &amp; 0xff;
  10870. &lt;span class="keyword">if&lt;/span> (&lt;span class="ident">i_t6&lt;/span> == &lt;span class="ident">i_t1&lt;/span>)
  10871. &lt;span class="keyword">break&lt;/span>;
  10872. }&lt;/code>&lt;/pre></pre>
  10873. </div>
  10874. <h4 id=the-br-element>4.5.27 The <dfn><code>br</code></dfn> element</h4>
  10875. <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>
  10876. <pre class=idl>interface <dfn id=htmlbrelement>HTMLBRElement</dfn> : <a href=#htmlelement id=the-br-element:htmlelement>HTMLElement</a> {
  10877. // <a href="#HTMLBRElement-partial">also has obsolete members</a>
  10878. };</pre>
  10879. </dl>
  10880. <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>
  10881. <p class=note>While line breaks are usually represented in visual media by physically moving
  10882. subsequent text to a new line, a style sheet or user agent would be equally justified in causing
  10883. line breaks to be rendered in a different manner, for instance as green dots, or as extra
  10884. spacing.</p>
  10885. <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
  10886. content, as in poems or addresses.</p>
  10887. <div class=example>
  10888. <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>
  10889. <pre>&lt;p>P. Sherman&lt;br>
  10890. 42 Wallaby Way&lt;br>
  10891. Sydney&lt;/p></pre>
  10892. </div>
  10893. <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>
  10894. <div class=example>
  10895. <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>
  10896. <pre>&lt;p>&lt;a ...>34 comments.&lt;/a>&lt;br>
  10897. &lt;a ...>Add a comment.&lt;/a>&lt;/p></pre>
  10898. <pre>&lt;p>&lt;label>Name: &lt;input name="name">&lt;/label>&lt;br>
  10899. &lt;label>Address: &lt;input name="address">&lt;/label>&lt;/p></pre>
  10900. <p>Here are alternatives to the above, which are correct:</p>
  10901. <pre>&lt;p>&lt;a ...>34 comments.&lt;/a>&lt;/p>
  10902. &lt;p>&lt;a ...>Add a comment.&lt;/a>&lt;/p></pre>
  10903. <pre>&lt;p>&lt;label>Name: &lt;input name="name">&lt;/label>&lt;/p>
  10904. &lt;p>&lt;label>Address: &lt;input name="address">&lt;/label>&lt;/p></pre>
  10905. </div>
  10906. <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
  10907. represents a placeholder blank line (e.g. as in a template). Such blank lines must not be used for
  10908. presentation purposes.</p>
  10909. <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
  10910. text.</p>
  10911. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  10912. bidirectional algorithm</a>.</p>
  10913. <h4 id=the-wbr-element>4.5.28 The <dfn><code>wbr</code></dfn> element</h4>
  10914. <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>
  10915. <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>
  10916. <div class=example>
  10917. <p>In the following example, someone is quoted as saying something which, for effect, is written
  10918. as one long word. However, to ensure that the text can be wrapped in a readable fashion, the
  10919. 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>
  10920. <pre>&lt;p>So then he pointed at the tiger and screamed
  10921. "there&lt;wbr>is&lt;wbr>no&lt;wbr>way&lt;wbr>you&lt;wbr>are&lt;wbr>ever&lt;wbr>going&lt;wbr>to&lt;wbr>catch&lt;wbr>me"!&lt;/p></pre>
  10922. </div>
  10923. <div class=example>
  10924. <p>Here, especially long lines of code in a program listing have suggested wrapping points given
  10925. using <code id=the-wbr-element:the-wbr-element-3><a href=#the-wbr-element>wbr</a></code> elements.</p>
  10926. <pre>&lt;pre>...
  10927. Heading heading = Helm.HeadingFactory(HeadingCoordinates[1], &lt;wbr>HeadingCoordinates[2], &lt;wbr>HeadingCoordinates[3], &lt;wbr>HeadingCoordinates[4]);
  10928. Course course = Helm.CourseFactory(Heading, &lt;wbr>Maps.MapFactoryFromHeading(heading), &lt;wbr>Speeds.GetMaximumSpeed().ConvertToWarp());
  10929. ...&lt;/pre></pre>
  10930. </div>
  10931. <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
  10932. text.</p>
  10933. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  10934. bidirectional algorithm</a>.</p>
  10935. <h4 id=usage-summary>4.5.29 Usage summary</h4>
  10936. <p><i>This section is non-normative.</i></p>
  10937. <table><thead><tr><th>Element
  10938. <th>Purpose
  10939. <th>Example
  10940. <tbody><tr><td><code id=usage-summary:the-a-element><a href=#the-a-element>a</a></code>
  10941. <td>Hyperlinks
  10942. <td><pre class=example>Visit my <strong>&lt;a href="drinks.html">drinks&lt;/a></strong> page.</pre>
  10943. <tr><td><code id=usage-summary:the-em-element><a href=#the-em-element>em</a></code>
  10944. <td>Stress emphasis
  10945. <td><pre class=example>I must say I <strong>&lt;em>adore&lt;/em></strong> lemonade.</pre>
  10946. <tr><td><code id=usage-summary:the-strong-element><a href=#the-strong-element>strong</a></code>
  10947. <td>Importance
  10948. <td><pre class=example>This tea is <strong>&lt;strong>very hot&lt;/strong></strong>.</pre>
  10949. <tr><td><code id=usage-summary:the-small-element><a href=#the-small-element>small</a></code>
  10950. <td>Side comments
  10951. <td><pre class=example>These grapes are made into wine. <strong>&lt;small>Alcohol is addictive.&lt;/small></strong></pre>
  10952. <tr><td><code id=usage-summary:the-s-element><a href=#the-s-element>s</a></code>
  10953. <td>Inaccurate text
  10954. <td><pre class=example>Price: <strong>&lt;s>£4.50&lt;/s></strong> £2.00!</pre>
  10955. <tr><td><code id=usage-summary:the-cite-element><a href=#the-cite-element>cite</a></code>
  10956. <td>Titles of works
  10957. <td><pre class=example>The case <strong>&lt;cite>Hugo v. Danielle&lt;/cite></strong> is relevant here.</pre>
  10958. <tr><td><code id=usage-summary:the-q-element><a href=#the-q-element>q</a></code>
  10959. <td>Quotations
  10960. <td><pre class=example>The judge said <strong>&lt;q>You can drink water from the fish tank&lt;/q></strong> but advised against it.</pre>
  10961. <tr><td><code id=usage-summary:the-dfn-element><a href=#the-dfn-element>dfn</a></code>
  10962. <td>Defining instance
  10963. <td><pre class=example>The term <strong>&lt;dfn>organic food&lt;/dfn></strong> refers to food produced without synthetic chemicals.</pre>
  10964. <tr><td><code id=usage-summary:the-abbr-element><a href=#the-abbr-element>abbr</a></code>
  10965. <td>Abbreviations
  10966. <td><pre class=example>Organic food in Ireland is certified by the <strong>&lt;abbr title="Irish Organic Farmers and Growers Association">IOFGA&lt;/abbr></strong>.</pre>
  10967. <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>
  10968. <td>Ruby annotations
  10969. <td><pre class=example><strong>&lt;ruby> OJ &lt;rp>(&lt;rt>Orange Juice&lt;rp>)&lt;/ruby></strong></pre>
  10970. <tr><td><code id=usage-summary:the-data-element><a href=#the-data-element>data</a></code>
  10971. <td>Machine-readable equivalent
  10972. <td><pre class=example>Available starting today! <strong>&lt;data value="UPC:022014640201">North Coast Organic Apple Cider&lt;/data></strong></pre>
  10973. <tr><td><code id=usage-summary:the-time-element><a href=#the-time-element>time</a></code>
  10974. <td>Machine-readable equivalent of date- or time-related data
  10975. <td><pre class=example>Available starting on <strong>&lt;time datetime="2011-11-12">November 12th&lt;/time></strong>!</pre>
  10976. <tr><td><code id=usage-summary:the-code-element><a href=#the-code-element>code</a></code>
  10977. <td>Computer code
  10978. <td><pre class=example>The <strong>&lt;code>fruitdb&lt;/code></strong> program can be used for tracking fruit production.</pre>
  10979. <tr><td><code id=usage-summary:the-var-element><a href=#the-var-element>var</a></code>
  10980. <td>Variables
  10981. <td><pre class=example>If there are <strong>&lt;var>n&lt;/var></strong> fruit in the bowl, at least <strong>&lt;var>n&lt;/var></strong>÷2 will be ripe.</pre>
  10982. <tr><td><code id=usage-summary:the-samp-element><a href=#the-samp-element>samp</a></code>
  10983. <td>Computer output
  10984. <td><pre class=example>The computer said <strong>&lt;samp>Unknown error -3&lt;/samp></strong>.</pre>
  10985. <tr><td><code id=usage-summary:the-kbd-element><a href=#the-kbd-element>kbd</a></code>
  10986. <td>User input
  10987. <td><pre class=example>Hit <strong>&lt;kbd>F1&lt;/kbd></strong> to continue.</pre>
  10988. <tr><td><code id=usage-summary:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>
  10989. <td>Subscripts
  10990. <td><pre class=example>Water is H<strong>&lt;sub>2&lt;/sub></strong>O.</pre>
  10991. <tr><td><code id=usage-summary:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>
  10992. <td>Superscripts
  10993. <td><pre class=example>The Hydrogen in heavy water is usually <strong>&lt;sup>2&lt;/sup></strong>H.</pre>
  10994. <tr><td><code id=usage-summary:the-i-element><a href=#the-i-element>i</a></code>
  10995. <td>Alternative voice
  10996. <td><pre class=example>Lemonade consists primarily of <strong>&lt;i>Citrus limon&lt;/i></strong>.</pre>
  10997. <tr><td><code id=usage-summary:the-b-element><a href=#the-b-element>b</a></code>
  10998. <td>Keywords
  10999. <td><pre class=example>Take a <strong>&lt;b>lemon&lt;/b></strong> and squeeze it with a <strong>&lt;b>juicer&lt;/b></strong>.</pre>
  11000. <tr><td><code id=usage-summary:the-u-element><a href=#the-u-element>u</a></code>
  11001. <td>Annotations
  11002. <td><pre class=example>The mixture of apple juice and <strong>&lt;u class="spelling">eldeflower&lt;/u></strong> juice is very pleasant.</pre>
  11003. <tr><td><code id=usage-summary:the-mark-element><a href=#the-mark-element>mark</a></code>
  11004. <td>Highlight
  11005. <td><pre class=example>Elderflower cordial, with one <strong>&lt;mark>part&lt;/mark></strong> cordial to ten <strong>&lt;mark>part&lt;/mark></strong>s water, stands a<strong>&lt;mark>part&lt;/mark></strong> from the rest.</pre>
  11006. <tr><td><code id=usage-summary:the-bdi-element><a href=#the-bdi-element>bdi</a></code>
  11007. <td>Text directionality isolation
  11008. <td><pre class=example>The recommended restaurant is <strong>&lt;bdi lang="">My Juice Café (At The Beach)&lt;/bdi></strong>.</pre>
  11009. <tr><td><code id=usage-summary:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
  11010. <td>Text directionality formatting
  11011. <td><pre class=example>The proposal is to write English, but in reverse order. "Juice" would become "<strong>&lt;bdo dir=rtl>Juice&lt;/bdo></strong>"</pre>
  11012. <tr><td><code id=usage-summary:the-span-element><a href=#the-span-element>span</a></code>
  11013. <td>Other
  11014. <td><pre class=example>In French we call it <strong>&lt;span lang="fr">sirop de sureau&lt;/span></strong>.</pre>
  11015. <tr><td><code id=usage-summary:the-br-element><a href=#the-br-element>br</a></code>
  11016. <td>Line break
  11017. <td><pre class=example>Simply Orange Juice Company<strong>&lt;br></strong>Apopka, FL 32703<strong>&lt;br></strong>U.S.A.</pre>
  11018. <tr><td><code id=usage-summary:the-wbr-element><a href=#the-wbr-element>wbr</a></code>
  11019. <td>Line breaking opportunity
  11020. <td><pre class=example>www.simply<strong>&lt;wbr></strong>orange<strong>&lt;wbr></strong>juice.com</pre>
  11021. </table>
  11022. <h3 id=links>4.6 Links</h3>
  11023. <h4 id=introduction-2>4.6.1 Introduction</h4>
  11024. <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
  11025. <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
  11026. 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
  11027. HTML:</p>
  11028. <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,
  11029. 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
  11030. 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.
  11031. to visit them in a browser or download them.</dl>
  11032. <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
  11033. <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
  11034. <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>
  11035. <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
  11036. <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,
  11037. <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>
  11038. 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
  11039. 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
  11040. specifying <a href=#hyperlink id=introduction-2:hyperlink>hyperlinks</a>, must also create a <a href=#hyperlink id=introduction-2:hyperlink-2>hyperlink</a>.
  11041. This implied hyperlink has no special meaning (it has no <a href=#linkTypes>link type</a>)
  11042. 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>
  11043. <p>A <a href=#hyperlink id=introduction-2:hyperlink-3>hyperlink</a> can have one or more <dfn id=hyperlink-annotation>hyperlink
  11044. annotations</dfn> that modify the processing semantics of that hyperlink.</p>
  11045. <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>
  11046. <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
  11047. <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
  11048. spaces</a>.</p>
  11049. <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
  11050. <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>
  11051. <p>The <dfn id=attr-hyperlink-target><code>target</code></dfn> attribute, if present, must be
  11052. 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
  11053. context</a> that will be used. User agents use this name when
  11054. <a href=#following-hyperlinks-2 id=links-created-by-a-and-area-elements:following-hyperlinks-2>following hyperlinks</a>.</p>
  11055. <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
  11056. invoked, the user agent may allow the user to indicate a preference regarding whether the
  11057. 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
  11058. specifies is to be downloaded.</p>
  11059. <p>In the absence of a user preference, the default should be navigation if the element has no
  11060. <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
  11061. specified resource if it does.</p>
  11062. <p>Whether determined by the user's preferences or via the presence or absence of the attribute,
  11063. 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
  11064. 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
  11065. 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
  11066. below.</p>
  11067. <p>The <dfn id=attr-hyperlink-download><code>download</code></dfn> attribute, if present,
  11068. indicates that the author intends the hyperlink to be used for downloading a resource. The
  11069. attribute may have a value; the value, if any, specifies the default file name that the author
  11070. recommends for use in labeling the resource in a local file system. There are no restrictions on
  11071. allowed values, but authors are cautioned that most file systems have limitations with regard to
  11072. what punctuation is supported in file names, and user agents are likely to adjust file names
  11073. accordingly.</p>
  11074. <p>The <dfn id=ping><code>ping</code></dfn> attribute, if present,
  11075. gives the URLs of the resources that are interested in being notified if the user follows the
  11076. 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
  11077. <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
  11078. <a href=#hyperlink-auditing id=links-created-by-a-and-area-elements:hyperlink-auditing>hyperlink auditing</a>.</p>
  11079. <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
  11080. <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
  11081. 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
  11082. and their meanings</a> are defined below.</p>
  11083. <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
  11084. attribute is omitted or if none of the values in the attribute are recognised by the user agent,
  11085. then the document has no particular relationship with the destination resource other than there
  11086. being a hyperlink between the two.</p>
  11087. <p>The <dfn id=attr-hyperlink-hreflang><code>hreflang</code></dfn> attribute on
  11088. <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
  11089. purely advisory. The value must be a valid BCP 47 language tag. <a href=#refsBCP47>[BCP47]</a>
  11090. User agents must not consider this attribute authoritative — upon
  11091. fetching the resource, user agents must use only language information associated with the resource
  11092. to determine its language, not metadata included in the link to the resource.</p>
  11093. <p>The <dfn id=attr-hyperlink-type><code>type</code></dfn> attribute, if present, gives the
  11094. <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
  11095. <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
  11096. resource, user agents must not use metadata included in the link to the resource to determine its
  11097. type.</p>
  11098. <h4 id=following-hyperlinks>4.6.3 Following hyperlinks</h4>
  11099. <p>When a user <dfn id=following-hyperlinks-2>follows a hyperlink</dfn> created by an element
  11100. <var>subject</var>, the user agent must run the following steps:</p>
  11101. <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
  11102. <code id=following-hyperlinks:document><a href=#document>Document</a></code> object with which <var>subject</var> in question is
  11103. associated.<li>
  11104. <p>If the user indicated a specific <a href=#browsing-context id=following-hyperlinks:browsing-context-2>browsing context</a> when following the hyperlink,
  11105. or if the user agent is configured to follow hyperlinks by navigating a particular browsing
  11106. context, then let <var>target</var> be that <a href=#browsing-context id=following-hyperlinks:browsing-context-3>browsing context</a>.</p>
  11107. <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
  11108. 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
  11109. rules for choosing a browsing context given a browsing context name</a>, using the value of
  11110. the <code id=following-hyperlinks:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name. If
  11111. 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>
  11112. <p>Otherwise, if the hyperlink is a <a href=#rel-sidebar-hyperlink id=following-hyperlinks:rel-sidebar-hyperlink>sidebar
  11113. 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
  11114. browsing context</a>, and the user agent intends to use this feature in this instance, let
  11115. <var>target</var> be such a <a href=#secondary-browsing-context id=following-hyperlinks:secondary-browsing-context-2>secondary browsing context</a>.</p>
  11116. <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
  11117. with no <code id=following-hyperlinks:attr-hyperlink-target-3><a href=#attr-hyperlink-target>target</a></code> attribute, but the
  11118. <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
  11119. <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
  11120. 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
  11121. 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
  11122. context</a>, set <var>replace</var> to true.</p>
  11123. <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>
  11124. <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
  11125. element.<li>
  11126. <p>If that is successful, let <var>URL</var> be the <a href=#resulting-absolute-url id=following-hyperlinks:resulting-absolute-url>resulting absolute
  11127. URL</a>.</p>
  11128. <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
  11129. 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
  11130. task</a> to <a href=#navigate id=following-hyperlinks:navigate>navigate</a> the <var>target</var>
  11131. <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
  11132. do nothing. In any case, the user agent must then abort these steps.</p>
  11133. <li><p>In the case of server-side image maps, append the <var id=following-hyperlinks:hyperlink-suffix><a href=#hyperlink-suffix>hyperlink
  11134. suffix</a></var> to <var>URL</var>.<li>
  11135. <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
  11136. enabled</a>. The <a href=#source-browsing-context id=following-hyperlinks:source-browsing-context>source browsing context</a> must be <var>source</var>.</p>
  11137. </ol>
  11138. <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
  11139. source</a>.</p>
  11140. <h4 id=downloading-resources>4.6.4 Downloading resources</h4>
  11141. <p>In some cases, resources are intended for later use rather than immediate viewing. To indicate
  11142. that a resource is intended to be downloaded for use later, rather than immediately used, the
  11143. <code id=downloading-resources:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute can be specified on the
  11144. <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
  11145. resource.</p>
  11146. <p>The attribute can furthermore be given a value, to specify the file name that user agents are
  11147. 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>
  11148. <p>In cross-origin situations, the <code id=downloading-resources:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code> attribute
  11149. has to be combined with the <code id=downloading-resources:http-content-disposition-2><a href=#http-content-disposition>Content-Disposition</a></code> HTTP
  11150. header, specifically with the <code>attachment</code> disposition type, to avoid the user
  11151. being warned of possibly nefarious activity. (This is to protect users from being made to download
  11152. sensitive personal or confidential information without their full understanding.)</p>
  11153. <hr>
  11154. <p>When a user <dfn id=downloading-hyperlinks>downloads a hyperlink</dfn> created by an
  11155. element, the user agent must run the following steps:</p>
  11156. <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
  11157. 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
  11158. may report the error to the user in a user-agent-specific manner, may
  11159. <a href=#navigate id=downloading-resources:navigate>navigate</a> to an error page to report the error, or may
  11160. ignore the error and do nothing. In either case, the user agent must abort these steps.</p>
  11161. <li><p>Otherwise, let <var>URL</var> be the resulting <a href=#absolute-url id=downloading-resources:absolute-url>absolute
  11162. 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
  11163. suffix</a></var> to <var>URL</var>.<li><p>Return to whatever algorithm invoked these steps and continue
  11164. these steps asynchronously.<li><p><a href=#fetch id=downloading-resources:fetch>Fetch</a> <var>URL</var> and handle the resulting resource
  11165. <a href=#as-a-download id=downloading-resources:as-a-download>as a download</a>.</ol>
  11166. <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
  11167. a download</dfn>, it should provide the user with a way to save the resource for later use, if a
  11168. resource is successfully obtained; or otherwise should report any problems downloading the file to
  11169. the user.</p>
  11170. <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
  11171. should select one using the following algorithm.</p>
  11172. <p class=warning>This algorithm is intended to mitigate security dangers involved in downloading
  11173. files from untrusted sites, and user agents are strongly urged to follow it.</p>
  11174. <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>
  11175. header, that header specifies the <code>attachment</code> disposition type, and the
  11176. header includes file name information, then let <var>filename</var> have the value
  11177. 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
  11178. <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
  11179. <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
  11180. resource being downloaded, unless that URL's <a href=#concept-url-scheme id=downloading-resources:concept-url-scheme>scheme</a>
  11181. component is <code>data</code>, in which case let <var>resource origin</var> be
  11182. the same as the <var>interface origin</var>, if any.<li><p>If there is no <var>interface origin</var>, then let <var>trusted
  11183. 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
  11184. 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
  11185. name information, then let <var>filename</var> have the value specified by the header,
  11186. 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
  11187. <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
  11188. which it was initiated did not have a <code id=downloading-resources:attr-hyperlink-download-3><a href=#attr-hyperlink-download>download</a></code>
  11189. attribute when the download was initiated, or if there was such an attribute but its value when
  11190. the download was initiated was the empty string, then jump to the step labeled <i>no proposed
  11191. 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
  11192. <a href=#hyperlink id=downloading-resources:hyperlink-4>hyperlink</a> that initiated the download at the time the download was
  11193. initiated.<li><p>If <var>trusted operation</var> is true, let <var>filename</var> have
  11194. the value of <var>proposed filename</var>, and jump to the step labeled <i>sanitize</i>
  11195. 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>
  11196. 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
  11197. 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
  11198. 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
  11199. user-agent-defined manner, and jump to the step labeled <i>sanitize</i> below.<li>
  11200. <p>Act in a user-agent-defined manner to safeguard the user from a potentially hostile
  11201. 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
  11202. the user agent, and jump to the step labeled <i>sanitize</i> below.</p>
  11203. <div class=warning>
  11204. <p>If the algorithm reaches this step, then a download was begun from a different origin than
  11205. the resource being downloaded, and the origin did not mark the file as suitable for
  11206. 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
  11207. because the resource in question is not of a type that the user agent supports.</p>
  11208. <p>This could be dangerous, because, for instance, a hostile server could be trying to get a
  11209. user to unknowingly download private information and then re-upload it to the hostile server,
  11210. by tricking the user into thinking the data is from the hostile server.</p>
  11211. <p>Thus, it is in the user's interests that the user be somehow notified that the resource in
  11212. question comes from quite a different source, and to prevent confusion, any suggested file name
  11213. from the potentially hostile <var>interface origin</var> should be ignored.</p>
  11214. </div>
  11215. <li><p><i>Sanitize</i>: Optionally, allow the user to influence <var>filename</var>. For
  11216. example, a user agent could prompt the user for a file name, potentially providing the value of
  11217. <var>filename</var> as determined above as a default value.<li>
  11218. <p>Adjust <var>filename</var> to be suitable for the local file system.</p>
  11219. <p class=example>For example, this could involve removing characters that are not legal in
  11220. file names, or trimming leading and trailing whitespace.</p>
  11221. <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,
  11222. 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
  11223. 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
  11224. <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
  11225. 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
  11226. (i.e. the type given by the resource's <a href=#content-type id=downloading-resources:content-type-2>Content-Type metadata</a> is
  11227. 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
  11228. name and abort these steps.<li>
  11229. <p>If the <var>claimed type</var> is known, then alter <var>filename</var> to
  11230. add an <a href=#concept-extension id=downloading-resources:concept-extension-5>extension</a> corresponding to <var>claimed
  11231. type</var>.</p>
  11232. <p>Otherwise, if <var>named type</var> is known to be potentially dangerous (e.g. it
  11233. will be treated by the platform conventions as a native executable, shell script, HTML
  11234. 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>
  11235. (e.g. "<code>.txt</code>").</p>
  11236. <p class=note>This last step would make it impossible to download executables, which might not
  11237. be desirable. As always, implementors are forced to balance security and usability in this
  11238. matter.</p>
  11239. <li><p>Return <var>filename</var> as the file name.</ol>
  11240. <p>For the purposes of this algorithm, a file <dfn id=concept-extension>extension</dfn>
  11241. consists of any part of the file name that platform conventions dictate will be used for
  11242. identifying the type of the file. For example, many operating systems use the part of the file
  11243. name following the last dot ("<code>.</code>") in the file name to determine the type of
  11244. the file, and from that the manner in which the file is to be opened or executed.</p>
  11245. <p>User agents should ignore any directory or path information provided by the resource itself,
  11246. 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
  11247. deciding where to store the resulting file in the user's file system.</p>
  11248. <h5 id=hyperlink-auditing>4.6.4.1 <dfn>Hyperlink auditing</dfn></h5>
  11249. <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
  11250. <code id=hyperlink-auditing:ping><a href=#ping>ping</a></code> attribute, and the user follows the hyperlink, and
  11251. 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
  11252. 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
  11253. 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
  11254. <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
  11255. with the primary request, and is independent of the result of that request.</p>
  11256. <p>User agents should allow the user to adjust this behavior, for example in conjunction with a
  11257. setting that disables the sending of HTTP <code id=hyperlink-auditing:http-referer><a href=#http-referer>Referer</a></code> (sic)
  11258. 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
  11259. list (e.g. ignoring any third-party URLs).</p>
  11260. <p>For each <var>ping URL</var> that is an HTTP URL, the request must be performed using
  11261. 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>
  11262. consisting of the four-character string "<code>PING</code>". All relevant cookie and
  11263. HTTP authentication headers must be included in the request. Which other headers are required
  11264. 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>
  11265. <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>
  11266. object containing the hyperlink being audited and <var>ping URL</var> have the
  11267. <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,
  11268. 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
  11269. the hyperlink, and a <code id=hyperlink-auditing:ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
  11270. 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
  11271. 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,
  11272. 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
  11273. the hyperlink, a <code id=hyperlink-auditing:ping-from-2><a href=#ping-from>Ping-From</a></code> HTTP header with the same value,
  11274. 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
  11275. 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
  11276. 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>
  11277. <p class=note>To save bandwidth, implementors might also wish to consider omitting optional
  11278. headers such as <code id=hyperlink-auditing:http-accept><a href=#http-accept>Accept</a></code> from these requests.</p>
  11279. <p>User agents must, unless otherwise specified by the user, honor the HTTP headers (including, in
  11280. particular, redirects and HTTP cookie headers), but must ignore any entity bodies returned in the
  11281. responses. User agents may close the connection prematurely once they start receiving an entity
  11282. body. <a href=#refsCOOKIES>[COOKIES]</a></p>
  11283. <p>When the <code id=hyperlink-auditing:ping-4><a href=#ping>ping</a></code> attribute is present, user agents
  11284. should clearly indicate to the user that following the hyperlink will also cause secondary
  11285. requests to be sent in the background, possibly including listing the actual target URLs.</p>
  11286. <p class=example>For example, a visual user agent could include the hostnames of the target ping
  11287. URLs along with the hyperlink's actual URL in a status bar or tooltip.</p>
  11288. <div class=note>
  11289. <p>The <code id=hyperlink-auditing:ping-5><a href=#ping>ping</a></code> attribute is redundant with pre-existing
  11290. technologies like HTTP redirects and JavaScript in allowing Web pages to track which off-site
  11291. links are most popular or allowing advertisers to track click-through rates.</p>
  11292. <p>However, the <code id=hyperlink-auditing:ping-6><a href=#ping>ping</a></code> attribute provides these advantages
  11293. to the user over those alternatives:</p>
  11294. <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
  11295. functionality.<li>It allows the UA to optimise the use of available network bandwidth so that the target page
  11296. loads faster.</ul>
  11297. <p>Thus, while it is possible to track users without this feature, authors are encouraged to use
  11298. the <code id=hyperlink-auditing:ping-7><a href=#ping>ping</a></code> attribute so that the user agent can make the
  11299. user experience more transparent.</p>
  11300. </div>
  11301. <h4 id=linkTypes>4.6.5 Link types</h4>
  11302. <p>The following table summarizes the link types that are defined by this specification. This
  11303. table is non-normative; the actual definitions for the link types are given in the next few
  11304. sections.</p>
  11305. <p>In this section, the term <i>referenced document</i> refers to the resource identified by the
  11306. element representing the link, and the term <i>current document</i> refers to the resource within
  11307. which the element representing the link finds itself.</p>
  11308. <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
  11309. <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
  11310. that apply to that element.</p>
  11311. <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>
  11312. <p>Link types are always <a href=#ascii-case-insensitive id=linkTypes:ascii-case-insensitive>ASCII case-insensitive</a>, and must be
  11313. compared as such.</p>
  11314. <p class=example>Thus, <code>rel="next"</code> is the same as <code>rel="NEXT"</code>.</p>
  11315. <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>
  11316. <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
  11317. in documents.</p>
  11318. <h5 id=rel-alternate>4.6.5.1 Link type "<dfn><code>alternate</code></dfn>"</h5>
  11319. <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>,
  11320. <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>
  11321. <p>The meaning of this keyword depends on the values of the other attributes.</p>
  11322. <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>
  11323. attribute also contains the keyword <code id=rel-alternate:link-type-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code><dd>
  11324. <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
  11325. <code id=rel-alternate:rel-alternate-3><a href=#rel-alternate>alternate</a></code> keyword does not create a link of its own.</p>
  11326. <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>
  11327. <p>The keyword creates a <a href=#hyperlink id=rel-alternate:hyperlink>hyperlink</a> referencing a syndication feed (though not
  11328. necessarily syndicating exactly the same content as the current page).</p>
  11329. <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
  11330. <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
  11331. be treated as the default syndication feed for the purposes of feed autodiscovery.</p>
  11332. <div class=example>
  11333. <p>The following <code id=rel-alternate:the-link-element-4><a href=#the-link-element>link</a></code> element gives the syndication
  11334. feed for the current page:</p>
  11335. <pre>&lt;link rel="alternate" type="application/atom+xml" href="data.xml"></pre>
  11336. <p>The following extract offers various different syndication
  11337. feeds:</p>
  11338. <pre>&lt;p>You can access the planets database using Atom feeds:&lt;/p>
  11339. &lt;ul>
  11340. &lt;li>&lt;a href="recently-visited-planets.xml" rel="alternate" type="application/atom+xml">Recently Visited Planets&lt;/a>&lt;/li>
  11341. &lt;li>&lt;a href="known-bad-planets.xml" rel="alternate" type="application/atom+xml">Known Bad Planets&lt;/a>&lt;/li>
  11342. &lt;li>&lt;a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml">Unexplored Planets&lt;/a>&lt;/li>
  11343. &lt;/ul></pre>
  11344. </div>
  11345. <dt>Otherwise<dd>
  11346. <p>The keyword creates a <a href=#hyperlink id=rel-alternate:hyperlink-2>hyperlink</a> referencing an alternate representation of the
  11347. current document.</p>
  11348. <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>
  11349. <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
  11350. 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
  11351. document is a translation.</p>
  11352. <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
  11353. a reformulation of the current document in the specified format.</p>
  11354. <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>
  11355. <div class=example>
  11356. <p>For example, the following link is a French translation that uses the PDF format:</p>
  11357. <pre>&lt;link rel=alternate type=application/pdf hreflang=fr href=manual-fr></pre>
  11358. </div>
  11359. <p>This relationship is transitive — that is, if a document links to two other documents
  11360. with the link type "<code id=rel-alternate:rel-alternate-9><a href=#rel-alternate>alternate</a></code>", then, in addition to implying
  11361. that those documents are alternative representations of the first document, it is also implying
  11362. that those two documents are alternative representations of each other.</p>
  11363. </dl>
  11364. <h5 id=link-type-author>4.6.5.2 Link type "<dfn><code>author</code></dfn>"</h5>
  11365. <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>,
  11366. <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>
  11367. <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>
  11368. keyword indicates that the referenced document provides further information about the author of
  11369. 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
  11370. is one, or of the page as a whole, otherwise.</p>
  11371. <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
  11372. that the referenced document provides further information about the author for the page as a
  11373. whole.</p>
  11374. <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>
  11375. <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat
  11376. <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>
  11377. <h5 id=link-type-bookmark>4.6.5.3 Link type "<dfn><code>bookmark</code></dfn>"</h5>
  11378. <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
  11379. <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>
  11380. <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
  11381. 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
  11382. there are no ancestor <code id=link-type-bookmark:the-article-element-2><a href=#the-article-element>article</a></code> elements.</p>
  11383. <div class=example>
  11384. <p>The following snippet has three permalinks. A user agent could determine which permalink
  11385. applies to which part of the spec by looking at where the permalinks are given.</p>
  11386. <pre> ...
  11387. &lt;body>
  11388. &lt;h1>Example of permalinks&lt;/h1>
  11389. &lt;div id="a">
  11390. &lt;h2>First example&lt;/h2>
  11391. &lt;p>&lt;a href="a.html" rel="bookmark">This permalink applies to
  11392. only the content from the first H2 to the second H2&lt;/a>. The DIV isn't
  11393. exactly that section, but it roughly corresponds to it.&lt;/p>
  11394. &lt;/div>
  11395. &lt;h2>Second example&lt;/h2>
  11396. &lt;article id="b">
  11397. &lt;p>&lt;a href="b.html" rel="bookmark">This permalink applies to
  11398. the outer ARTICLE element&lt;/a> (which could be, e.g., a blog post).&lt;/p>
  11399. &lt;article id="c">
  11400. &lt;p>&lt;a href="c.html" rel="bookmark">This permalink applies to
  11401. the inner ARTICLE element&lt;/a> (which could be, e.g., a blog comment).&lt;/p>
  11402. &lt;/article>
  11403. &lt;/article>
  11404. &lt;/body>
  11405. ...</pre>
  11406. </div>
  11407. <h5 id=link-type-external>4.6.5.4 Link type "<dfn><code>external</code></dfn>"</h5>
  11408. <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
  11409. <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
  11410. implied hyperlink, if no other keywords create one).</p>
  11411. <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
  11412. document that is not part of the site that the current document forms a part of.</p>
  11413. <h5 id=link-type-help>4.6.5.5 Link type "<dfn><code>help</code></dfn>"</h5>
  11414. <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>,
  11415. <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>
  11416. <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>
  11417. keyword indicates that the referenced document provides further help information for the parent of
  11418. the element defining the hyperlink, and its children.</p>
  11419. <div class=example>
  11420. <p>In the following example, the form control has associated context-sensitive help. The user
  11421. agent could use this information, for example, displaying the referenced document if the user
  11422. presses the "Help" or "F1" key.</p>
  11423. <pre> &lt;p>&lt;label> Topic: &lt;input name=topic> &lt;a href="help/topic.html" rel="help">(Help)&lt;/a>&lt;/label>&lt;/p></pre>
  11424. </div>
  11425. <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
  11426. the referenced document provides help for the page as a whole.</p>
  11427. <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>
  11428. <h5 id=rel-icon>4.6.5.6 Link type "<dfn><code>icon</code></dfn>"</h5>
  11429. <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.
  11430. This keyword creates an <a href=#external-resource-link id=rel-icon:external-resource-link>external resource link</a>.</p>
  11431. <p>The specified resource is an icon representing the page or site, and should be used by the user
  11432. agent when representing the page in the user interface.</p>
  11433. <p>Icons could be auditory icons, visual icons, or other kinds of icons. If
  11434. multiple icons are provided, the user agent must select the most appropriate icon according to the
  11435. <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,
  11436. 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
  11437. agent collected the list of icons. If the user agent tries to use an icon but that icon is
  11438. determined, upon closer examination, to in fact be inappropriate (e.g. because it uses an
  11439. unsupported format), then the user agent must try the next-most-appropriate icon as determined by
  11440. the attributes.</p>
  11441. <p class=note>User agents are not required to update icons when the list of icons changes, but
  11442. are encouraged to do so.</p>
  11443. <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.
  11444. However, for the purposes of <a href=#concept-link-type-sniffing>determining the type of the
  11445. resource</a>, user agents must expect the resource to be an image.</p>
  11446. <p>The <dfn id=attr-link-sizes><code>sizes</code></dfn> attribute gives the sizes of icons
  11447. for visual media. Its value, if present, is merely advisory. User agents may use the value to
  11448. decide which icon(s) to use if multiple icons are available.</p>
  11449. <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
  11450. 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
  11451. 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
  11452. ZERO (0) character and that are separated by a single U+0078 LATIN SMALL LETTER X or U+0058 LATIN
  11453. CAPITAL LETTER X character.</p>
  11454. <p>The keywords represent icon sizes in raw pixels (as opposed to CSS pixels).</p>
  11455. <p class=note>An icon that is 50 CSS pixels wide intended for displays with a device pixel
  11456. density of two device pixels per CSS pixel (2x, 192dpi) would have a width of 100 raw pixels. This
  11457. feature does not support indicating that a different resource is to be used for small
  11458. high-resolution icons vs large low-resolution icons (e.g. 50×50 2x vs 100×100 1x).</p>
  11459. <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
  11460. keyword to determine what it represents.</p>
  11461. <p>The <dfn id=attr-link-sizes-any><code>any</code></dfn> keyword represents that the
  11462. resource contains a scalable icon, e.g. as provided by an SVG image.</p>
  11463. <p>Other keywords must be further parsed as follows to determine what they represent:</p>
  11464. <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN SMALL LETTER X or U+0058 LATIN
  11465. CAPITAL LETTER X character, then this keyword doesn't represent anything. Abort these steps for
  11466. that keyword.<li><p>Let <var>width string</var> be the string before the "<code>x</code>" or
  11467. "<code>X</code>".<li><p>Let <var>height string</var> be the string after the "<code>x</code>" or
  11468. "<code>X</code>".<li><p>If either <var>width string</var> or <var>height string</var> start with
  11469. 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>,
  11470. 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
  11471. 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
  11472. 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
  11473. pixels.</ul>
  11474. <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
  11475. represent icon sizes that are not actually available in the linked resource.</p>
  11476. <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
  11477. <code id=rel-icon:document><a href=#document>Document</a></code>s obtained over HTTP or HTTPS, user agents may instead attempt to
  11478. <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
  11479. 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
  11480. 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>
  11481. keyword.</p>
  11482. <div class=example>
  11483. <p>The following snippet shows the top part of an application with several icons.</p>
  11484. <pre>&lt;!DOCTYPE HTML>
  11485. &lt;html>
  11486. &lt;head>
  11487. &lt;title>lsForums — Inbox&lt;/title>
  11488. &lt;link rel=icon href=favicon.png sizes="16x16" type="image/png">
  11489. &lt;link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon">
  11490. &lt;link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768">
  11491. &lt;link rel=icon href=iphone.png sizes="57x57" type="image/png">
  11492. &lt;link rel=icon href=gnome.svg sizes="any" type="image/svg+xml">
  11493. &lt;link rel=stylesheet href=lsforums.css>
  11494. &lt;script src=lsforums.js>&lt;/script>
  11495. &lt;meta name=application-name content="lsForums">
  11496. &lt;/head>
  11497. &lt;body>
  11498. ...</pre>
  11499. </div>
  11500. <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
  11501. keyword "<code>shortcut</code>". If the "<code>shortcut</code>" keyword is
  11502. present, the <code id=rel-icon:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute's entire value must be an
  11503. <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
  11504. no other <a href=#space-character id=rel-icon:space-character>space characters</a>).</p>
  11505. <h5 id=link-type-license>4.6.5.7 Link type "<dfn><code>license</code></dfn>"</h5>
  11506. <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>,
  11507. <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>
  11508. <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
  11509. provides the copyright license terms under which the main content of the current document is
  11510. provided.</p>
  11511. <p>This specification does not specify how to distinguish between the main content of a document
  11512. and content that is not deemed to be part of that main content. The distinction should be made
  11513. clear to the user.</p>
  11514. <div class=example>
  11515. <p>Consider a photo sharing site. A page on that site might describe and show a photograph, and
  11516. the page might be marked up as follows:</p>
  11517. <pre>&lt;!DOCTYPE HTML>
  11518. &lt;html>
  11519. &lt;head>
  11520. &lt;title>Exampl Pictures: Kissat&lt;/title>
  11521. &lt;link rel="stylesheet" href="/style/default">
  11522. &lt;/head>
  11523. &lt;body>
  11524. &lt;h1>Kissat&lt;/h1>
  11525. &lt;nav>
  11526. &lt;a href="../">Return to photo index&lt;/a>
  11527. &lt;/nav>
  11528. &lt;figure>
  11529. &lt;img src="/pix/39627052_fd8dcd98b5.jpg">
  11530. &lt;figcaption>Kissat&lt;/figcaption>
  11531. &lt;/figure>
  11532. &lt;p>One of them has six toes!&lt;/p>
  11533. &lt;p>&lt;small>&lt;a rel="license" href="http://www.opensource.org/licenses/mit-license.php">MIT Licensed&lt;/a>&lt;/small>&lt;/p>
  11534. &lt;footer>
  11535. &lt;a href="/">Home&lt;/a> | &lt;a href="../">Photo index&lt;/a>
  11536. &lt;p>&lt;small>© copyright 2009 Exampl Pictures. All Rights Reserved.&lt;/small>&lt;/p>
  11537. &lt;/footer>
  11538. &lt;/body>
  11539. &lt;/html></pre>
  11540. <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
  11541. content of the document), not the whole document. In particular not the design of the page
  11542. itself, which is covered by the copyright given at the bottom of the document. This could be made
  11543. clearer in the styling (e.g. making the license link prominently positioned near the photograph,
  11544. while having the page copyright in light small text at the foot of the page.</p>
  11545. </div>
  11546. <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat the keyword
  11547. "<code>copyright</code>" like the <code id=link-type-license:link-type-license-4><a href=#link-type-license>license</a></code> keyword.</p>
  11548. <h5 id=link-type-nofollow>4.6.5.8 Link type "<dfn><code>nofollow</code></dfn>"</h5>
  11549. <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
  11550. <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
  11551. implied hyperlink, if no other keywords create one).</p>
  11552. <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
  11553. by the original author or publisher of the page, or that the link to the referenced document was
  11554. included primarily because of a commercial relationship between people affiliated with the two
  11555. pages.</p>
  11556. <h5 id=link-type-noreferrer>4.6.5.9 Link type "<dfn><code>noreferrer</code></dfn>"</h5>
  11557. <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
  11558. <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
  11559. implied hyperlink, if no other keywords create one).</p>
  11560. <p>It indicates that no referrer information is to be leaked when following the link.</p>
  11561. <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
  11562. 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
  11563. <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
  11564. request.</p>
  11565. <p>This keyword also <a href=#noopener>causes the <code>opener</code>
  11566. 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>
  11567. <h5 id=link-type-pingback>4.6.5.10 Link type "<dfn><code>pingback</code></dfn>"</h5>
  11568. <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>
  11569. elements. This keyword creates an <a href=#external-resource-link id=link-type-pingback:external-resource-link>external resource
  11570. link</a>.</p>
  11571. <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
  11572. 1.0 specification. <a href=#refsPINGBACK>[PINGBACK]</a></p>
  11573. <h5 id=link-type-prefetch>4.6.5.11 Link type "<dfn><code>prefetch</code></dfn>"</h5>
  11574. <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>,
  11575. <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>
  11576. <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
  11577. caching the specified resource is likely to be beneficial, as it is highly likely that the user
  11578. will require this resource.</p>
  11579. <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>
  11580. keyword.</p>
  11581. <h5 id=link-type-search>4.6.5.12 Link type "<dfn><code>search</code></dfn>"</h5>
  11582. <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>,
  11583. <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>
  11584. <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
  11585. provides an interface specifically for searching the document and its related resources.</p>
  11586. <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
  11587. 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
  11588. interfaces. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>
  11589. <h5 id=link-type-sidebar>4.6.5.13 Link type "<dfn><code>sidebar</code></dfn>"</h5>
  11590. <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>,
  11591. <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>
  11592. <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
  11593. 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),
  11594. instead of in the current <a href=#browsing-context id=link-type-sidebar:browsing-context>browsing context</a>.</p>
  11595. <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
  11596. a <dfn id=rel-sidebar-hyperlink>sidebar hyperlink</dfn>.</p>
  11597. <h5 id=link-type-stylesheet>4.6.5.14 Link type "<dfn><code>stylesheet</code></dfn>"</h5>
  11598. <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>
  11599. elements. This keyword creates an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link>external resource
  11600. link</a> that contributes to the styling processing model.</p>
  11601. <p>The specified resource is a resource that describes how to present the document. Exactly how
  11602. the resource is to be processed depends on the actual type of the resource.</p>
  11603. <p>If the <code id=link-type-stylesheet:rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is also specified on the
  11604. <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,
  11605. 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>
  11606. element, with a non-empty value.</p>
  11607. <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>
  11608. keyword is <code>text/css</code>.</p>
  11609. <p>The appropriate times to <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain>obtain</a> the resource are:
  11610. <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
  11611. 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>
  11612. 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
  11613. <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
  11614. <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
  11615. 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
  11616. 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>
  11617. 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
  11618. <code>Document</code></a> is set or changed to a value that does not or no longer matches the
  11619. <a href=#content-type id=link-type-stylesheet:content-type>Content-Type metadata</a> of the previous obtained external
  11620. 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>
  11621. 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
  11622. <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
  11623. 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
  11624. versa.</ul>
  11625. <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
  11626. <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,
  11627. and the <a href=#content-type id=link-type-stylesheet:content-type-2>Content-Type metadata</a> of the external resource is not a
  11628. supported style sheet type, the user agent must instead assume it to be <code>text/css</code>.</p>
  11629. <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
  11630. agent must run these steps:</p>
  11631. <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
  11632. <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>
  11633. 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
  11634. invoked again for a newly obtained resource), then abort these steps.<li>
  11635. <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>
  11636. <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>
  11637. <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>
  11638. <p class=note>This is before any redirects get applied.</p>
  11639. <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>
  11640. <p>The <code id=link-type-stylesheet:attr-link-media><a href=#attr-link-media>media</a></code> attribute of <var>element</var>.</p>
  11641. <p class=note>This is a reference to the (possibly absent at this time) attribute, rather
  11642. than a copy of the attribute's current value. The CSSOM specification defines what happens
  11643. when the attribute is dynamically set, changed, or removed.</p>
  11644. <dt><a href=#concept-css-style-sheet-title id=link-type-stylesheet:concept-css-style-sheet-title>title</a><dd>
  11645. <p>The <code id=link-type-stylesheet:attr-link-title><a href=#attr-link-title>title</a></code> attribute of <var>element</var>.</p>
  11646. <p class=note>This is similarly a reference to the attribute, rather than a copy of the
  11647. attribute's current value.</p>
  11648. <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>
  11649. <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>
  11650. <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
  11651. 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>
  11652. </ol>
  11653. <h5 id=link-type-tag>4.6.5.15 Link type "<dfn><code>tag</code></dfn>"</h5>
  11654. <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
  11655. <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>
  11656. <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
  11657. referenced document represents applies to the current document.</p>
  11658. <p class=note>Since it indicates that the tag <em>applies to the current document</em>, it would
  11659. be inappropriate to use this keyword in the markup of a <a href=#tag-cloud>tag cloud</a>, which
  11660. lists the popular tags across a set of pages.</p>
  11661. <div class=example>
  11662. <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
  11663. to the "jewel" kind of gems, and not to, say, the towns in the US, the Ruby package format, or
  11664. the Swiss locomotive class:</p>
  11665. <pre>&lt;!DOCTYPE HTML>
  11666. &lt;html>
  11667. &lt;head>
  11668. &lt;title>My Precious&lt;/title>
  11669. &lt;/head>
  11670. &lt;body>
  11671. &lt;header>&lt;h1>My precious&lt;/h1> &lt;p>Summer 2012&lt;/p>&lt;/header>
  11672. &lt;p>Recently I managed to dispose of a red gem that had been
  11673. bothering me. I now have a much nicer blue sapphire.&lt;/p>
  11674. &lt;p>The red gem had been found in a bauxite stone while I was digging
  11675. out the office level, but nobody was willing to haul it away. The
  11676. same red gem stayed there for literally years.&lt;/p>
  11677. &lt;footer>
  11678. Tags: &lt;a rel=tag href="http://en.wikipedia.org/wiki/Gemstone">Gemstone&lt;/a>
  11679. &lt;/footer>
  11680. &lt;/body>
  11681. &lt;/html></pre>
  11682. </div>
  11683. <div class=example>
  11684. <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>"
  11685. link, however, applies to the whole page (and would do so wherever it was placed, including if it
  11686. was within the <code id=link-type-tag:the-article-element><a href=#the-article-element>article</a></code> elements).</p>
  11687. <pre>&lt;!DOCTYPE HTML>
  11688. &lt;html>
  11689. &lt;head>
  11690. &lt;title>Gem 4/4&lt;/title>
  11691. &lt;/head>
  11692. &lt;body>
  11693. &lt;article>
  11694. &lt;h1>801: Steinbock&lt;/h1>
  11695. &lt;p>The number 801 Gem 4/4 electro-diesel has an ibex and was rebuilt in 2002.&lt;/p>
  11696. &lt;/article>
  11697. &lt;article>
  11698. &lt;h1>802: Murmeltier&lt;/h1>
  11699. &lt;figure>
  11700. &lt;img src="http://upload.wikimedia.org/wikipedia/commons/b/b0/Trains_de_la_Bernina_en_hiver_2.jpg"
  11701. alt="The 802 was red with pantographs and tall vents on the side.">
  11702. &lt;figcaption>The 802 in the 1980s, above Lago Bianco.&lt;/figcaption>
  11703. &lt;/figure>
  11704. &lt;p>The number 802 Gem 4/4 electro-diesel has a marmot and was rebuilt in 2003.&lt;/p>
  11705. &lt;/article>
  11706. &lt;p class="topic">&lt;a rel=tag href="http://en.wikipedia.org/wiki/Rhaetian_Railway_Gem_4/4">Gem 4/4&lt;/a>&lt;/p>
  11707. &lt;/body>
  11708. &lt;/html></pre>
  11709. </div>
  11710. <h5 id=sequential-link-types>4.6.5.16 Sequential link types</h5>
  11711. <p>Some documents form part of a sequence of documents.</p>
  11712. <p>A sequence of documents is one where each document can have a <em>previous sibling</em> and a
  11713. <em>next sibling</em>. A document with no previous sibling is the start of its sequence, a
  11714. document with no next sibling is the end of its sequence.</p>
  11715. <p>A document may be part of multiple sequences.</p>
  11716. <h6 id=link-type-next>4.6.5.16.1 Link type "<dfn><code>next</code></dfn>"</h6>
  11717. <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>,
  11718. <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>
  11719. <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
  11720. sequence, and that the link is leading to the document that is the next logical document in the
  11721. sequence.</p>
  11722. <h6 id=link-type-prev>4.6.5.16.2 Link type "<dfn><code>prev</code></dfn>"</h6>
  11723. <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>,
  11724. <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>
  11725. <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
  11726. sequence, and that the link is leading to the document that is the previous logical document in
  11727. the sequence.</p>
  11728. <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat the keyword
  11729. "<code>previous</code>" like the <code id=link-type-prev:link-type-prev-3><a href=#link-type-prev>prev</a></code> keyword.</p>
  11730. <h5 id=other-link-types>4.6.5.17 Other link types</h5>
  11731. <p><dfn id=concept-rel-extensions>Extensions to the predefined set of link types</dfn> may be
  11732. registered in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats
  11733. wiki existing-rel-values page</a>. <a href=#refsMFREL>[MFREL]</a></p>
  11734. <p>Anyone is free to edit the <span>microformats wiki existing-rel-values page</span> at
  11735. any time to add a type. Extension types must be specified with the following information:</p>
  11736. <dl><dt>Keyword<dd>
  11737. <p>The actual value being defined. The value should not be confusingly similar to any other
  11738. defined value (e.g. differing only in case).</p>
  11739. <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
  11740. URL</a>.</p>
  11741. <dt>Effect on... <code id=other-link-types:the-link-element><a href=#the-link-element>link</a></code><dd>
  11742. <p>One of the following:</p>
  11743. <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
  11744. <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
  11745. resource link</a>.</dl>
  11746. <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>
  11747. <p>One of the following:</p>
  11748. <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
  11749. <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
  11750. 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>
  11751. created by the element.</dl>
  11752. <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
  11753. 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
  11754. should not use the values defined to be synonyms, they are only intended to allow user agents to
  11755. support legacy content. Anyone may remove synonyms that are not used in practice; only names that
  11756. need to be processed as synonyms for compatibility with legacy content are to be registered in
  11757. this way.<dt>Status<dd>
  11758. <p>One of the following:</p>
  11759. <dl><dt>Proposed<dd>The keyword has not received wide peer review and approval. Someone has proposed it and is,
  11760. or soon will be, using it.<dt>Ratified<dd>The keyword has received wide peer review and approval. It has a specification that
  11761. unambiguously defines how to handle pages that use the keyword, including when they use it in
  11762. incorrect ways.<dt>Discontinued<dd>The keyword has received wide peer review and it has been found wanting. Existing pages are
  11763. using this keyword, but new pages should avoid it. The "brief description" and "specification"
  11764. entries will give details of what authors should use instead, if anything.</dl>
  11765. <p>If a keyword is found to be redundant with existing values, it should be removed and listed
  11766. as a synonym for the existing value.</p>
  11767. <p>If a keyword is registered in the "proposed" state for a period of a month or more without
  11768. being used or specified, then it may be removed from the registry.</p>
  11769. <p>If a keyword is added with the "proposed" status and found to be redundant with existing
  11770. values, it should be removed and listed as a synonym for the existing value. If a keyword is
  11771. added with the "proposed" status and found to be harmful, then it should be changed to
  11772. "discontinued" status.</p>
  11773. <p>Anyone can change the status at any time, but should only do so in accordance with the
  11774. definitions above.</p>
  11775. </dl>
  11776. <p>Conformance checkers must use the information given on the <span>microformats wiki
  11777. existing-rel-values page</span> to establish if a value is allowed or not: values defined in this
  11778. specification or marked as "proposed" or "ratified" must be accepted when used on the elements for
  11779. which they apply as described in the "Effect on..." field, whereas values marked as "discontinued"
  11780. or not listed in either this specification or on the aforementioned page must be rejected as
  11781. invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid
  11782. the use of unreliable network connectivity).</p>
  11783. <p>When an author uses a new type not defined by either this specification or the Wiki page,
  11784. conformance checkers should offer to add the value to the Wiki, with the details described above,
  11785. with the "proposed" status.</p>
  11786. <p>Types defined as extensions in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats
  11787. wiki existing-rel-values page</a> with the status "proposed" or "ratified" may be used with the
  11788. <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>
  11789. elements in accordance to the "Effect on..." field. <a href=#refsMFREL>[MFREL]</a></p>
  11790. <h3 id=edits>4.7 Edits</h3>
  11791. <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>
  11792. <h4 id=the-ins-element>4.7.1 The <dfn><code>ins</code></dfn> element</h4>
  11793. <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>
  11794. <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>
  11795. <div class=example>
  11796. <p>The following represents the addition of a single paragraph:</p>
  11797. <pre>&lt;aside>
  11798. &lt;ins>
  11799. &lt;p> I like fruit. &lt;/p>
  11800. &lt;/ins>
  11801. &lt;/aside></pre>
  11802. <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
  11803. <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>
  11804. <pre>&lt;aside>
  11805. &lt;ins>
  11806. Apples are &lt;em>tasty&lt;/em>.
  11807. &lt;/ins>
  11808. &lt;ins>
  11809. So are pears.
  11810. &lt;/ins>
  11811. &lt;/aside></pre>
  11812. </div>
  11813. <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>
  11814. boundaries.</p>
  11815. <div class=example>
  11816. <p>The following example represents the addition of two paragraphs, the second of which was
  11817. 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
  11818. paragraph boundary, which is considered poor form.</p>
  11819. <pre class=bad>&lt;aside>
  11820. &lt;!-- don't do this -->
  11821. &lt;ins datetime="2005-03-16 00:00Z">
  11822. &lt;p> I like fruit. &lt;/p>
  11823. Apples are &lt;em>tasty&lt;/em>.
  11824. &lt;/ins>
  11825. &lt;ins datetime="2007-12-19 00:00Z">
  11826. So are pears.
  11827. &lt;/ins>
  11828. &lt;/aside></pre>
  11829. <p>Here is a better way of marking this up. It uses more elements, but none of the elements cross
  11830. implied paragraph boundaries.</p>
  11831. <pre>&lt;aside>
  11832. &lt;ins datetime="2005-03-16 00:00Z">
  11833. &lt;p> I like fruit. &lt;/p>
  11834. &lt;/ins>
  11835. &lt;ins datetime="2005-03-16 00:00Z">
  11836. Apples are &lt;em>tasty&lt;/em>.
  11837. &lt;/ins>
  11838. &lt;ins datetime="2007-12-19 00:00Z">
  11839. So are pears.
  11840. &lt;/ins>
  11841. &lt;/aside></pre>
  11842. </div>
  11843. <h4 id=the-del-element>4.7.2 The <dfn><code>del</code></dfn> element</h4>
  11844. <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>
  11845. <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>
  11846. <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>
  11847. boundaries.</p>
  11848. <div class=example>
  11849. <p>The following shows a "to do" list where items that have been done are crossed-off with the
  11850. date and time of their completion.</p>
  11851. <pre>&lt;h1>To Do&lt;/h1>
  11852. &lt;ul>
  11853. &lt;li>Empty the dishwasher&lt;/li>
  11854. &lt;li>&lt;del datetime="2009-10-11T01:25-07:00">Watch Walter Lewin's lectures&lt;/del>&lt;/li>
  11855. &lt;li>&lt;del datetime="2009-10-10T23:38-07:00">Download more tracks&lt;/del>&lt;/li>
  11856. &lt;li>Buy a printer&lt;/li>
  11857. &lt;/ul></pre>
  11858. </div>
  11859. <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>
  11860. <p>The <dfn id=attr-mod-cite><code>cite</code></dfn> attribute may be used to specify the
  11861. address of a document that explains the change. When that document is long, for instance the
  11862. minutes of a meeting, authors are encouraged to include a fragment identifier pointing to the
  11863. specific part of that document that discusses the change.</p>
  11864. <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
  11865. URL potentially surrounded by spaces</a> that explains the change. To obtain
  11866. 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
  11867. citation links, but they are primarily intended for private use (e.g. by server-side scripts
  11868. collecting statistics about a site's edits), not for readers.</p>
  11869. <p>The <dfn id=attr-mod-datetime><code>datetime</code></dfn> attribute may be used to specify
  11870. the time and date of the change.</p>
  11871. <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
  11872. <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>
  11873. <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
  11874. 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>,
  11875. then the modification has no associated timestamp (the value is non-conforming; it is not a
  11876. <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
  11877. 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
  11878. time-zone offset information to determine which time zone to present the given datetime in.</p>
  11879. <p>This value may be shown to the user, but it is primarily intended for
  11880. private use.</p>
  11881. <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
  11882. <code id=attributes-common-to-ins-and-del-elements:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> interface:</p>
  11883. <pre class=idl>interface <dfn id=htmlmodelement>HTMLModElement</dfn> : <a href=#htmlelement id=attributes-common-to-ins-and-del-elements:htmlelement>HTMLElement</a> {
  11884. attribute DOMString <a href=#dom-mod-cite id=attributes-common-to-ins-and-del-elements:dom-mod-cite>cite</a>;
  11885. attribute DOMString <a href=#dom-mod-datetime id=attributes-common-to-ins-and-del-elements:dom-mod-datetime>dateTime</a>;
  11886. };</pre>
  11887. <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>
  11888. 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
  11889. 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>
  11890. <h4 id=edits-and-paragraphs>4.7.4 Edits and paragraphs</h4>
  11891. <p><i>This section is non-normative.</i></p>
  11892. <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
  11893. <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
  11894. 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>
  11895. <pre>&lt;section>
  11896. &lt;ins>
  11897. &lt;p>
  11898. This is a paragraph that was inserted.
  11899. &lt;/p>
  11900. This is another paragraph whose first sentence was inserted
  11901. at the same time as the paragraph above.
  11902. &lt;/ins>
  11903. This is a second sentence, which was there all along.
  11904. &lt;/section></pre>
  11905. <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
  11906. paragraph, a whole second paragraph, and the start of a third paragraph to be covered by the same
  11907. <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
  11908. good practice):</p>
  11909. <pre class=bad>&lt;section>
  11910. This is the first paragraph. &lt;ins>This sentence was
  11911. inserted.
  11912. &lt;p>This second paragraph was inserted.&lt;/p>
  11913. This sentence was inserted too.&lt;/ins> This is the
  11914. third paragraph in this example.
  11915. &lt;!-- (don't do this) -->
  11916. &lt;/section></pre>
  11917. <p>However, due to the way <a href=#paragraph id=edits-and-paragraphs:paragraph-3>implied paragraphs</a> are defined, it is
  11918. not possible to mark up the end of one paragraph and the start of the very next one using the same
  11919. <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>
  11920. 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>
  11921. <pre>&lt;section>
  11922. &lt;p>This is the first paragraph. &lt;del>This sentence was
  11923. deleted.&lt;/del>&lt;/p>
  11924. &lt;p>&lt;del>This sentence was deleted too.&lt;/del> That
  11925. sentence needed a separate &amp;lt;del&amp;gt; element.&lt;/p>
  11926. &lt;/section></pre>
  11927. <p>Partly because of the confusion described above, authors are strongly encouraged to always mark
  11928. 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
  11929. <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>
  11930. boundaries.</p>
  11931. <h4 id=edits-and-lists>4.7.5 Edits and lists</h4>
  11932. <p><i>This section is non-normative.</i></p>
  11933. <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
  11934. <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
  11935. items, including items that would otherwise have been marked as deleted.</p>
  11936. <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>
  11937. 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
  11938. 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
  11939. <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>
  11940. <div class=example>
  11941. <p>In the following example, a list that started empty had items added and removed from it over
  11942. time. The bits in the example that have been emphasized show the parts that are the "current"
  11943. state of the list. The list item numbers don't take into account the edits, though.</p>
  11944. <pre>&lt;h1>Stop-ship bugs&lt;/h1>
  11945. &lt;ol>
  11946. &lt;li>&lt;ins datetime="2008-02-12T15:20Z"><em>Bug 225:
  11947. Rain detector doesn't work in snow</em>&lt;/ins>&lt;/li>
  11948. &lt;li>&lt;del datetime="2008-03-01T20:22Z">&lt;ins datetime="2008-02-14T12:02Z">Bug 228:
  11949. Water buffer overflows in April&lt;/ins>&lt;/del>&lt;/li>
  11950. &lt;li>&lt;ins datetime="2008-02-16T13:50Z"><em>Bug 230:
  11951. Water heater doesn't use renewable fuels</em>&lt;/ins>&lt;/li>
  11952. &lt;li>&lt;del datetime="2008-02-20T21:15Z">&lt;ins datetime="2008-02-16T14:25Z">Bug 232:
  11953. Carbon dioxide emissions detected after startup&lt;/ins>&lt;/del>&lt;/li>
  11954. &lt;/ol></pre>
  11955. </div>
  11956. <div class=example>
  11957. <p>In the following example, a list that started with just fruit was replaced by a list with just
  11958. colours.</p>
  11959. <pre>&lt;h1>List of &lt;del>fruits&lt;/del>&lt;ins>colours&lt;/ins>&lt;/h1>
  11960. &lt;ul>
  11961. &lt;li>&lt;del>Lime&lt;/del>&lt;ins>Green&lt;/ins>&lt;/li>
  11962. &lt;li>&lt;del>Apple&lt;/del>&lt;/li>
  11963. &lt;li>Orange&lt;/li>
  11964. &lt;li>&lt;del>Pear&lt;/del>&lt;/li>
  11965. &lt;li>&lt;ins>Teal&lt;/ins>&lt;/li>
  11966. &lt;li>&lt;del>Lemon&lt;/del>&lt;ins>Yellow&lt;/ins>&lt;/li>
  11967. &lt;li>Olive&lt;/li>
  11968. &lt;li>&lt;ins>Purple&lt;/ins>&lt;/li>
  11969. &lt;/ul></pre>
  11970. </div>
  11971. <h4 id=edits-and-tables>4.7.6 Edits and tables</h4>
  11972. <p><i>This section is non-normative.</i></p>
  11973. <p>The elements that form part of the table model have complicated content model requirements that
  11974. 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
  11975. table can be difficult.</p>
  11976. <p>To indicate that an entire row or an entire column has been added or removed, the entire
  11977. 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>
  11978. elements (respectively).</p>
  11979. <div class=example>
  11980. <p>Here, a table's row has been added:</p>
  11981. <pre>&lt;table>
  11982. &lt;thead>
  11983. &lt;tr> &lt;th> Game name &lt;th> Game publisher &lt;th> Verdict
  11984. &lt;tbody>
  11985. &lt;tr> &lt;td> Diablo 2 &lt;td> Blizzard &lt;td> 8/10
  11986. &lt;tr> &lt;td> Portal &lt;td> Valve &lt;td> 10/10
  11987. <strong> &lt;tr> &lt;td> &lt;ins>Portal 2&lt;/ins> &lt;td> &lt;ins>Valve&lt;/ins> &lt;td> &lt;ins>10/10&lt;/ins></strong>
  11988. &lt;/table></pre>
  11989. <p>Here, a column has been removed (the time at which it was removed is given also, as is a link
  11990. to the page explaining why):</p>
  11991. <pre>&lt;table>
  11992. &lt;thead>
  11993. &lt;tr> &lt;th> Game name &lt;th> Game publisher &lt;th> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">Verdict&lt;/del></strong>
  11994. &lt;tbody>
  11995. &lt;tr> &lt;td> Diablo 2 &lt;td> Blizzard &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">8/10&lt;/del></strong>
  11996. &lt;tr> &lt;td> Portal &lt;td> Valve &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10&lt;/del></strong>
  11997. &lt;tr> &lt;td> Portal 2 &lt;td> Valve &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10&lt;/del></strong>
  11998. &lt;/table></pre>
  11999. </div>
  12000. <p>Generally speaking, there is no good way to indicate more complicated edits (e.g. that a cell
  12001. was removed, moving all subsequent cells up or to the left).</p>
  12002. <h3 id=embedded-content>4.8 Embedded content</h3>
  12003. <h4 id=introduction-3>4.8.1 Introduction</h4>
  12004. <p><i>This section is non-normative.</i></p>
  12005. <p>To embed an image in HTML, when there is only a single image resource,
  12006. 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>
  12007. <div class=example>
  12008. <pre>&lt;h2>From today's featured article&lt;/h2>
  12009. <strong>&lt;img src="/uploads/100-marie-lloyd.jpg" alt="" width="100" height="150"></strong>
  12010. &lt;p>&lt;b>&lt;a href="/wiki/Marie_Lloyd">Marie Lloyd&lt;/a>&lt;/b> (1870–1922)
  12011. was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>
  12012. </div>
  12013. <p>However, there are a number of situations for which the author might wish
  12014. to use multiple image resources that the user agent can choose from:</p>
  12015. <ul><li>
  12016. <p>Different users might have different environmental characteristics:</p>
  12017. <ul><li>
  12018. <p>The users' physical screen size might be different from one another.</p>
  12019. <p class=example>A mobile phone's screen might be 4 inches diagonally, while a laptop's screen might be 14 inches diagonally.</p>
  12020. <p class=note>This is only relevant when an image's rendered size depends on the viewport size.</p>
  12021. <li>
  12022. <p>The users' screen pixel density might be different from one another.</p>
  12023. <p class=example>A mobile phone's screen might have three times as many physical pixels per inch
  12024. compared to another mobile phone's screen, regardless of their physical screen size.</p>
  12025. <li>
  12026. <p>The users' zoom level might be different from one another, or might change for a single user over time.</p>
  12027. <p class=example>A user might zoom in to a particular image to be able to get a more detailed look.</p>
  12028. <p>The zoom level and the screen pixel density (the previous point) can both affect the number of physical screen pixels per CSS pixel.
  12029. This ratio is usually referred to as <dfn id=device-pixel-ratio>device-pixel-ratio</dfn>.</p>
  12030. <li>
  12031. <p>The users' screen orientation might be different from one another, or might change for a single user over time.</p>
  12032. <p class=example>A tablet can be held upright or rotated 90 degrees, so that the screen is either "portrait" or "landscape".</p>
  12033. <li>
  12034. <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>
  12035. <p class=example>A user might be on a fast, low-latency and constant-cost connection while at work,
  12036. on a slow, low-latency and constant-cost connection while at home,
  12037. and on a variable-speed, high-latency and variable-cost connection anywhere else.</p>
  12038. </ul>
  12039. <li>
  12040. <p>Authors might want to show different image content depending on the rendered size of the image.
  12041. This is usually referred to as <dfn id=art-direction>art direction</dfn>.</p>
  12042. <p class=example>When a Web page is viewed on a screen with a large physical size (assuming a maximized browser window),
  12043. the author might wish to include some less relevant parts surrounding the critical part of the image.
  12044. When the same Web page is viewed on a screen with a small physical size,
  12045. the author might wish to show only the critical part of the image.</p>
  12046. <li>
  12047. <p>Authors might want to show the same image content but with different rendered size depending on, usually, the width of the viewport.
  12048. This is usually referred to as <dfn id=viewport-based-selection>viewport-based selection</dfn>.</p>
  12049. <p class=example>A Web page might have a banner at the top that always spans the entire viewport width.
  12050. In this case, the rendered size of the image depends on the physical size of the screen (assuming a maximized browser window).</p>
  12051. <p class=example>Another Web page might have images in columns,
  12052. with a single column for screens with a small physical size,
  12053. two columns for screens with medium physical size,
  12054. and three columns for screens with big physical size,
  12055. with the images varying in rendered size in each case to fill up the viewport.
  12056. 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,
  12057. despite the screen being smaller.</p>
  12058. <li>
  12059. <p>Authors might want to show the same image content but using different image formats, depending on which image formats the user agent supports.
  12060. This is usually referred to as <dfn id=image-format-based-selection>image format-based selection</dfn>.</p>
  12061. <p class=example>A Web page might have some images in the JPEG, WebP and JPEG XR image formats,
  12062. with the latter two having better compression abilities compared to JPEG.
  12063. Since different user agents can support different image formats,
  12064. with some formats offering better compression ratios,
  12065. the author would like to serve the better formats to user agenst that support them,
  12066. while providing JPEG fallback for user agents that don't.</p>
  12067. </ul>
  12068. <p>The above situations are not mutually exclusive.
  12069. 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>
  12070. with different resources for <a href=#art-direction id=introduction-3:art-direction>art direction</a>.</p>
  12071. <p>While it is possible to solve these problems using scripting, doing so introduces some other problems:</p>
  12072. <ul><li><p>Some user agents agressively download images specified in the HTML markup,
  12073. before scripts have had a chance to run,
  12074. so that Web pages complete loading sooner.
  12075. If a script changes which image to download,
  12076. the user agent will potentially start two separate downloads,
  12077. which can instead cause worse page loading performance.<li><p>If the author avoids specifying any image in the HTML markup
  12078. and instead instantiates a single download from script,
  12079. that avoids the double download problem above
  12080. but instead it makes no image be downloaded at all for users with scripting disabled
  12081. and it disables the agressive image downloading optimization.</ul>
  12082. <p>With this in mind, this specification introduces a number of features to address the above problems in a declarative manner.</p>
  12083. <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>
  12084. <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>
  12085. attributes on the <code id=introduction-3:the-img-element-2><a href=#the-img-element>img</a></code> element can be used,
  12086. using the <code>x</code> descriptor,
  12087. to provide multiple images that only vary in their size
  12088. (the smaller image is a scaled-down version of the bigger image).</p>
  12089. <p class=note>The <code>x</code> descriptor is not appropriate when the
  12090. 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>),
  12091. but can be used together with <a href=#art-direction id=introduction-3:art-direction-2>art direction</a>.</p>
  12092. <div class=example>
  12093. <pre>&lt;h2>From today's featured article&lt;/h2>
  12094. &lt;img <strong>src="/uploads/100-marie-lloyd.jpg"</strong>
  12095. <strong>srcset="/uploads/150-marie-lloyd.jpg 1.5x, /uploads/200-marie-lloyd.jpg 2x"</strong>
  12096. alt="" width="100" height="150">
  12097. &lt;p>&lt;b>&lt;a href="/wiki/Marie_Lloyd">Marie Lloyd&lt;/a>&lt;/b> (1870–1922)
  12098. was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>
  12099. <p>The user agent can choose any of the given resources depending on
  12100. the user's screen's pixel density, zoom level, and possibly other factors such as the user's network conditions.</p>
  12101. <p>For backwards compatibility with older user agents that
  12102. don't yet understand the <code id=introduction-3:attr-img-srcset-2><a href=#attr-img-srcset>srcset</a></code> attribute,
  12103. 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.
  12104. This will result in something useful (though perhaps lower-resolution than the user would like)
  12105. being displayed even in older user agents.
  12106. 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,
  12107. 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>
  12108. <p>The image's rendered size is given in the
  12109. <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,
  12110. which allows the user agent to allocate space for the image before it is downloaded.</p>
  12111. </div>
  12112. <dt><a href=#art-direction id=introduction-3:art-direction-3>Art direction</a>-based selection<dd>
  12113. <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,
  12114. together with the <code id=introduction-3:attr-picture-source-media><a href=#attr-picture-source-media>media</a></code> attribute,
  12115. can be used, to provide multiple images that vary the image content
  12116. (for intance the smaller image might be a cropped version of the bigger image).</p>
  12117. <div class=example>
  12118. <pre>&lt;picture>
  12119. &lt;source <strong>media="(min-width: 45em)"</strong> srcset="large.jpg">
  12120. &lt;source <strong>media="(min-width: 32em)"</strong> srcset="med.jpg">
  12121. &lt;img src="small.jpg" alt="The president giving an award.">
  12122. &lt;/picture></pre>
  12123. <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
  12124. 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,
  12125. 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>
  12126. <p>The rendered size of the image varies depending on which resource is chosen.
  12127. To specify dimensions that the user agent can use before having downloaded the image,
  12128. CSS can be used.</p>
  12129. <pre class=css>img { width: 300px; height: 300px }
  12130. @media (min-width: 32em) { img { width: 500px; height:300px } }
  12131. @media (min-width: 45em) { img { width: 700px; height:400px } }</pre>
  12132. </div>
  12133. <div class=example>
  12134. <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.
  12135. A banner that takes half the viewport is provided in two versions,
  12136. one for wide screens and one for narrow screens.</p>
  12137. <pre>&lt;h1>
  12138. &lt;picture>
  12139. &lt;source media="(max-width: 500px)" srcset="banner-phone.jpeg, banner-phone-HD.jpeg 2x">
  12140. &lt;img src="banner.jpeg" srcset="banner-HD.jpeg 2x" alt="The Breakfast Combo">
  12141. &lt;/picture>
  12142. &lt;/h1></pre>
  12143. </div>
  12144. <dt><a href=#viewport-based-selection id=introduction-3:viewport-based-selection-2>Viewport-based selection</a><dd>
  12145. <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,
  12146. using the <code>w</code> descriptor,
  12147. to provide multiple images that only vary in their size
  12148. (the smaller image is a scaled-down version of the bigger image).</p>
  12149. <div class=example>
  12150. <p>In this example, a banner image takes up the entire viewport width
  12151. (using appropriate CSS).</p>
  12152. <pre>&lt;h1>&lt;img <strong>sizes="100vw" srcset="wolf-400.jpg 400w, wolf-800.jpg 800w, wolf-1600.jpg 1600w"</strong>
  12153. src="wolf-400.jpg" alt="The rad wolf">&lt;/h1></pre>
  12154. <p>The user agent will calculate the effective pixel density of each image
  12155. 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.
  12156. It can then choose any of the given resources depending on
  12157. the user's screen's pixel density, zoom level, and possibly other factors such as the user's network conditions.</p>
  12158. <p>If the user's screen is 320 CSS pixels wide, this is equivalent to specifying
  12159. <code>wolf-400.jpg 1.25x, wolf-800.jpg 2.5x, wolf-1600.jpg 5x</code>.
  12160. On the other hand, if the user's screen is 1200 CSS pixels wide,
  12161. this is equivalent to specifying
  12162. <code>wolf-400.jpg 0.33x, wolf-800.jpg 0.67x, wolf-1600.jpg 1.33x</code>.
  12163. 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,
  12164. the user agent can choose the correct image source to download regardless of how large the user's device is.</p>
  12165. <p>For backwards compatibility,
  12166. 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.
  12167. In new user agents, the <code id=introduction-3:attr-img-src-6><a href=#attr-img-src>src</a></code> attribute is ignored
  12168. 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>
  12169. <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
  12170. because the default value is <code>100vw</code>.</p>
  12171. </div>
  12172. <div class=example>
  12173. <p>In this example, the Web page has three layouts depending on the width of the viewport.
  12174. The narrow layout has one column of images (the width of each image is about 100%),
  12175. the middle layout has two columns of images (the width of each image is about 50%),
  12176. and the widest layout has three columns of images, and some page margin (the width of each image is about 33%).
  12177. It breaks between these layouts when the viewport is <code>30em</code> wide and <code>50em</code> wide, respectively.</p>
  12178. <pre>&lt;img <strong>sizes="(max-width: 30em) 100vw, (max-width: 50em) 50vw, calc(33vw - 100px)"</strong>
  12179. <strong>srcset="swing-200.jpg 200w, swing-400.jpg 400w, swing-800.jpg 800w, swing-1600.jpg 1600w"</strong>
  12180. src="swing-400.jpg" alt="Kettlebell Swing"></pre>
  12181. <p>The <code id=introduction-3:attr-img-sizes-5><a href=#attr-img-sizes>sizes</a></code> attribute sets up the
  12182. layout breakpoints at <code>30em</code> and <code>50em</code>,
  12183. and declares the image sizes between these breakpoints to be
  12184. <code>100vw</code>, <code>50vw</code>, or <code>calc(33vw - 100px)</code>.
  12185. These sizes do not necessarily have to match up exactly with the actual image width as specified in the CSS.</p>
  12186. <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,
  12187. using the first item with a <a href=#media-condition id=introduction-3:media-condition>&lt;media-condition></a> (the part in parentheses) that evaluates to true,
  12188. or using the last item (<code>calc(33vw - 100px)</code>) if they all evaluate to false.</p>
  12189. <p>For example, if the viewport width is <code>29em</code>,
  12190. then <code>(max-width: 30em)</code> evaluates to true and <code>100vw</code> is used,
  12191. so the image size, for the purpose of resource selection, is <code>29em</code>.
  12192. If the viewport width is instead <code>32em</code>,
  12193. then <code>(max-width: 30em)</code> evaluates to false,
  12194. but <code>(max-width: 50em)</code> evaluates to true and <code>50vw</code> is used,
  12195. so the image size, for the purpose of resource selection, is <code>16em</code> (half the viewport width).
  12196. Notice that the slightly wider viewport results in a smaller image because of the different layout.</p>
  12197. <p>The user agent can then calculate the effective pixel density and choose an appropriate resource
  12198. similarly to the previous example.</p>
  12199. </div>
  12200. <dt><a href=#image-format-based-selection id=introduction-3:image-format-based-selection>Image format-based selection</a><dd>
  12201. <p>The <code id=introduction-3:attr-picture-source-type><a href=#attr-picture-source-type>type</a></code> attribute
  12202. 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,
  12203. to provide multiple images in different formats.</p>
  12204. <div class=example>
  12205. <pre>&lt;h2>From today's featured article&lt;/h2>
  12206. &lt;picture>
  12207. &lt;source srcset="/uploads/100-marie-lloyd.webp" <strong>type="image/webp"</strong>>
  12208. &lt;source srcset="/uploads/100-marie-lloyd.jxr" <strong>type="image/vnd.ms-photo"</strong>>
  12209. &lt;img src="/uploads/100-marie-lloyd.jpg" alt="" width="100" height="150">
  12210. &lt;/picture>
  12211. &lt;p>&lt;b>&lt;a href="/wiki/Marie_Lloyd">Marie Lloyd&lt;/a>&lt;/b> (1870–1922)
  12212. was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>
  12213. <p>In this example, the user agent will choose the first source that has
  12214. 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.
  12215. If the user agent supports WebP images,
  12216. 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.
  12217. If not, but the user agent does support JPEG XR images,
  12218. 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.
  12219. If neither of those formats are supported,
  12220. the <code id=introduction-3:the-img-element-5><a href=#the-img-element>img</a></code> element will be chosen.</p>
  12221. </div>
  12222. </dl>
  12223. <h5 id=adaptive-images>4.8.1.1 Adaptive images</h5>
  12224. <p><i>This section is non-normative.</i></p>
  12225. <p>CSS and media queries can be used to construct graphical page layouts that adapt dynamically to
  12226. the user's environment, in particular to different viewport dimensions and pixel densities. For
  12227. 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.
  12228. This section walks through a sample case showing how to use these features.</p>
  12229. <p>Consider a situation where on wide screens (wider than 600 CSS pixels) a 300×150 image
  12230. named <code>a-rectangle.png</code> is to be used, but on smaller screens (600 CSS pixels
  12231. and less), a smaller 100×100 image called <code>a-square.png</code> is to be used.
  12232. The markup for this would look like this:</p>
  12233. <pre>&lt;figure>
  12234. &lt;picture>
  12235. &lt;source srcset="a-square.png" media="(max-width: 600px)">
  12236. &lt;img src="a-rectangle.png" alt="Barney Frank wears a suit and glasses.">
  12237. &lt;/picture>
  12238. &lt;figcaption>Barney Frank, 2011&lt;/figcaption>
  12239. &lt;/figure></pre>
  12240. <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,
  12241. see the <a href=#alt>Requirements for providing text to act as an alternative for images</a> section.</p>
  12242. <p>The problem with this is that the user agent does not necessarily know what dimensions to use
  12243. for the image when the image is loading. To avoid the layout having to be reflowed multiple times
  12244. as the page is loading, CSS and CSS media queries can be used to provide the dimensions:</p>
  12245. <pre>&lt;figure>
  12246. &lt;style scoped>
  12247. #a { width: 300px; height: 150px; }
  12248. @media (max-width: 600px) { #a { width: 100px; height: 100px; } }
  12249. &lt;/style>
  12250. &lt;picture>
  12251. &lt;source srcset="a-square.png" media="(max-width: 600px)">
  12252. &lt;img src="a-rectangle.png" alt="Barney Frank wears a suit and glasses." id="a">
  12253. &lt;/picture>
  12254. &lt;figcaption>Barney Frank, 2011&lt;/figcaption>
  12255. &lt;/figure></pre>
  12256. <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
  12257. 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>
  12258. <pre>&lt;figure>
  12259. &lt;style scoped media="(max-width: 600px)">
  12260. #a { width: 100px; height: 100px; }
  12261. &lt;/style>
  12262. &lt;picture>
  12263. &lt;source srcset="a-square.png" media="(max-width: 600px)">
  12264. &lt;img src="a-rectangle.png" width="300" height="150"
  12265. alt="Barney Frank wears a suit and glasses." id="a">
  12266. &lt;/picture>
  12267. &lt;figcaption>Barney Frank, 2011&lt;/figcaption>
  12268. &lt;/figure></pre>
  12269. <hr>
  12270. <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
  12271. 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
  12272. 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>
  12273. attribute.</p>
  12274. <p>If the author wants the biggest image in legacy user agents, the markup could be as follows:</p>
  12275. <pre>&lt;picture>
  12276. &lt;source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
  12277. &lt;source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
  12278. &lt;img src="pear-desktop.jpeg" alt="The pear is juicy.">
  12279. &lt;/picture></pre>
  12280. <p>However, if legacy mobile user agents are more important, one can list all three images in the
  12281. <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>
  12282. <pre>&lt;picture>
  12283. &lt;source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
  12284. &lt;source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
  12285. &lt;source srcset="pear-desktop.jpeg">
  12286. &lt;img src="pear-mobile.jpeg" alt="The pear is juicy.">
  12287. &lt;/picture></pre>
  12288. <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
  12289. 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
  12290. the smallest nor biggest:</p>
  12291. <pre>&lt;picture>
  12292. &lt;source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
  12293. &lt;source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
  12294. &lt;source srcset="pear-desktop.jpeg">
  12295. &lt;img src="pear-tablet.jpeg" alt="The pear is juicy.">
  12296. &lt;/picture></pre>
  12297. <hr>
  12298. <p>Above the <code>max-width</code> media feature is used, giving the maximum
  12299. (viewport) dimensions that an image is intended for.
  12300. It is also possible to use <code>min-width</code> instead.</p>
  12301. <pre>&lt;picture>
  12302. &lt;source srcset="pear-desktop.jpeg" media="(min-width: 1281px)">
  12303. &lt;source srcset="pear-tablet.jpeg" media="(min-width: 721px)">
  12304. &lt;img src="pear-mobile.jpeg" alt="The pear is juicy.">
  12305. &lt;/picture></pre>
  12306. <h4 id=dependencies-2>4.8.2 Dependencies</h4>
  12307. <dl><dt>Media Queries <a href=#refsMQ>[MQ]</a><dd><dfn id=media-condition>&lt;media-condition></dfn><dt>CSS Values and Units <a href=#refsCSSVALUES>[CSSVALUES]</a><dd><dfn id=length>&lt;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>&lt;whitespace-token></dfn><dt>Fetch <a href=#refsFETCH>[FETCH]</a><dd><dfn id=concept-request-context>context</dfn></dl>
  12308. <h4 id=the-picture-element>4.8.3 The <dfn><code>picture</code></dfn> element</h4>
  12309. <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>
  12310. <pre class=idl>interface <dfn id=htmlpictureelement>HTMLPictureElement</dfn> : <a href=#htmlelement id=the-picture-element:htmlelement>HTMLElement</a> {};</pre>
  12311. </dl>
  12312. <p>The <code id=the-picture-element:the-picture-element><a href=#the-picture-element>picture</a></code> element is a container
  12313. 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
  12314. to allow authors to declaratively control or give hints to the user agent about which image resource to use,
  12315. 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>
  12316. <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
  12317. 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.
  12318. 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,
  12319. 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
  12320. 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,
  12321. and the resource selection algorithm is different.
  12322. 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;
  12323. 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
  12324. that enables it to choose from multiple <a href=#url id=the-picture-element:url>URLs</a>.</p>
  12325. <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>
  12326. <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>
  12327. <pre class=idl>partial interface <a href=#htmlsourceelement id=the-source-element-when-used-with-the-picture-element:htmlsourceelement>HTMLSourceElement</a> {
  12328. attribute DOMString <a href=#dom-picture-source-srcset id=the-source-element-when-used-with-the-picture-element:dom-picture-source-srcset>srcset</a>;
  12329. attribute DOMString <a href=#dom-picture-source-sizes id=the-source-element-when-used-with-the-picture-element:dom-picture-source-sizes>sizes</a>;
  12330. attribute DOMString <a href=#dom-picture-source-media id=the-source-element-when-used-with-the-picture-element:dom-picture-source-media>media</a>;
  12331. };</pre>
  12332. </dl>
  12333. <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
  12334. 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>
  12335. <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
  12336. <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.
  12337. It does not <a href=#represents id=the-source-element-when-used-with-the-picture-element:represents>represent</a> anything on its own.</p>
  12338. <p>The <dfn id=attr-picture-source-srcset><code>srcset</code></dfn> attribute must be present,
  12339. 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>,
  12340. each separated from the next by a U+002C COMMA character (,).
  12341. 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
  12342. and no <a href=#space-character id=the-source-element-when-used-with-the-picture-element:space-character>space characters</a> after the URL,
  12343. 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,
  12344. 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>
  12345. <p>The <dfn id=attr-picture-source-sizes><code>sizes</code></dfn> attribute may also be present.
  12346. 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>
  12347. <p>The <dfn id=attr-picture-source-media><code>media</code></dfn> attributes may also be present.
  12348. 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>
  12349. <p>The <dfn id=attr-picture-source-type><code>type</code></dfn> attribute may also be present.
  12350. 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>.
  12351. 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>,
  12352. 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
  12353. if it does not support the given type.</p>
  12354. <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
  12355. is <em>not</em> specified, the user agent will not select a different
  12356. <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
  12357. the image format after fetching it.</p>
  12358. <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
  12359. <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
  12360. <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
  12361. at least one of the following:</p>
  12362. <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,
  12363. 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>,
  12364. 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>
  12365. <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>
  12366. <p>The IDL attributes <dfn id=dom-picture-source-srcset><code>srcset</code></dfn>,
  12367. <dfn id=dom-picture-source-sizes><code>sizes</code></dfn> and
  12368. <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
  12369. respective content attributes of the same name.</p>
  12370. <h4 id=the-img-element>4.8.5 The <dfn><code>img</code></dfn> element</h4>
  12371. <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>
  12372. <pre class=idl>[NamedConstructor=<a href=#dom-image id=the-img-element:dom-image>Image</a>(optional unsigned long width, optional unsigned long height)]
  12373. interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement id=the-img-element:htmlelement>HTMLElement</a> {
  12374. attribute DOMString <a href=#dom-img-alt id=the-img-element:dom-img-alt>alt</a>;
  12375. attribute DOMString <a href=#dom-img-src id=the-img-element:dom-img-src>src</a>;
  12376. attribute DOMString <a href=#dom-img-srcset id=the-img-element:dom-img-srcset>srcset</a>;
  12377. attribute DOMString <a href=#dom-img-sizes id=the-img-element:dom-img-sizes>sizes</a>;
  12378. attribute DOMString? <a href=#dom-img-crossorigin id=the-img-element:dom-img-crossorigin>crossOrigin</a>;
  12379. attribute DOMString <a href=#dom-img-usemap id=the-img-element:dom-img-usemap>useMap</a>;
  12380. attribute boolean <a href=#dom-img-ismap id=the-img-element:dom-img-ismap>isMap</a>;
  12381. attribute unsigned long <a href=#dom-img-width id=the-img-element:dom-img-width>width</a>;
  12382. attribute unsigned long <a href=#dom-img-height id=the-img-element:dom-img-height>height</a>;
  12383. readonly attribute unsigned long <a href=#dom-img-naturalwidth id=the-img-element:dom-img-naturalwidth>naturalWidth</a>;
  12384. readonly attribute unsigned long <a href=#dom-img-naturalheight id=the-img-element:dom-img-naturalheight>naturalHeight</a>;
  12385. readonly attribute boolean <a href=#dom-img-complete id=the-img-element:dom-img-complete>complete</a>;
  12386. readonly attribute DOMString <a href=#dom-img-currentsrc id=the-img-element:dom-img-currentsrc>currentSrc</a>;
  12387. // <a href="#HTMLImageElement-partial">also has obsolete members</a>
  12388. };</pre>
  12389. </dl>
  12390. <p>An <code id=the-img-element:the-img-element><a href=#the-img-element>img</a></code> element represents an image.</p>
  12391. <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,
  12392. 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'
  12393. <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,
  12394. is the embedded content; the value of
  12395. the <dfn id=attr-img-alt><code>alt</code></dfn> attribute provides equivalent content for
  12396. those who cannot process images or who have image loading disabled (i.e. it is the
  12397. <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>
  12398. <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
  12399. <a href=#alt>in the next section</a>.</p>
  12400. <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
  12401. <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,
  12402. optionally animated, image resource that is neither paged nor scripted.</p>
  12403. <p>The <code id=the-img-element:attr-img-srcset-2><a href=#attr-img-srcset>srcset</a></code> attribute may also be present.
  12404. If present, its value must consist of one or more
  12405. <a href=#image-candidate-string id=the-img-element:image-candidate-string>image candidate strings</a>,
  12406. each separated from the next by a U+002C COMMA character (,).
  12407. If an <a href=#image-candidate-string id=the-img-element:image-candidate-string-2>image candidate string</a> contains no descriptors
  12408. and no <a href=#space-character id=the-img-element:space-character>space characters</a> after the URL,
  12409. the following <a href=#image-candidate-string id=the-img-element:image-candidate-string-3>image candidate string</a>, if there is one,
  12410. must begin with one or more <a href=#space-character id=the-img-element:space-character-2>space characters</a>.</p>
  12411. <p>An <dfn id=image-candidate-string>image candidate string</dfn> consists of the following components, in order, with the
  12412. further restrictions described below this list:</p>
  12413. <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 (,),
  12414. referencing a non-interactive, optionally animated, image resource
  12415. 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>
  12416. <p>Zero or one of the following:</p>
  12417. <ul><li><p>A <i>width descriptor</i>, consisting of:
  12418. a <a href=#space-character id=the-img-element:space-character-5>space character</a>,
  12419. 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
  12420. representing the <i>width descriptor</i> value,
  12421. and a U+0077 LATIN SMALL LETTER W character.<li><p>A <i>pixel density descriptor</i>, consisting of:
  12422. a <a href=#space-character id=the-img-element:space-character-6>space character</a>,
  12423. 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
  12424. representing the <i>pixel density descriptor</i> value,
  12425. and a U+0078 LATIN SMALL LETTER X character.</ul>
  12426. <li><p>Zero or more <a href=#space-character id=the-img-element:space-character-7>space characters</a>.</ol>
  12427. <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
  12428. has the same <i>width descriptor</i> value as another
  12429. <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>
  12430. <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
  12431. has the same <i>pixel density descriptor</i> value as another
  12432. <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.
  12433. For the purpose of this requirement,
  12434. an <a href=#image-candidate-string id=the-img-element:image-candidate-string-8>image candidate string</a> with no descriptors is equivalent to
  12435. 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>
  12436. <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
  12437. 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,
  12438. all <a href=#image-candidate-string id=the-img-element:image-candidate-string-10>image candidate strings</a> for that
  12439. element must have the <i>width descriptor</i> specified.</p>
  12440. <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
  12441. has the <i>width descriptor</i> specified,
  12442. all other <a href=#image-candidate-string id=the-img-element:image-candidate-string-12>image candidate strings</a> for that element
  12443. must also have the <i>width descriptor</i> specified.</p>
  12444. <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>
  12445. 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>
  12446. <p class=note>The requirements above imply that images can be static bitmaps (e.g. PNGs, GIFs,
  12447. JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG root element),
  12448. animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG root
  12449. element that use declarative SMIL animation), and so forth. However, these definitions preclude
  12450. SVG files with script, multipage PDF files, interactive MNG files, HTML documents, plain text
  12451. documents, and so forth. <a href=#refsPNG>[PNG]</a> <a href=#refsGIF>[GIF]</a> <a href=#refsJPEG>[JPEG]</a> <a href=#refsPDF>[PDF]</a>
  12452. <a href=#refsXML>[XML]</a> <a href=#refsAPNG>[APNG]</a> <a href=#refsSVG>[SVG]</a> <a href=#refsMNG>[MNG]</a> </p>
  12453. <p>If the <code id=the-img-element:attr-img-srcset-3><a href=#attr-img-srcset>srcset</a></code> attribute is present,
  12454. the <dfn id=attr-img-sizes><code>sizes</code></dfn> attribute may also be present.
  12455. 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>
  12456. <p>A <dfn id=valid-source-size-list>valid source size list</dfn> is a string that matches the following grammar:
  12457. <a href=#refsCSSVALUES>[CSSVALUES]</a> <a href=#refsMQ>[MQ]</a></p>
  12458. <pre><dfn id=source-size-list>&lt;source-size-list></dfn> = <a href=#source-size id=the-img-element:source-size>&lt;source-size></a># [ , <a href=#source-size-value id=the-img-element:source-size-value>&lt;source-size-value></a> ]? | <a href=#source-size-value id=the-img-element:source-size-value-2>&lt;source-size-value></a>
  12459. <dfn id=source-size>&lt;source-size></dfn> = <a href=#media-condition id=the-img-element:media-condition>&lt;media-condition></a> <a href=#source-size-value id=the-img-element:source-size-value-3>&lt;source-size-value></a>
  12460. <dfn id=source-size-value>&lt;source-size-value></dfn> = <a href=#length id=the-img-element:length>&lt;length></a></pre>
  12461. <p>A <a href=#source-size-value id=the-img-element:source-size-value-4>&lt;source-size-value></a> must not be negative.</p>
  12462. <p class=note>Percentages are not allowed in a <a href=#source-size-value id=the-img-element:source-size-value-5>&lt;source-size-value></a>,
  12463. to avoid confusion about what it would be relative to.
  12464. The <code>vw</code> unit can be used for sizes relative to the viewport width.</p>
  12465. <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>
  12466. elements should not be used to display transparent images, as such images rarely convey meaning and
  12467. rarely add anything useful to the document.</p>
  12468. <hr>
  12469. <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
  12470. settings attribute</a>. Its purpose is to allow images from third-party sites that allow
  12471. cross-origin access to be used with <code id=the-img-element:the-canvas-element><a href=#the-canvas-element>canvas</a></code>.</p>
  12472. <hr>
  12473. <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>.
  12474. 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>.
  12475. The <a href=#pending-request id=the-img-element:pending-request>pending request</a> is initially set to null.
  12476. 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>
  12477. <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>
  12478. <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>
  12479. <dl><dt><dfn id=img-none>Unavailable</dfn><dd>The user agent hasn't obtained any image data,
  12480. or has obtained some or all of the image data but
  12481. 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
  12482. 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
  12483. 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
  12484. image enough to get the image dimensions (e.g. the image is corrupted, or the format is not
  12485. supported, or no data could be obtained).</dl>
  12486. <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>
  12487. <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>
  12488. <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
  12489. available</a> state or in the <a href=#img-all id=the-img-element:img-all>completely available</a> state, it is
  12490. said to be <dfn id=img-available>available</dfn>.</p>
  12491. <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>
  12492. <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
  12493. <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
  12494. the image's intrinsic height, and whose appearance is the intrinsic appearance of the image.</p>
  12495. <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
  12496. 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
  12497. context</a> where <a href=#concept-bc-noscript id=the-img-element:concept-bc-noscript-2>scripting is enabled</a>, user agents
  12498. must obtain images immediately.</p>
  12499. <p>A user agent that obtains images immediately must synchronously
  12500. <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,
  12501. with the <i>restart animation</i> flag set if so stated,
  12502. whenever that element is created,
  12503. or has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations>relevant mutations</a>,
  12504. 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>
  12505. <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
  12506. <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),
  12507. 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
  12508. <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
  12509. has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations-2>relevant mutations</a>,
  12510. 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
  12511. 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>
  12512. <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>
  12513. <ul><li><p>The element's <code id=the-img-element:attr-img-src-3><a href=#attr-img-src>src</a></code>,
  12514. <code id=the-img-element:attr-img-srcset-4><a href=#attr-img-srcset>srcset</a></code>
  12515. 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.
  12516. 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
  12517. <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
  12518. <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
  12519. <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
  12520. <code id=the-img-element:attr-picture-source-srcset-2><a href=#attr-picture-source-srcset>srcset</a></code>,
  12521. <code id=the-img-element:attr-picture-source-sizes-2><a href=#attr-picture-source-sizes>sizes</a></code>,
  12522. <code id=the-img-element:attr-picture-source-media><a href=#attr-picture-source-media>media</a></code>
  12523. 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>
  12524. <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
  12525. null.</p>
  12526. <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>
  12527. <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
  12528. element's image data must be treated as if its resolution, in device pixels per CSS pixels, was
  12529. the <a href=#current-pixel-density id=the-img-element:current-pixel-density-2>current pixel density</a>.</p>
  12530. <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
  12531. that there are 300 device pixels per CSS inch, and thus if the image data is 300x600, it has an
  12532. intrinsic dimension of 96 CSS pixels by 192 CSS pixels.</p>
  12533. <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
  12534. 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
  12535. settings attribute</a> mode, and, if the mode is not <a href=#attr-crossorigin-none id=the-img-element:attr-crossorigin-none>No
  12536. CORS</a>, an <a href=#origin-2 id=the-img-element:origin-2>origin</a>.
  12537. Each image furthermore has an <dfn id=ignore-higher-layer-caching>ignore higher-layer caching</dfn> flag.
  12538. User agents may copy entries from one <code id=the-img-element:document-2><a href=#document>Document</a></code>
  12539. 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
  12540. <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
  12541. 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
  12542. 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.
  12543. User agents may also remove images from such lists at any time (e.g. to save
  12544. memory).
  12545. 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
  12546. given higher-layer caching semantics for the resource (e.g. the HTTP <code>Cache-Control</code>
  12547. 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>
  12548. <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
  12549. 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,
  12550. and to avoid re-downloading images in the same document even when they don't allow caching per HTTP.
  12551. It is not used to avoid re-downloading the same image while the previous image is still loading,
  12552. but the <a href=#fetch id=the-img-element:fetch>fetch</a> algorithm allows the download to be reused in that case.</p>
  12553. <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>
  12554. <p class=example>For example, if a resource has the HTTP response header <code>Cache-Control: must-revalidate</code>,
  12555. 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,
  12556. and use that if the server responds with a <code>304 Not Modified</code> status.</p>
  12557. <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,
  12558. optionally with the <i>restart animations</i> flag set,
  12559. it must run the following steps:</p>
  12560. <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>,
  12561. abort these steps.<li><p>If the user agent cannot support images, or its support for images has been disabled, then
  12562. <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>,
  12563. 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,
  12564. let <a href=#pending-request id=the-img-element:pending-request-3>pending request</a> be null,
  12565. and abort these steps.<li>
  12566. <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
  12567. 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,
  12568. and it has a <code id=the-img-element:attr-img-src-6><a href=#attr-img-src>src</a></code> attribute specified and
  12569. its value is not the empty string, let <var>selected source</var> be the value of the
  12570. element's <code id=the-img-element:attr-img-src-7><a href=#attr-img-src>src</a></code> attribute, and <var>selected pixel
  12571. density</var> be 1.0. Otherwise, let <var>selected source</var> be null and <var>selected pixel density</var> be undefined.</p>
  12572. <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>
  12573. <p>If <var>selected source</var> is not null, run these substeps:</p>
  12574. <ol><li><p><a href=#resolve-a-url id=the-img-element:resolve-a-url>Resolve</a> <var>selected source</var>, relative
  12575. to the element, and let the result be <var>absolute URL</var>. If that is not successful, then
  12576. 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
  12577. 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>
  12578. 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>,
  12579. 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
  12580. 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,
  12581. <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>,
  12582. let <a href=#pending-request id=the-img-element:pending-request-5>pending request</a> be null,
  12583. 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
  12584. and whose state is set to the <a href=#img-all id=the-img-element:img-all-2>completely available</a> state,
  12585. update the presentation of the image appropriately,
  12586. 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>,
  12587. <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,
  12588. 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>,
  12589. 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,
  12590. and abort these steps.</ol>
  12591. <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.
  12592. The <a href=#synchronous-section id=the-img-element:synchronous-section>synchronous
  12593. section</a> consists of all the remaining steps of this algorithm until the algorithm says the
  12594. <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>
  12595. <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
  12596. after this instance (even if it aborted and is no longer running), then abort these steps.</p>
  12597. <p class=note>Only the last instance takes effect, to avoid multiple requests when, for
  12598. 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>,
  12599. and <code id=the-img-element:attr-img-crossorigin-4><a href=#attr-img-crossorigin>crossorigin</a></code> attributes are all set in
  12600. succession.</p>
  12601. <li>
  12602. <p>⌛ Let <var>selected source</var> and <var>selected pixel density</var> be the
  12603. 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>,
  12604. respectively.</p>
  12605. <li>
  12606. <p>⌛ If <var>selected source</var> is null, run these substeps:</p>
  12607. <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,
  12608. <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>,
  12609. 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,
  12610. 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
  12611. or a <code id=the-img-element:attr-img-srcset-7><a href=#attr-img-srcset>srcset</a></code> attribute
  12612. or a parent that is a <code id=the-img-element:the-picture-element-7><a href=#the-picture-element>picture</a></code> element,
  12613. <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>
  12614. <li>
  12615. <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
  12616. the <code id=the-img-element:the-img-element-24><a href=#the-img-element>img</a></code> element.</p>
  12617. <li><p>⌛ <a href=#resolve-a-url id=the-img-element:resolve-a-url-2>Resolve</a> <var>selected source</var>, relative
  12618. to the element, and let the result be <var>absolute URL</var>. If that is not successful, then
  12619. <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>,
  12620. 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,
  12621. let <a href=#pending-request id=the-img-element:pending-request-9>pending request</a> be null,
  12622. <a href=#queue-a-task id=the-img-element:queue-a-task-4>queue a task</a> to
  12623. 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>,
  12624. <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
  12625. 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,
  12626. and abort these steps.<li>
  12627. <p>⌛ If the <a href=#pending-request id=the-img-element:pending-request-10>pending request</a> is not null,
  12628. 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>,
  12629. then abort these steps.</p>
  12630. <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>,
  12631. 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,
  12632. 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>,
  12633. <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,
  12634. and abort these steps.</p>
  12635. <p>⌛ If the <a href=#pending-request id=the-img-element:pending-request-13>pending request</a> is not null,
  12636. <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>
  12637. <p>⌛ Let <var>image request</var> be a new <a href=#image-request id=the-img-element:image-request-9>image request</a>
  12638. whose <a href=#img-req-url id=the-img-element:img-req-url-7>current URL</a> is <var>absolute URL</var>.</p>
  12639. <p>⌛ Let the <a href=#pending-request id=the-img-element:pending-request-15>pending request</a> be <var>image request</var>.</p>
  12640. <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>,
  12641. with the <i>mode</i> being the current state of
  12642. the element's <code id=the-img-element:attr-img-crossorigin-5><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute,
  12643. 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
  12644. <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>.
  12645. 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>
  12646. <p>If the element has a <code id=the-img-element:attr-img-srcset-8><a href=#attr-img-srcset>srcset</a></code> attribute
  12647. or a parent that is a <code id=the-img-element:the-picture-element-8><a href=#the-picture-element>picture</a></code> element,
  12648. 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>.
  12649. Otherwise it must be set to <i>image</i>. <a href=#refsFETCH>[FETCH]</a></p>
  12650. <p class=critical>This specification does not yet use the "fetch" algorithm from the WHATWG Fetch specification.
  12651. It will be updated to do so in due course.</p>
  12652. <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>.
  12653. 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
  12654. 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>
  12655. <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
  12656. <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
  12657. <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.
  12658. </p>
  12659. <p class=warning>This, unfortunately, can be used to perform a rudimentary port scan of the
  12660. user's local network (especially in conjunction with scripting, though scripting isn't actually
  12661. 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
  12662. described above to mitigate this attack, but unfortunately such policies are typically not
  12663. compatible with existing Web content.</p>
  12664. <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>
  12665. 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>
  12666. while the image is being <a href=#fetch id=the-img-element:fetch-4>fetched</a>,
  12667. if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-17>current request</a>,
  12668. 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>
  12669. <li><p>End the <a href=#synchronous-section id=the-img-element:synchronous-section-4>synchronous section</a>, continuing the remaining steps asynchronously,
  12670. but without missing any data from the <a href=#fetch id=the-img-element:fetch-5>fetch</a> algorithm.<li>
  12671. <p>As soon as possible, jump to the first applicable entry from the following list:</p>
  12672. <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>
  12673. <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>
  12674. <ol><li>
  12675. <p>If <var>image request</var> is the <a href=#pending-request id=the-img-element:pending-request-16>pending request</a>
  12676. and the user agent is able to determine <var>image request</var>'s image's width and height,
  12677. <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>,
  12678. <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
  12679. 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>
  12680. <li>
  12681. <p>Otherwise, if <var>image request</var> is the <a href=#pending-request id=the-img-element:pending-request-17>pending request</a>
  12682. and the user agent is able to determine that <var>image request</var>'s image
  12683. is corrupted in some fatal way such that the image dimensions cannot be obtained,
  12684. <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>,
  12685. <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>
  12686. 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>
  12687. <li>
  12688. <p>Otherwise, if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-22>current request</a>,
  12689. it is in the <a href=#img-none id=the-img-element:img-none-5>unavailable</a> state,
  12690. and the user agent is able to determine <var>image request</var>'s image's width and height,
  12691. 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>
  12692. <li>
  12693. <p>Otherwise, if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-24>current request</a>,
  12694. it is in the <a href=#img-none id=the-img-element:img-none-6>unavailable</a> state,
  12695. and the user agent is able to determine that <var>image request</var>'s image
  12696. is corrupted in some fatal way such that the image dimensions cannot be obtained,
  12697. 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>.
  12698. </p>
  12699. </ol>
  12700. <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
  12701. part comes in, it must replace the previous image. Once one body part has been completely
  12702. 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
  12703. 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>
  12704. element. </p>
  12705. <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
  12706. <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>
  12707. <dt>If the resource type and data corresponds to a supported image format, <a href=#img-determine-type>as described below</a><dd>
  12708. <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>
  12709. <ol><li>
  12710. <p>If the user agent is able to determine <var>image request</var>'s image's width and height,
  12711. and <var>image request</var> is <a href=#pending-request id=the-img-element:pending-request-18>pending request</a>,
  12712. <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>,
  12713. <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>,
  12714. update the <code id=the-img-element:the-img-element-31><a href=#the-img-element>img</a></code> element's presentation appropriately,
  12715. and set <var>image request</var>'s state to <a href=#img-inc id=the-img-element:img-inc-5>partially available</a>.</p>
  12716. <li>
  12717. <p>Otherwise, if the user agent is able to determine <var>image request</var>'s image's width and height,
  12718. and <var>image request</var> is <a href=#current-request id=the-img-element:current-request-27>current request</a>,
  12719. update the <code id=the-img-element:the-img-element-32><a href=#the-img-element>img</a></code> element's presentation appropriately
  12720. and set <var>image request</var>'s state to <a href=#img-inc id=the-img-element:img-inc-6>partially available</a>.</p>
  12721. <li>
  12722. <p>Otherwise, if the user agent is able to determine that <var>image request</var>'s image
  12723. is corrupted in some fatal way such that the image dimensions cannot be obtained,
  12724. and <var>image request</var> is <a href=#pending-request id=the-img-element:pending-request-19>pending request</a>,
  12725. <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>,
  12726. <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>,
  12727. 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,
  12728. <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,
  12729. <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,
  12730. and abort these steps.</p>
  12731. <li>
  12732. <p>Otherwise, if the user agent is able to determine that <var>image request</var>'s image
  12733. is corrupted in some fatal way such that the image dimensions cannot be obtained,
  12734. and <var>image request</var> is <a href=#current-request id=the-img-element:current-request-30>current request</a>,
  12735. <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>,
  12736. <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,
  12737. <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,
  12738. and abort these steps.</p>
  12739. </ol>
  12740. <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
  12741. <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>,
  12742. if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-31>current request</a>,
  12743. must update the presentation of the image appropriately (e.g. if
  12744. the image is a progressive JPEG, each packet can improve the resolution of the image).</p>
  12745. <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
  12746. <a href=#fetch id=the-img-element:fetch-10>fetched</a> must additionally run these steps:</p>
  12747. <ol><li><p>Set <var>image request</var> to the <a href=#img-all id=the-img-element:img-all-4>completely
  12748. available</a> state.</p>
  12749. <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>
  12750. 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>
  12751. 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>
  12752. <dt>Otherwise<dd>
  12753. <p>The image data is not in a supported file format; the user agent must set
  12754. <var>image request</var> to the <a href=#img-error id=the-img-element:img-error-6>broken</a> state,
  12755. <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>,
  12756. <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>,
  12757. 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
  12758. 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>
  12759. element.</p>
  12760. </dl>
  12761. </ol>
  12762. <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>
  12763. <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>,
  12764. discarding any pending tasks generated by that algorithm.</ol>
  12765. <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>
  12766. <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>
  12767. <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>,
  12768. depending on resource <var>r</var>, means to
  12769. <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>,
  12770. 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>
  12771. <p>While a user agent is running the above algorithm for an element <var>x</var>, there
  12772. 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>,
  12773. 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>
  12774. <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>
  12775. state <em>and</em> the user agent can decode the media data without errors, then the
  12776. <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>
  12777. <p>Whether the image is fetched successfully or not (e.g. whether the response code was a 2xx code
  12778. <a href=#concept-http-equivalent-codes id=the-img-element:concept-http-equivalent-codes>or equivalent</a>) must be ignored when determining
  12779. the image's type and whether it is a valid image.</p>
  12780. <p class=note>This allows servers to return images with error responses, and have them
  12781. displayed.</p>
  12782. <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
  12783. type</var>. If these rules are not applied, then the type of the image must be the type given by
  12784. the image's <a href=#content-type id=the-img-element:content-type-2>associated Content-Type headers</a>.</p>
  12785. <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
  12786. files whose root element is an HTML element). User agents must not run executable code (e.g.
  12787. scripts) embedded in the image resource. User agents must only display the first page of a
  12788. multipage resource (e.g. a PDF file). User agents must not allow the resource to act in an
  12789. interactive fashion, but should honor any animation in the resource.</p>
  12790. <p>This specification does not specify which image types are to be supported.</p>
  12791. <hr>
  12792. <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>
  12793. <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>
  12794. and a <a href=#source-size-2 id=the-img-element:source-size-2>source size</a>.</p>
  12795. <p>An <dfn id=image-source>image source</dfn> is a <a href=#url id=the-img-element:url>URL</a>,
  12796. and optionally either a density descriptor, or a width descriptor.</p>
  12797. <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>&lt;source-size-value></a>.
  12798. 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,
  12799. 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.
  12800. Other units must be interpreted the same as in Media Queries. <a href=#refsMQ>[MQ]</a></p>
  12801. <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>,
  12802. user agents must do the following:</p>
  12803. <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,
  12804. 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>
  12805. 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
  12806. as an earlier entry <var>a</var> in <var>source set</var>, then remove entry <var>b</var>.
  12807. 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,
  12808. choose one <a href=#image-source id=the-img-element:image-source-2>image source</a> from <var>source set</var>.
  12809. Let this be <var>selected source</var>.<li><p>Return <var>selected source</var> and its associated pixel density.</ol>
  12810. <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>,
  12811. user agents must do the following:</p>
  12812. <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,
  12813. let <var>elements</var> be an array containing <var>el</var>'s parent node's child elements, retaining relative order.
  12814. Otherwise, let <var>elements</var> be array containing only <var>el</var>.<li>
  12815. <p>Iterate through <var>elements</var>,
  12816. doing the following for each item <var>child</var>:</p>
  12817. <ol><li>
  12818. <p>If <var>child</var> is <var>el</var>:</p>
  12819. <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,
  12820. <a href=#parse-a-srcset-attribute id=the-img-element:parse-a-srcset-attribute>parse <var>child</var>'s srcset attribute</a>
  12821. and let the returned <a href=#source-set id=the-img-element:source-set-6>source set</a> be <var>source set</var>.
  12822. 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
  12823. 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
  12824. whose value is not the empty string
  12825. and <var>source set</var> does not contain an
  12826. <a href=#image-source id=the-img-element:image-source-3>image source</a> with a density descriptor value of 1,
  12827. and no <a href=#image-source id=the-img-element:image-source-4>image source</a> with a width descriptor,
  12828. 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>
  12829. <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,
  12830. continue to the next child.
  12831. 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,
  12832. 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
  12833. 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>,
  12834. 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,
  12835. 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>,
  12836. 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,
  12837. 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>
  12838. 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,
  12839. and its value is an unknown or unsupported <a href=#mime-type id=the-img-element:mime-type>MIME type</a>,
  12840. 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>
  12841. </ol>
  12842. <p class=note>Each <code id=the-img-element:the-img-element-51><a href=#the-img-element>img</a></code> element independently considers
  12843. 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
  12844. plus the <code id=the-img-element:the-img-element-52><a href=#the-img-element>img</a></code> element itself
  12845. for selecting an <a href=#image-source id=the-img-element:image-source-6>image source</a>, ignoring any other (invalid) elements,
  12846. 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,
  12847. 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
  12848. of the relevant <code id=the-img-element:the-img-element-54><a href=#the-img-element>img</a></code> element.</p>
  12849. <p>When asked to <dfn id=parse-a-srcset-attribute>parse a srcset attribute</dfn> from an element,
  12850. parse the value of the element's <code>srcset</code> attribute as follows:</p>
  12851. <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>,
  12852. 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>.
  12853. 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>
  12854. that are <a href=#space-character id=the-img-element:space-character-8>space characters</a> or U+002C COMMA characters.
  12855. 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>,
  12856. 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
  12857. <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>
  12858. <p>If <var>url</var> ends with a U+002C COMMA character (,),
  12859. remove all trailing U+002C COMMA characters from <var>url</var>;
  12860. 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>.
  12861. Otherwise, <a href=#skip-whitespace id=the-img-element:skip-whitespace>skip whitespace</a> and then follow these substeps:</p>
  12862. <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>
  12863. <p>Let <var>c</var> be the character at <var>position</var>.
  12864. Do the following depending on the value of <var>state</var>.
  12865. For the purpose of this step, "EOF" is a special character representing
  12866. that <var>position</var> is past the end of <var>input</var>.</p>
  12867. <dl class=switch><dt><i title="">In descriptor</i><dd>
  12868. <p>Do the following, depending on the value of <var>c</var>:</p>
  12869. <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,
  12870. append <var>current descriptor</var> to <var>descriptors</var>
  12871. and let <var>current descriptor</var> be the empty string.
  12872. 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>.
  12873. If <var>current descriptor</var> is not empty,
  12874. append <var>current descriptor</var> to <var>descriptors</var>.
  12875. 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>.
  12876. Set <var>state</var> to <i>in parens</i>.<dt>EOF<dd><p>If <var>current descriptor</var> is not empty,
  12877. append <var>current descriptor</var> to <var>descriptors</var>.
  12878. Jump to the step labeled <i>descriptor parser</i>.<dt>Anything else<dd><p>Append <var>c</var> to <var>current descriptor</var>.</dl>
  12879. <dt><i title="">In parens</i><dd>
  12880. <p>Do the following, depending on the value of <var>c</var>:</p>
  12881. <dl class=switch><dt>U+0029 RIGHT PARENTHESIS ())<dd><p>Append <var>c</var> to <var>current descriptor</var>.
  12882. Set <var>state</var> to <i>in descriptor</i>.<dt>EOF<dd><p>Append <var>current descriptor</var> to <var>descriptors</var>.
  12883. Jump to the step labeled <i>descriptor parser</i>.<dt>Anything else<dd><p>Append <var>c</var> to <var>current descriptor</var>.</dl>
  12884. <dt><i title="">After descriptor</i><dd>
  12885. <p>Do the following, depending on the value of <var>c</var>:</p>
  12886. <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>.
  12887. Set <var>position</var> to the <em>previous</em> character in <var>input</var>.</dl>
  12888. </dl>
  12889. <p>Advance <var>position</var> to the next character in <var>input</var>.
  12890. Repeat this step.</p>
  12891. <p class=note>In order to be compatible with future additions,
  12892. this algorithm supports multiple descriptors and descriptors with parens.</p>
  12893. </ol>
  12894. <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>
  12895. <p>For each descriptor in <var>descriptors</var>,
  12896. run the appropriate set of steps from the following list:</p>
  12897. <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>
  12898. followed by a U+0077 LATIN SMALL LETTER W character<dd>
  12899. <ol><li><p>If <var>width</var> and <var>density</var>
  12900. are not both <i>absent</i>,
  12901. 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.
  12902. If the result is zero, let <var>error</var> be <i>yes</i>.
  12903. Otherwise, let <var>width</var> be the result.</ol>
  12904. <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>
  12905. followed by a U+0078 LATIN SMALL LETTER X character<dd>
  12906. <ol><li><p>If <var>width</var>, <var>density</var> and <var>future-compat-h</var>
  12907. are not all <i>absent</i>,
  12908. then let <var>error</var> be <i>yes</i>.<li>
  12909. <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.
  12910. If the result is less than zero, let <var>error</var> be <i>yes</i>.
  12911. Otherwise, let <var>density</var> be the result.</p>
  12912. <p class=note>If <var>density</var> is zero,
  12913. the intrinsic dimensions will be infinite.
  12914. User agents are expected to have limits in how big images can be rendered,
  12915. which is allowed by the <a href=#hardwareLimitations>hardware limitations</a> clause.</p>
  12916. </ol>
  12917. <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>
  12918. followed by a U+0068 LATIN SMALL LETTER H character<dd>
  12919. <p>This is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-3>parse error</a>.</p>
  12920. <ol><li><p>If <var>future-compat-h</var> and <var>density</var>
  12921. are not both <i>absent</i>,
  12922. 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.
  12923. If the result is zero, let <var>error</var> be <i>yes</i>.
  12924. Otherwise, let <var>future-compat-h</var> be the result.</ol>
  12925. <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>
  12926. <li><p>If <var>future-compat-h</var> is not <i>absent</i> and <var>width</var> is <i>absent</i>,
  12927. let <var>error</var> be <i>yes</i>.<li><p>If <var>error</var> is still <i>no</i>,
  12928. then add a new <a href=#image-source id=the-img-element:image-source-7>image source</a> to <var>candidates</var>
  12929. whose URL is <var>url</var>,
  12930. associated with a width <var>width</var> if not <i>absent</i>
  12931. and a pixel density <var>density</var> if not <i>absent</i>.
  12932. 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>
  12933. <p>When asked to <dfn id=parse-a-sizes-attribute>parse a sizes attribute</dfn> from an element,
  12934. <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>
  12935. from the value of the element's <code>sizes</code> attribute
  12936. (or the empty string, if the attribute is absent),
  12937. and let <var>unparsed sizes list</var> be the result. <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a></p>
  12938. <p>For each <var>unparsed size</var> in <var>unparsed sizes list</var>:</p>
  12939. <ol><li><p>Remove all consecutive <a href=#whitespace-token id=the-img-element:whitespace-token>&lt;whitespace-token></a>s
  12940. from the end of <var>unparsed size</var>.
  12941. If <var>unparsed size</var> is now empty,
  12942. that is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-6>parse error</a>;
  12943. 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>
  12944. is a valid non-negative <a href=#source-size-value id=the-img-element:source-size-value-7>&lt;source-size-value></a>,
  12945. let <var>size</var> be its value
  12946. and remove the <a href=#component-value id=the-img-element:component-value-2>component value</a> from <var>unparsed size</var>.
  12947. Otherwise, there is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-7>parse error</a>;
  12948. continue to the next iteration of this algorithm.<li><p>Remove all consecutive <a href=#whitespace-token id=the-img-element:whitespace-token-2>&lt;whitespace-token></a>s
  12949. from the end of <var>unparsed size</var>.
  12950. If <var>unparsed size</var> is now empty,
  12951. return <var>size</var> and exit this algorithm.
  12952. If this was not the last item in <var>unparsed sizes list</var>,
  12953. 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>
  12954. as a <a href=#media-condition id=the-img-element:media-condition-2>&lt;media-condition></a>.
  12955. If it does not parse correctly,
  12956. or it does parse correctly but the <a href=#media-condition id=the-img-element:media-condition-3>&lt;media-condition></a> evaluates to false,
  12957. continue to the next iteration of this algorithm. <a href=#refsMQ>[MQ]</a><li><p>Return <var>size</var> and exit this algorithm.</ol>
  12958. <p>If the above algorithm exhausts <var>unparsed sizes list</var> without returning a <var>size</var> value,
  12959. return <code>100vw</code>.</p>
  12960. <p>A <dfn id=concept-microsyntax-parse-error>parse error</dfn> for the algorithms above
  12961. indicates a non-fatal mismatch between input and requirements.
  12962. 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>
  12963. <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>&lt;source-size-value></a>
  12964. (without an accompanying <a href=#media-condition id=the-img-element:media-condition-4>&lt;media-condition></a>)
  12965. as the last entry in the <a href=#source-size-list id=the-img-element:source-size-list>&lt;source-size-list></a>,
  12966. the parsing algorithm technically allows such at any point in the list,
  12967. and will accept it immediately as the size
  12968. if the preceding entries in the list weren't used.
  12969. This is to enable future extensions,
  12970. and protect against simple author errors such as a final trailing comma.</p>
  12971. <p>An <a href=#image-source id=the-img-element:image-source-8>image source</a> can have a density descriptor,
  12972. a width descriptor,
  12973. or no descriptor at all accompanying its URL.
  12974. 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>
  12975. <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>,
  12976. the user agent must do the following:</p>
  12977. <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>
  12978. <p>For each <a href=#image-source id=the-img-element:image-source-10>image source</a> in <var>source set</var>:</p>
  12979. <ol><li><p>If the <a href=#image-source id=the-img-element:image-source-11>image source</a> has a density descriptor,
  12980. continue to the next <a href=#image-source id=the-img-element:image-source-12>image source</a>.<li>
  12981. <p>Otherwise, if the <a href=#image-source id=the-img-element:image-source-13>image source</a> has a width descriptor,
  12982. replace the width descriptor with a density descriptor
  12983. 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>
  12984. and a unit of <code>x</code>.</p>
  12985. <p class=note>If the <a href=#source-size-2 id=the-img-element:source-size-2-7>source size</a> is zero,
  12986. the density would be infinity,
  12987. which results in the intrinsic dimensions being zero by zero.</p>
  12988. <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>
  12989. </ol>
  12990. <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>
  12991. element's image in order to react to changes in the environment. (User agents are <em>not
  12992. required</em> to ever run this algorithm; for example, if the user is not looking at the page any
  12993. more, the user agent might want to wait until the user has returned to the page before determining
  12994. which image to use, in case the environment changes again in the meantime.)</p>
  12995. <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>
  12996. consists of all the remaining steps of this algorithm until the algorithm says the
  12997. <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
  12998. 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
  12999. <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
  13000. running, then abort this algorithm.<li><p>⌛ Let <var>selected source</var> and <var>selected pixel
  13001. 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
  13002. 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
  13003. 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>,
  13004. 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
  13005. steps.</p>
  13006. <li><p>End the <a href=#synchronous-section id=the-img-element:synchronous-section-8>synchronous section</a>, continuing the remaining steps
  13007. asynchronously.<li>
  13008. <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
  13009. URL</a>, with the <i>mode</i> being <var>CORS mode</var>, the <i>origin</i>
  13010. 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
  13011. <i>default origin behaviour</i> set to <i>taint</i>.</p>
  13012. <p>If this download fails in any way (other than the response code not being a 2xx code, as
  13013. 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),
  13014. 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>
  13015. <p>Otherwise, wait for the <a href=#fetch id=the-img-element:fetch-12>fetch</a> algorithm to queue its last task, and then
  13016. continue with these steps. The data obtained in this way is used in the steps below.</p>
  13017. <li>
  13018. <p><a href=#queue-a-task id=the-img-element:queue-a-task-15>Queue a task</a> to run the following substeps:</p>
  13019. <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>
  13020. since this algorithm started, then abort these steps.</p>
  13021. <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
  13022. 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
  13023. <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
  13024. 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
  13025. <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.
  13026. 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
  13027. <code id=the-img-element:the-img-element-63><a href=#the-img-element>img</a></code> element.</ol>
  13028. </ol>
  13029. <hr>
  13030. <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
  13031. source</a>.</p>
  13032. <hr>
  13033. <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>
  13034. attribute.</p>
  13035. <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>
  13036. <p>The image is either decorative or supplemental to the rest of the content, redundant with
  13037. some other information in the document.</p>
  13038. <p>If the image is <a href=#img-available id=the-img-element:img-available-2>available</a> and the user agent is configured
  13039. to display that image, then the element <a href=#represents id=the-img-element:represents>represents</a> the element's image data.</p>
  13040. <p>Otherwise, the element <a href=#represents id=the-img-element:represents-2>represents</a> nothing, and may be omitted completely from
  13041. the rendering. User agents may provide the user with a notification that an image is present but
  13042. has been omitted from the rendering.</p>
  13043. <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>
  13044. <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
  13045. gives a textual equivalent or replacement for the image.</p>
  13046. <p>If the image is <a href=#img-available id=the-img-element:img-available-3>available</a> and the user agent is configured
  13047. to display that image, then the element <a href=#represents id=the-img-element:represents-3>represents</a> the element's image data.</p>
  13048. <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
  13049. that an image is present but has been omitted from the rendering.</p>
  13050. <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>
  13051. <p>The image might be a key part of the content, and there is no textual equivalent of the image
  13052. available.</p>
  13053. <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
  13054. but that a textual replacement for the image was not available when the image was generated.</p>
  13055. <p>If the image is <a href=#img-available id=the-img-element:img-available-4>available</a> and the user agent is configured
  13056. to display that image, then the element <a href=#represents id=the-img-element:represents-5>represents</a> the element's image data.</p>
  13057. <p>Otherwise, the user agent should display some sort of indicator that there is an image that
  13058. is not being rendered, and may, if requested by the user, or if so configured, or when required
  13059. to provide contextual information in response to navigation, provide caption information for the
  13060. image, derived as follows:</p>
  13061. <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
  13062. the empty string, then the value of that attribute is the caption information; abort these
  13063. 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
  13064. <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
  13065. 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
  13066. 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
  13067. <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>
  13068. <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>
  13069. <p>The element <a href=#represents id=the-img-element:represents-6>represents</a> nothing.</p>
  13070. <dt>Otherwise<dd>
  13071. <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>
  13072. </dl>
  13073. <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.
  13074. 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
  13075. 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>
  13076. <p>User agents may always provide the user with the option to display any image, or to prevent any
  13077. image from being displayed. User agents may also apply heuristics to help the user make use of the
  13078. image when the user is unable to see it, e.g. due to a visual disability or because they are using
  13079. a text terminal with no graphics capabilities. Such heuristics could include, for instance,
  13080. optical character recognition (OCR) of text found within the image.</p>
  13081. <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
  13082. in detail below.</p>
  13083. <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
  13084. rendering.</p>
  13085. <hr>
  13086. <p>The <code id=the-img-element:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>usemap</a></code> attribute,
  13087. if present, can indicate that the image has an associated
  13088. <a href=#image-map id=the-img-element:image-map-2>image map</a>.</p>
  13089. <p>The <dfn id=attr-img-ismap><code>ismap</code></dfn>
  13090. attribute, when used on an element that is a descendant of an
  13091. <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
  13092. presence that the element provides access to a server-side image
  13093. map. This affects how events are handled on the corresponding
  13094. <code id=the-img-element:the-a-element-2><a href=#the-a-element>a</a></code> element.</p>
  13095. <p>The <code id=the-img-element:attr-img-ismap-2><a href=#attr-img-ismap>ismap</a></code> attribute is a
  13096. <a href=#boolean-attribute id=the-img-element:boolean-attribute>boolean attribute</a>. The attribute must not be specified
  13097. 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
  13098. with an <code id=the-img-element:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute.</p>
  13099. <p class=note>The <code id=the-img-element:attr-hyperlink-usemap-4><a href=#attr-hyperlink-usemap>usemap</a></code> and
  13100. <code id=the-img-element:attr-img-ismap-3><a href=#attr-img-ismap>ismap</a></code> attributes
  13101. can result in confusing behavior when used together with
  13102. <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
  13103. <code id=the-img-element:attr-picture-source-media-3><a href=#attr-picture-source-media>media</a></code> attribute specified
  13104. in a <code id=the-img-element:the-picture-element-12><a href=#the-picture-element>picture</a></code> element.</p>
  13105. <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
  13106. attributes</a>.</p>
  13107. <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
  13108. respective content attributes of the same name.</p>
  13109. <p>The <dfn id=dom-img-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
  13110. <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>
  13111. <p>The <dfn id=dom-img-usemap><code>useMap</code></dfn> IDL attribute must
  13112. <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>
  13113. <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>
  13114. the <code id=the-img-element:attr-img-ismap-4><a href=#attr-img-ismap>ismap</a></code> content attribute.</p>
  13115. <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>
  13116. <p>These attributes return the actual rendered dimensions of the
  13117. image, or zero if the dimensions are not known.</p>
  13118. <p>They can be set, to change the corresponding content
  13119. attributes.</p>
  13120. <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>
  13121. <p>These attributes return the intrinsic dimensions of the image,
  13122. or zero if the dimensions are not known.</p>
  13123. <dt><var>image</var> . <code id=the-img-element:dom-img-complete-2><a href=#dom-img-complete>complete</a></code><dd>
  13124. <p>Returns true if the image has been completely downloaded or if
  13125. no image is specified; otherwise, returns false.</p>
  13126. <dt><var>image</var> . <code id=the-img-element:dom-img-currentsrc-2><a href=#dom-img-currentsrc>currentSrc</a></code><dd>
  13127. <p>Returns the image's <a href=#absolute-url id=the-img-element:absolute-url-5>absolute URL</a>.</p>
  13128. <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>
  13129. <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
  13130. passed in the relevant arguments, if applicable.</p>
  13131. </dl>
  13132. <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
  13133. 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
  13134. visual medium; or else the intrinsic width and height of the image, in CSS pixels, if the image is
  13135. <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
  13136. 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>
  13137. <p>On setting, they must act as if they <a href=#reflect id=the-img-element:reflect-5>reflected</a> the respective
  13138. content attributes of the same name.</p>
  13139. <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
  13140. 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
  13141. else 0. <a href=#refsCSS>[CSS]</a></p>
  13142. <p>The IDL attribute <dfn id=dom-img-complete><code>complete</code></dfn> must return true if
  13143. any of the following conditions is true:</p>
  13144. <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.
  13145. <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.
  13146. <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>.
  13147. <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>.
  13148. <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>.
  13149. </ul>
  13150. <p>Otherwise, the attribute must return false.</p>
  13151. <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
  13152. a <a href=#concept-script id=the-img-element:concept-script>script</a> is executing.</p>
  13153. <p>The <dfn id=dom-img-currentsrc><code>currentSrc</code></dfn> IDL attribute
  13154. 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>
  13155. <p>A constructor is provided for creating <code id=the-img-element:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code> objects (in addition to
  13156. the factory methods from DOM such as <code>createElement()</code>): <dfn id=dom-image><code>Image(<var>width</var>, <var>height</var>)</code></dfn>.
  13157. 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
  13158. <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
  13159. <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
  13160. <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>.
  13161. 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
  13162. <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
  13163. the invoked constructor is found.</p>
  13164. <div class=example>
  13165. <p>A single image can have different appropriate alternative text depending on the context.</p>
  13166. <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
  13167. Carouge municipality in the canton Geneva in Switzerland.</p>
  13168. <p>Here it is used as a supplementary icon:</p>
  13169. <pre>&lt;p>I lived in &lt;img src="carouge.svg" alt=""> Carouge.&lt;/p></pre>
  13170. <p>Here it is used as an icon representing the town:</p>
  13171. <pre>&lt;p>Home town: &lt;img src="carouge.svg" alt="Carouge">&lt;/p></pre>
  13172. <p>Here it is used as part of a text on the town:</p>
  13173. <pre>&lt;p>Carouge has a coat of arms.&lt;/p>
  13174. &lt;p>&lt;img src="carouge.svg" alt="The coat of arms depicts a lion, sitting in front of a tree.">&lt;/p>
  13175. &lt;p>It is used as decoration all over the town.&lt;/p></pre>
  13176. <p>Here it is used as a way to support a similar text where the description is given as well as,
  13177. instead of as an alternative to, the image:</p>
  13178. <pre>&lt;p>Carouge has a coat of arms.&lt;/p>
  13179. &lt;p>&lt;img src="carouge.svg" alt="">&lt;/p>
  13180. &lt;p>The coat of arms depicts a lion, sitting in front of a tree.
  13181. It is used as decoration all over the town.&lt;/p></pre>
  13182. <p>Here it is used as part of a story:</p>
  13183. <pre>&lt;p>He picked up the folder and a piece of paper fell out.&lt;/p>
  13184. &lt;p>&lt;img src="carouge.svg" alt="Shaped like a shield, the paper had a
  13185. red background, a green tree, and a yellow lion with its tongue
  13186. hanging out and whose tail was shaped like an S.">&lt;/p>
  13187. &lt;p>He stared at the folder. S! The answer he had been looking for all
  13188. this time was simply the letter S! How had he not seen that before? It all
  13189. came together now. The phone call where Hector had referred to a lion's tail,
  13190. the time Marco had stuck his tongue out...&lt;/p></pre>
  13191. <p>Here it is not known at the time of publication what the image will be, only that it will be a
  13192. coat of arms of some kind, and thus no replacement text can be provided, and instead only a brief
  13193. 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>
  13194. <pre>&lt;p>The last user to have uploaded a coat of arms uploaded this one:&lt;/p>
  13195. &lt;p>&lt;img src="last-uploaded-coat-of-arms.cgi" title="User-uploaded coat of arms.">&lt;/p></pre>
  13196. <p>Ideally, the author would find a way to provide real replacement text even in this case, e.g.
  13197. by asking the previous user. Not providing replacement text makes the document more difficult to
  13198. use for people who are unable to view images, e.g. blind users, or users or very low-bandwidth
  13199. connections or who pay by the byte, or users who are forced to use a text-only Web browser.</p>
  13200. </div>
  13201. <div class=example>
  13202. <p>Here are some more examples showing the same picture used in different contexts, with
  13203. different appropriate alternate texts each time.</p>
  13204. <pre>&lt;article>
  13205. &lt;h1>My cats&lt;/h1>
  13206. &lt;h2>Fluffy&lt;/h2>
  13207. &lt;p>Fluffy is my favorite.&lt;/p>
  13208. &lt;img src="fluffy.jpg" alt="She likes playing with a ball of yarn.">
  13209. &lt;p>She's just too cute.&lt;/p>
  13210. &lt;h2>Miles&lt;/h2>
  13211. &lt;p>My other cat, Miles just eats and sleeps.&lt;/p>
  13212. &lt;/article></pre>
  13213. <pre>&lt;article>
  13214. &lt;h1>Photography&lt;/h1>
  13215. &lt;h2>Shooting moving targets indoors&lt;/h2>
  13216. &lt;p>The trick here is to know how to anticipate; to know at what speed and
  13217. what distance the subject will pass by.&lt;/p>
  13218. &lt;img src="fluffy.jpg" alt="A cat flying by, chasing a ball of yarn, can be
  13219. photographed quite nicely using this technique.">
  13220. &lt;h2>Nature by night&lt;/h2>
  13221. &lt;p>To achieve this, you'll need either an extremely sensitive film, or
  13222. immense flash lights.&lt;/p>
  13223. &lt;/article></pre>
  13224. <pre>&lt;article>
  13225. &lt;h1>About me&lt;/h1>
  13226. &lt;h2>My pets&lt;/h2>
  13227. &lt;p>I've got a cat named Fluffy and a dog named Miles.&lt;/p>
  13228. &lt;img src="fluffy.jpg" alt="Fluffy, my cat, tends to keep itself busy.">
  13229. &lt;p>My dog Miles and I like go on long walks together.&lt;/p>
  13230. &lt;h2>music&lt;/h2>
  13231. &lt;p>After our walks, having emptied my mind, I like listening to Bach.&lt;/p>
  13232. &lt;/article></pre>
  13233. <pre>&lt;article>
  13234. &lt;h1>Fluffy and the Yarn&lt;/h1>
  13235. &lt;p>Fluffy was a cat who liked to play with yarn. He also liked to jump.&lt;/p>
  13236. &lt;aside>&lt;img src="fluffy.jpg" alt="" title="Fluffy">&lt;/aside>
  13237. &lt;p>He would play in the morning, he would play in the evening.&lt;/p>
  13238. &lt;/article></pre>
  13239. </div>
  13240. <h5 id=alt>4.8.5.1 Requirements for providing text to act as an alternative for images</h5>
  13241. <h6 id=general-guidelines>4.8.5.1.1 General guidelines</h6>
  13242. <p>Except where otherwise specified, the <code id=general-guidelines:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be
  13243. specified and its value must not be empty; the value must be an appropriate replacement for the
  13244. 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
  13245. what the image is intended to represent, as described in the following sections.</p>
  13246. <p>The most general rule to consider when writing alternative text is the following: <strong>the
  13247. 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>
  13248. attribute not change the meaning of the page</strong>.</p>
  13249. <p>So, in general, alternative text can be written by considering what one would have written had
  13250. one not been able to include the image.</p>
  13251. <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
  13252. never contain text that could be considered the image's <em>caption</em>, <em>title</em>, or
  13253. <em>legend</em>. It is supposed to contain replacement text that could be used by users
  13254. <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>
  13255. <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
  13256. not repeat information that is already provided in the prose next to the image.</p>
  13257. <p class=note>One way to think of alternative text is to think about how you would read the page
  13258. containing the image to someone over the phone, without mentioning that there is an image present.
  13259. Whatever you say instead of the image is typically a good start for writing the alternative
  13260. text.</p>
  13261. <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>
  13262. <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>
  13263. 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
  13264. the link or button.</p>
  13265. <div class=example>
  13266. <p>In this example, a user is asked to pick his preferred colour from a list of three. Each colour
  13267. is given by an image, but for users who have configured their user agent not to display images,
  13268. the colour names are used instead:</p>
  13269. <pre>&lt;h1>Pick your colour&lt;/h1>
  13270. &lt;ul>
  13271. &lt;li>&lt;a href="green.html"><strong>&lt;img src="green.jpeg" alt="Green"></strong>&lt;/a>&lt;/li>
  13272. &lt;li>&lt;a href="blue.html"><strong>&lt;img src="blue.jpeg" alt="Blue"></strong>&lt;/a>&lt;/li>
  13273. &lt;li>&lt;a href="red.html"><strong>&lt;img src="red.jpeg" alt="Red"></strong>&lt;/a>&lt;/li>
  13274. &lt;/ul></pre>
  13275. </div>
  13276. <div class=example>
  13277. <p>In this example, each button has a set of images to indicate the kind of colour output desired
  13278. by the user. The first image is used in each case to give the alternative text.</p>
  13279. <pre>&lt;button name="rgb"><strong>&lt;img src="red" alt="RGB">&lt;img src="green" alt="">&lt;img src="blue" alt=""></strong>&lt;/button>
  13280. &lt;button name="cmyk"><strong>&lt;img src="cyan" alt="CMYK">&lt;img src="magenta" alt="">&lt;img src="yellow" alt="">&lt;img src="black" alt=""></strong>&lt;/button></pre>
  13281. <p>Since each image represents one part of the text, it could also be written like this:</p>
  13282. <pre>&lt;button name="rgb"><strong>&lt;img src="red" alt="R">&lt;img src="green" alt="G">&lt;img src="blue" alt="B"></strong>&lt;/button>
  13283. &lt;button name="cmyk"><strong>&lt;img src="cyan" alt="C">&lt;img src="magenta" alt="M">&lt;img src="yellow" alt="Y">&lt;img src="black" alt="K"></strong>&lt;/button></pre>
  13284. <p>However, with other alternative text, this might not work, and putting all the alternative
  13285. text into one image in each case might make more sense:</p>
  13286. <pre>&lt;button name="rgb"><strong>&lt;img src="red" alt="sRGB profile">&lt;img src="green" alt="">&lt;img src="blue" alt=""></strong>&lt;/button>
  13287. &lt;button name="cmyk"><strong>&lt;img src="cyan" alt="CMYK profile">&lt;img src="magenta" alt="">&lt;img src="yellow" alt="">&lt;img src="black" alt=""></strong>&lt;/button></pre>
  13288. </div>
  13289. <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>
  13290. <p>Sometimes something can be more clearly stated in graphical form, for example as a flowchart, a
  13291. diagram, a graph, or a simple map showing directions. In such cases, an image can be given using
  13292. 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
  13293. who are unable to view the image (e.g. because they have a very slow connection, or because they
  13294. are using a text-only browser, or because they are listening to the page being read out by a
  13295. hands-free automobile voice Web browser, or simply because they are blind) are still able to
  13296. understand the message being conveyed.</p>
  13297. <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
  13298. 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>
  13299. attribute.</p>
  13300. <p>It is important to realise that the alternative text is a <em>replacement</em> for the image,
  13301. not a description of the image.</p>
  13302. <div class=example>
  13303. <p>In the following example we have <a href=images/parsing-model-overview.png>a flowchart</a>
  13304. 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
  13305. flowchart in prose form:</p>
  13306. <pre>&lt;p>In the common case, the data handled by the tokenization stage
  13307. comes from the network, but it can also come from script.&lt;/p>
  13308. &lt;p><strong>&lt;img src="images/parsing-model-overview.png" alt="The Network
  13309. passes data to the Input Stream Preprocessor, which passes it to the
  13310. Tokenizer, which passes it to the Tree Construction stage. From there,
  13311. data goes to both the DOM and to Script Execution. Script Execution is
  13312. linked to the DOM, and, using document.write(), passes data to the
  13313. Tokenizer."></strong>&lt;/p></pre>
  13314. </div>
  13315. <div class=example>
  13316. <p>Here's another example, showing a good solution and a bad solution to the problem of including
  13317. an image in a description.</p>
  13318. <p>First, here's the good solution. This sample shows how the alternative text should just be
  13319. what you would have put in the prose if the image had never existed.</p>
  13320. <pre>&lt;!-- This is the correct way to do things. -->
  13321. &lt;p>
  13322. You are standing in an open field west of a house.
  13323. <strong>&lt;img src="house.jpeg" alt="The house is white, with a boarded front door."></strong>
  13324. There is a small mailbox here.
  13325. &lt;/p></pre>
  13326. <p>Second, here's the bad solution. In this incorrect way of doing things, the alternative text
  13327. is simply a description of the image, instead of a textual replacement for the image. It's bad
  13328. because when the image isn't shown, the text doesn't flow as well as in the first example.</p>
  13329. <pre class=bad>&lt;!-- <em>This is the wrong way to do things.</em> -->
  13330. &lt;p>
  13331. You are standing in an open field west of a house.
  13332. &lt;img src="house.jpeg" alt="A white house, with a boarded front door.">
  13333. There is a small mailbox here.
  13334. &lt;/p></pre>
  13335. <p>Text such as "Photo of white house with boarded door" would be equally bad alternative text
  13336. (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
  13337. <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>
  13338. </div>
  13339. <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>
  13340. <p>A document can contain information in iconic form. The icon is intended to help users of visual
  13341. browsers to recognise features at a glance.</p>
  13342. <p>In some cases, the icon is supplemental to a text label conveying the same meaning. In those
  13343. 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>
  13344. <div class=example>
  13345. <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>
  13346. <pre>&lt;nav>
  13347. &lt;p>&lt;a href="/help/"><strong>&lt;img src="/icons/help.png" alt=""></strong> Help&lt;/a>&lt;/p>
  13348. &lt;p>&lt;a href="/configure/"><strong>&lt;img src="/icons/configuration.png" alt=""></strong>
  13349. Configuration Tools&lt;/a>&lt;/p>
  13350. &lt;/nav></pre>
  13351. </div>
  13352. <p>In other cases, the icon has no text next to it describing what it means; the icon is supposed
  13353. 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>
  13354. <div class=example>
  13355. <p>Here, posts on a news site are labeled with an icon indicating their topic.</p>
  13356. <pre>&lt;body>
  13357. &lt;article>
  13358. &lt;header>
  13359. &lt;h1>Ratatouille wins &lt;i>Best Movie of the Year&lt;/i> award&lt;/h1>
  13360. &lt;p><strong>&lt;img src="movies.png" alt="Movies"></strong>&lt;/p>
  13361. &lt;/header>
  13362. &lt;p>Pixar has won yet another &lt;i>Best Movie of the Year&lt;/i> award,
  13363. making this its 8th win in the last 12 years.&lt;/p>
  13364. &lt;/article>
  13365. &lt;article>
  13366. &lt;header>
  13367. &lt;h1>Latest TWiT episode is online&lt;/h1>
  13368. &lt;p><strong>&lt;img src="podcasts.png" alt="Podcasts"></strong>&lt;/p>
  13369. &lt;/header>
  13370. &lt;p>The latest TWiT episode has been posted, in which we hear
  13371. several tech news stories as well as learning much more about the
  13372. iPhone. This week, the panelists compare how reflective their
  13373. iPhones' Apple logos are.&lt;/p>
  13374. &lt;/article>
  13375. &lt;/body></pre>
  13376. </div>
  13377. <p>Many pages include logos, insignia, flags, or emblems, which stand for a particular entity such
  13378. as a company, organization, project, band, software package, country, or some such.</p>
  13379. <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
  13380. 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
  13381. the word "logo", as it is not the fact that it is a logo that is being conveyed, it's the entity
  13382. itself.</p>
  13383. <p>If the logo is being used next to the name of the entity that it represents, then the logo is
  13384. 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>
  13385. <p>If the logo is merely used as decorative material (as branding, or, for example, as a side
  13386. image in an article that mentions the entity to which the logo belongs), then the entry below on
  13387. purely decorative images applies. If the logo is actually being discussed, then it is being used
  13388. as a phrase or paragraph (the description of the logo) with an alternative graphical
  13389. representation (the logo itself), and the first entry above applies.</p>
  13390. <div class=example>
  13391. <p>In the following snippets, all four of the above cases are present. First, we see a logo used
  13392. to represent a company:</p>
  13393. <pre>&lt;h1><strong>&lt;img src="XYZ.gif" alt="The XYZ company"></strong>&lt;/h1></pre>
  13394. <p>Next, we see a paragraph which uses a logo right next to the company name, and so doesn't have
  13395. any alternative text:
  13396. <pre>&lt;article>
  13397. &lt;h2>News&lt;/h2>
  13398. &lt;p>We have recently been looking at buying the <strong>&lt;img src="alpha.gif"
  13399. alt=""> ΑΒΓ company</strong>, a small Greek company
  13400. specializing in our type of product.&lt;/p></pre>
  13401. <p>In this third snippet, we have a logo being used in an aside, as part of the larger article
  13402. discussing the acquisition:</p>
  13403. <pre> <strong>&lt;aside>&lt;p>&lt;img src="alpha-large.gif" alt="">&lt;/p>&lt;/aside></strong>
  13404. &lt;p>The ΑΒΓ company has had a good quarter, and our
  13405. pie chart studies of their accounts suggest a much bigger blue slice
  13406. than its green and orange slices, which is always a good sign.&lt;/p>
  13407. &lt;/article></pre>
  13408. <p>Finally, we have an opinion piece talking about a logo, and the logo is therefore described in
  13409. detail in the alternative text.</p>
  13410. <pre>&lt;p>Consider for a moment their logo:&lt;/p>
  13411. <strong>&lt;p>&lt;img src="/images/logo" alt="It consists of a green circle with a
  13412. green question mark centered inside it.">&lt;/p></strong>
  13413. &lt;p>How unoriginal can you get? I mean, oooooh, a question mark, how
  13414. &lt;em>revolutionary&lt;/em>, how utterly &lt;em>ground-breaking&lt;/em>, I'm
  13415. sure everyone will rush to adopt those specifications now! They could
  13416. at least have tried for some sort of, I don't know, sequence of
  13417. rounded squares with varying shades of green and bold white outlines,
  13418. at least that would look good on the cover of a blue book.&lt;/p></pre>
  13419. <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
  13420. the surrounding text, as if the image had never been there in the first place.</p>
  13421. </div>
  13422. <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>
  13423. <p>Sometimes, an image just consists of text, and the purpose of the image is not to highlight the
  13424. actual typographic effects used to render the text, but just to convey the text itself.</p>
  13425. <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
  13426. consist of the same text as written in the image itself.</p>
  13427. <div class=example>
  13428. <p>Consider a graphic containing the text "Earth Day", but with the letters all decorated with
  13429. flowers and plants. If the text is merely being used as a heading, to spice up the page for
  13430. graphical users, then the correct alternative text is just the same text "Earth Day", and no
  13431. mention need be made of the decorations:</p>
  13432. <pre>&lt;h1><strong>&lt;img src="earthdayheading.png" alt="Earth Day"></strong>&lt;/h1></pre>
  13433. </div>
  13434. <div class=example>
  13435. <p>An illuminated manuscript might use graphics for some of its images. The alternative text in
  13436. such a situation is just the character that the image represents.</p>
  13437. <pre>&lt;p>&lt;img src="initials/o.svg" alt="O">nce upon a time and a long long time ago, late at
  13438. night, when it was dark, over the hills, through the woods, across a great ocean, in a land far
  13439. away, in a small house, on a hill, under a full moon...</pre>
  13440. </div>
  13441. <p>When an image is used to represent a character that cannot otherwise be represented in Unicode,
  13442. for example gaiji, itaiji, or new characters such as novel currency symbols, the alternative text
  13443. should be a more conventional way of writing the same thing, e.g. using the phonetic hiragana or
  13444. katakana to give the character's pronunciation.</p>
  13445. <div class=example>
  13446. <p>In this example from 1997, a new-fangled currency symbol that looks like a curly E with two
  13447. bars in the middle instead of one is represented using an image. The alternative text gives the
  13448. character's pronunication.</p>
  13449. <pre>&lt;p>Only &lt;img src="euro.png" alt="euro ">5.99!</pre>
  13450. </div>
  13451. <p>An image should not be used if Unicode characters would serve an identical purpose. Only when
  13452. the text cannot be directly represented using Unicode, e.g. because of decorations or because the
  13453. character is not in the Unicode character set (as in the case of gaiji), would an image be
  13454. appropriate.</p>
  13455. <p class=note>If an author is tempted to use an image because their default system font does not
  13456. support a given character, then Web Fonts are a better solution than images.</p>
  13457. <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>
  13458. <p>In many cases, the image is actually just supplementary, and its presence merely reinforces the
  13459. 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
  13460. present but its value must be the empty string.</p>
  13461. <p>In general, an image falls into this category if removing the image doesn't make the page any
  13462. less useful, but including the image makes it a lot easier for users of visual browsers to
  13463. understand the concept.</p>
  13464. <div class=example>
  13465. <p>A flowchart that repeats the previous paragraph in graphical form:</p>
  13466. <pre>&lt;p>The Network passes data to the Input Stream Preprocessor, which
  13467. passes it to the Tokenizer, which passes it to the Tree Construction
  13468. stage. From there, data goes to both the DOM and to Script Execution.
  13469. Script Execution is linked to the DOM, and, using document.write(),
  13470. passes data to the Tokenizer.&lt;/p>
  13471. <strong>&lt;p>&lt;img src="images/parsing-model-overview.png" alt="">&lt;/p></strong></pre>
  13472. <p>In these cases, it would be wrong to include alternative text that consists of just a caption.
  13473. 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
  13474. 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
  13475. latter case, the image would in fact be a phrase or paragraph with an alternative graphical
  13476. representation, and would thus require alternative text.</p>
  13477. <pre>&lt;!-- Using the title="" attribute -->
  13478. &lt;p>The Network passes data to the Input Stream Preprocessor, which
  13479. passes it to the Tokenizer, which passes it to the Tree Construction
  13480. stage. From there, data goes to both the DOM and to Script Execution.
  13481. Script Execution is linked to the DOM, and, using document.write(),
  13482. passes data to the Tokenizer.&lt;/p>
  13483. &lt;p><strong>&lt;img src="images/parsing-model-overview.png" alt=""
  13484. title="Flowchart representation of the parsing model."></strong>&lt;/p></pre>
  13485. <pre>&lt;!-- Using &lt;figure> and &lt;figcaption> -->
  13486. &lt;p>The Network passes data to the Input Stream Preprocessor, which
  13487. passes it to the Tokenizer, which passes it to the Tree Construction
  13488. stage. From there, data goes to both the DOM and to Script Execution.
  13489. Script Execution is linked to the DOM, and, using document.write(),
  13490. passes data to the Tokenizer.&lt;/p>
  13491. &lt;figure>
  13492. <strong>&lt;img src="images/parsing-model-overview.png" alt="The Network leads to
  13493. the Input Stream Preprocessor, which leads to the Tokenizer, which
  13494. leads to the Tree Construction stage. The Tree Construction stage
  13495. leads to two items. The first is Script Execution, which leads via
  13496. document.write() back to the Tokenizer. The second item from which
  13497. Tree Construction leads is the DOM. The DOM is related to the Script
  13498. Execution."></strong>
  13499. &lt;figcaption>Flowchart representation of the parsing model.&lt;/figcaption>
  13500. &lt;/figure></pre>
  13501. <pre class=bad>&lt;!-- This is WRONG. Do not do this. Instead, do what the above examples do. -->
  13502. &lt;p>The Network passes data to the Input Stream Preprocessor, which
  13503. passes it to the Tokenizer, which passes it to the Tree Construction
  13504. stage. From there, data goes to both the DOM and to Script Execution.
  13505. Script Execution is linked to the DOM, and, using document.write(),
  13506. passes data to the Tokenizer.&lt;/p>
  13507. &lt;p>&lt;img src="images/parsing-model-overview.png"
  13508. alt="Flowchart representation of the parsing model.">&lt;/p>
  13509. &lt;!-- Never put the image's caption in the alt="" attribute! --></pre>
  13510. </div>
  13511. <div class=example>
  13512. <p>A graph that repeats the previous paragraph in graphical form:</p>
  13513. <pre>&lt;p>According to a study covering several billion pages,
  13514. about 62% of documents on the Web in 2007 triggered the Quirks
  13515. rendering mode of Web browsers, about 30% triggered the Almost
  13516. Standards mode, and about 9% triggered the Standards mode.&lt;/p>
  13517. <strong>&lt;p>&lt;img src="rendering-mode-pie-chart.png" alt="">&lt;/p></strong></pre>
  13518. </div>
  13519. <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>
  13520. <p>If an image is decorative but isn't especially page-specific — for example an image that
  13521. forms part of a site-wide design scheme — the image should be specified in the site's CSS,
  13522. not in the markup of the document.</p>
  13523. <p>However, a decorative image that isn't discussed by the surrounding text but still has some
  13524. 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
  13525. 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
  13526. string.</p>
  13527. <div class=example>
  13528. <p>Examples where the image is purely decorative despite being relevant would include things like
  13529. a photo of the Black Rock City landscape in a blog post about an event at Burning Man, or an
  13530. image of a painting inspired by a poem, on a page reciting that poem. The following snippet shows
  13531. an example of the latter case (only the first verse is included in this snippet):</p>
  13532. <pre>&lt;h1>The Lady of Shalott&lt;/h1>
  13533. <strong>&lt;p>&lt;img src="shalott.jpeg" alt="">&lt;/p></strong>
  13534. &lt;p>On either side the river lie&lt;br>
  13535. Long fields of barley and of rye,&lt;br>
  13536. That clothe the wold and meet the sky;&lt;br>
  13537. And through the field the road run by&lt;br>
  13538. To many-tower'd Camelot;&lt;br>
  13539. And up and down the people go,&lt;br>
  13540. Gazing where the lilies blow&lt;br>
  13541. Round an island there below,&lt;br>
  13542. The island of Shalott.&lt;/p></pre>
  13543. </div>
  13544. <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>
  13545. <p>When a picture has been sliced into smaller image files that are then displayed together to
  13546. 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
  13547. 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>
  13548. <div class=example>
  13549. <p>In the following example, a picture representing a company logo for <span>XYZ
  13550. Corp</span> has been split into two pieces, the first containing the letters "XYZ" and the second
  13551. with the word "Corp". The alternative text ("XYZ Corp") is all in the first image.</p>
  13552. <pre>&lt;h1><strong>&lt;img src="logo1.png" alt="XYZ Corp">&lt;img src="logo2.png" alt=""></strong>&lt;/h1></pre>
  13553. </div>
  13554. <div class=example>
  13555. <p>In the following example, a rating is shown as three filled stars and two empty stars. While
  13556. the alternative text could have been "★★★☆☆", the author has
  13557. instead decided to more helpfully give the rating in the form "3 out of 5". That is the
  13558. alternative text of the first image, and the rest have blank alternative text.</p>
  13559. <pre>&lt;p>Rating: &lt;meter max=5 value=3><strong>&lt;img src="1" alt="3 out of 5"
  13560. >&lt;img src="1" alt="">&lt;img src="1" alt="">&lt;img src="0" alt=""
  13561. >&lt;img src="0" alt=""></strong>&lt;/meter>&lt;/p></pre>
  13562. </div>
  13563. <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>
  13564. <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
  13565. for links.</p>
  13566. <p>However, if an image is indeed sliced and any of the components of the sliced picture are the
  13567. 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>
  13568. <div class=example>
  13569. <p>In the following example, a picture representing the flying spaghetti monster emblem, with
  13570. each of the left noodly appendages and the right noodly appendages in different images, so that
  13571. the user can pick the left side or the right side in an adventure.</p>
  13572. <pre>&lt;h1>The Church&lt;/h1>
  13573. &lt;p>You come across a flying spaghetti monster. Which side of His
  13574. Noodliness do you wish to reach out for?&lt;/p>
  13575. <strong>&lt;p>&lt;a href="?go=left" >&lt;img src="fsm-left.png" alt="Left side. ">&lt;/a
  13576. >&lt;img src="fsm-middle.png" alt=""
  13577. >&lt;a href="?go=right">&lt;img src="fsm-right.png" alt="Right side.">&lt;/a>&lt;/p></strong></pre>
  13578. </div>
  13579. <h6 id=a-key-part-of-the-content>4.8.5.1.10 A key part of the content</h6>
  13580. <p>In some cases, the image is a critical part of the content. This could be the case, for
  13581. instance, on a page that is part of a photo gallery. The image is the whole <em>point</em> of the
  13582. page containing it.</p>
  13583. <p>How to provide alternative text for an image that is a key part of the content depends on the
  13584. image's provenance.</p>
  13585. <dl><dt>The general case<dd>
  13586. <p>When it is possible for detailed alternative text to be provided, for example if the image is
  13587. part of a series of screenshots in a magazine review, or part of a comic strip, or is a
  13588. photograph in a blog entry about that photograph, text that can serve as a substitute for the
  13589. 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>
  13590. <div class=example>
  13591. <p>A screenshot in a gallery of screenshots for a new OS, with some alternative text:</p>
  13592. <pre>&lt;figure>
  13593. <strong>&lt;img src="KDE%20Light%20desktop.png"
  13594. alt="The desktop is blue, with icons along the left hand side in
  13595. two columns, reading System, Home, K-Mail, etc. A window is
  13596. open showing that menus wrap to a second line if they
  13597. cannot fit in the window. The window has a list of icons
  13598. along the top, with an address bar below it, a list of
  13599. icons for tabs along the left edge, a status bar on the
  13600. bottom, and two panes in the middle. The desktop has a bar
  13601. at the bottom of the screen with a few buttons, a pager, a
  13602. list of open applications, and a clock."></strong>
  13603. &lt;figcaption>Screenshot of a KDE desktop.&lt;/figcaption>
  13604. &lt;/figure></pre>
  13605. </div>
  13606. <div class=example>
  13607. <p>A graph in a financial report:</p>
  13608. <pre><strong>&lt;img src="sales.gif"
  13609. title="Sales graph"
  13610. alt="From 1998 to 2005, sales increased by the following percentages
  13611. with each year: 624%, 75%, 138%, 40%, 35%, 9%, 21%"></strong></pre>
  13612. <p>Note that "sales graph" would be inadequate alternative text for a sales graph. Text that
  13613. would be a good <em>caption</em> is not generally suitable as replacement text.</p>
  13614. </div>
  13615. <dt>Images that defy a complete description<dd>
  13616. <p>In certain cases, the nature of the image might be such that providing thorough alternative
  13617. text is impractical. For example, the image could be indistinct, or could be a complex fractal,
  13618. or could be a detailed topographical map.</p>
  13619. <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
  13620. suitable alternative text, but it may be somewhat brief.</p>
  13621. <div class=example>
  13622. <p>Sometimes there simply is no text that can do justice to an image. For example, there is
  13623. little that can be said to usefully describe a Rorschach inkblot test. However, a description,
  13624. even if brief, is still better than nothing:</p>
  13625. <pre>&lt;figure>
  13626. <strong>&lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A shape with left-right
  13627. symmetry with indistinct edges, with a small gap in the center, two
  13628. larger gaps offset slightly from the center, with two similar gaps
  13629. under them. The outline is wider in the top half than the bottom
  13630. half, with the sides extending upwards higher than the center, and
  13631. the center extending below the sides."></strong>
  13632. &lt;figcaption>A black outline of the first of the ten cards
  13633. in the Rorschach inkblot test.&lt;/figcaption>
  13634. &lt;/figure></pre>
  13635. <p>Note that the following would be a very bad use of alternative text:</p>
  13636. <pre class=bad>&lt;!-- This example is wrong. Do not copy it. -->
  13637. &lt;figure>
  13638. &lt;img src="/commons/a/a7/Rorschach1.jpg" alt="A black outline
  13639. of the first of the ten cards in the Rorschach inkblot test.">
  13640. &lt;figcaption>A black outline of the first of the ten cards
  13641. in the Rorschach inkblot test.&lt;/figcaption>
  13642. &lt;/figure></pre>
  13643. <p>Including the caption in the alternative text like this isn't useful because it effectively
  13644. duplicates the caption for users who don't have images, taunting them twice yet not helping
  13645. them any more than if they had only read or heard the caption once.</p>
  13646. </div>
  13647. <div class=example>
  13648. <p>Another example of an image that defies full description is a fractal, which, by definition,
  13649. is infinite in detail.</p>
  13650. <p>The following example shows one possible way of providing alternative text for the full view
  13651. of an image of the Mandelbrot set.</p>
  13652. <pre><strong>&lt;img src="ms1.jpeg" alt="The Mandelbrot set appears as a cardioid with
  13653. its cusp on the real axis in the positive direction, with a smaller
  13654. bulb aligned along the same center line, touching it in the negative
  13655. direction, and with these two shapes being surrounded by smaller bulbs
  13656. of various sizes."></strong></pre>
  13657. </div>
  13658. <div class=example>
  13659. <p>Similarly, a photograph of a person's face, for example in a biography, can be considered
  13660. quite relevant and key to the content, but it can be hard to fully substitute text for </p>
  13661. <pre>&lt;section class="bio">
  13662. &lt;h1>A Biography of Isaac Asimov&lt;/h1>
  13663. &lt;p>Born &lt;b>Isaak Yudovich Ozimov&lt;/b> in 1920, Isaac was a prolific author.&lt;/p>
  13664. &lt;p>&lt;img src="headpics/asimov.jpeg" alt="Isaac Asimov had dark hair, a tall forehead, and wore glasses.
  13665. Later in life, he wore long white sideburns.">
  13666. &lt;p>Asimov was born in Russia, and moved to the US when he was three years old.&lt;/p>
  13667. &lt;p>...
  13668. &lt;/section></pre>
  13669. <p>In such cases it is unnecessary (and indeed discouraged) to include a reference to the
  13670. presence of the image itself in the alternative text, since such text would be redundant with
  13671. the browser itself reporting the presence of the image. For example, if the alternative text
  13672. was "A photo of Isaac Asimov", then a conforming user agent might read that out as "(Image) A
  13673. photo of Isaac Asimov" rather than the more useful "(Image) Isaac Asimov had dark hair, a tall
  13674. forehead, and wore glasses...".</p>
  13675. </div>
  13676. <dt id=unknown-images>Images whose contents are not known<dd>
  13677. <p>In some unfortunate cases, there might be no alternative text available at all, either
  13678. because the image is obtained in some automated fashion without any associated alternative text
  13679. (e.g. a Webcam), or because the page is being generated by a script using user-provided images
  13680. where the user did not provide suitable or usable alternative text (e.g. photograph sharing
  13681. sites), or because the author does not himself know what the images represent (e.g. a blind
  13682. photographer sharing an image on his blog).</p>
  13683. <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
  13684. the following conditions must be met as well:</p>
  13685. <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
  13686. <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
  13687. 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
  13688. <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
  13689. <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
  13690. <code id=a-key-part-of-the-content:the-img-element-2><a href=#the-img-element>img</a></code> element.<li>
  13691. <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
  13692. value.</p>
  13693. <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
  13694. discouraged as many user agents do not expose the attribute in an accessible manner as
  13695. required by this specification (e.g. requiring a pointing device such as a mouse to cause a
  13696. tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone
  13697. with a modern phone or tablet).</p>
  13698. </ul>
  13699. <p class=note>Such cases are to be kept to an absolute minimum. If there is even the slightest
  13700. possibility of the author having the ability to provide real alternative text, then it would not
  13701. 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>
  13702. <div class=example>
  13703. <p>A photo on a photo-sharing site, if the site received the image with no metadata other than
  13704. the caption, could be marked up as follows:</p>
  13705. <pre>&lt;figure>
  13706. <strong>&lt;img src="1100670787_6a7c664aef.jpg"></strong>
  13707. &lt;figcaption>Bubbles traveled everywhere with us.&lt;/figcaption>
  13708. &lt;/figure></pre>
  13709. <p>It would be better, however, if a detailed description of the important parts of the image
  13710. obtained from the user and included on the page.</p>
  13711. </div>
  13712. <div class=example>
  13713. <p>A blind user's blog in which a photo taken by the user is shown. Initially, the user might
  13714. not have any idea what the photo he took shows:</p>
  13715. <pre>&lt;article>
  13716. &lt;h1>I took a photo&lt;/h1>
  13717. &lt;p>I went out today and took a photo!&lt;/p>
  13718. &lt;figure>
  13719. <strong>&lt;img src="photo2.jpeg"></strong>
  13720. &lt;figcaption>A photograph taken blindly from my front porch.&lt;/figcaption>
  13721. &lt;/figure>
  13722. &lt;/article></pre>
  13723. <p>Eventually though, the user might obtain a description of the image from his friends and
  13724. could then include alternative text:</p>
  13725. <pre>&lt;article>
  13726. &lt;h1>I took a photo&lt;/h1>
  13727. &lt;p>I went out today and took a photo!&lt;/p>
  13728. &lt;figure>
  13729. <strong>&lt;img src="photo2.jpeg" alt="The photograph shows my squirrel
  13730. feeder hanging from the edge of my roof. It is half full, but there
  13731. are no squirrels around. In the background, out-of-focus trees fill the
  13732. shot. The feeder is made of wood with a metal grate, and it contains
  13733. peanuts. The edge of the roof is wooden too, and is painted white
  13734. with light blue streaks."></strong>
  13735. &lt;figcaption>A photograph taken blindly from my front porch.&lt;/figcaption>
  13736. &lt;/figure>
  13737. &lt;/article></pre>
  13738. </div>
  13739. <div class=example>
  13740. <p>Sometimes the entire point of the image is that a textual description is not available, and
  13741. the user is to provide the description. For instance, the point of a CAPTCHA image is to see if
  13742. 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>
  13743. <pre>&lt;p>&lt;label>What does this image say?
  13744. <strong>&lt;img src="captcha.cgi?id=8934" title="CAPTCHA"></strong>
  13745. &lt;input type=text name=captcha>&lt;/label>
  13746. (If you cannot see the image, you can use an &lt;a
  13747. href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
  13748. <p>Another example would be software that displays images and asks for alternative text
  13749. precisely for the purpose of then writing a page with correct alternative text. Such a page
  13750. could have a table of images, like this:</p>
  13751. <pre>&lt;table>
  13752. &lt;thead>
  13753. &lt;tr> &lt;th> Image &lt;th> Description
  13754. &lt;tbody>
  13755. &lt;tr>
  13756. &lt;td> <strong>&lt;img src="2421.png" title="Image 640 by 100, filename 'banner.gif'"></strong>
  13757. &lt;td> &lt;input name="alt2421">
  13758. &lt;tr>
  13759. &lt;td> <strong>&lt;img src="2422.png" title="Image 200 by 480, filename 'ad3.gif'"></strong>
  13760. &lt;td> &lt;input name="alt2422">
  13761. &lt;/table></pre>
  13762. <p>Notice that even in this example, as much useful information as possible is still included
  13763. in the <code id=a-key-part-of-the-content:attr-title-4><a href=#attr-title>title</a></code> attribute.</p>
  13764. </div>
  13765. <p class=note>Since some users cannot use images at all (e.g. because they have a very slow
  13766. connection, or because they are using a text-only browser, or because they are listening to the
  13767. page being read out by a hands-free automobile voice Web browser, or simply because they are
  13768. 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
  13769. than being provided with replacement text when no alternative text is available and none can be
  13770. made available, as in the above examples. Lack of effort from the part of the author is not an
  13771. 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>
  13772. </dl>
  13773. <h6 id=an-image-not-intended-for-the-user>4.8.5.1.11 An image not intended for the user</h6>
  13774. <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
  13775. images.</p>
  13776. <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
  13777. 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
  13778. must be the empty string.</p>
  13779. <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>
  13780. <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>
  13781. <p><i>This section does not apply to documents that are publicly accessible, or whose target
  13782. audience is not necessarily personally known to the author, such as documents on a Web site,
  13783. e-mails sent to public mailing lists, or software documentation.</i></p>
  13784. <p>When an image is included in a private communication (such as an HTML e-mail) aimed at a
  13785. 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>
  13786. attribute may be omitted. However, even in such cases authors are strongly urged to include
  13787. alternative text (as appropriate according to the kind of image involved, as described in the
  13788. above entries), so that the e-mail is still usable should the user use a mail client that does not
  13789. support images, or should the document be forwarded on to other users whose abilities might not
  13790. include easily seeing images.</p>
  13791. <h6 id=guidance-for-markup-generators>4.8.5.1.13 Guidance for markup generators</h6>
  13792. <p>Markup generators (such as WYSIWYG authoring tools) should, wherever possible, obtain
  13793. alternative text from their users. However, it is recognised that in many cases, this will not be
  13794. possible.</p>
  13795. <p>For images that are the sole contents of links, markup generators should examine the link
  13796. target to determine the title of the target, or the URL of the target, and use information
  13797. obtained in this manner as the alternative text.</p>
  13798. <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
  13799. <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
  13800. provide the image's caption.</p>
  13801. <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>
  13802. attribute to the empty string, under the assumption that the image is a purely decorative image
  13803. that doesn't add any information but is still specific to the surrounding content, or omit the
  13804. <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
  13805. a key part of the content.</p>
  13806. <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>
  13807. 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
  13808. 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
  13809. value of this attribute must be the empty string. Documents containing such attributes are not
  13810. conforming, but conformance checkers will <a href=#guidance-for-conformance-checkers>silently
  13811. ignore</a> this error.</p>
  13812. <p class=note>This is intended to avoid markup generators from being pressured into replacing
  13813. 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
  13814. egregious error of providing phony alternative text, because state-of-the-art automated
  13815. conformance checkers cannot distinguish phony alternative text from correct alternative text.</p>
  13816. <p>Markup generators should generally avoid using the image's own file name as the alternative
  13817. text. Similarly, markup generators should avoid generating alternative text from any content that
  13818. will be equally available to presentation user agents (e.g. Web browsers).</p>
  13819. <p class=note>This is because once a page is generated, it will typically not be updated,
  13820. whereas the browsers that later read the page can be updated by the user, therefore the browser is
  13821. likely to have more up-to-date and finely-tuned heuristics than the markup generator did when
  13822. generating the page.</p>
  13823. <h6 id=guidance-for-conformance-checkers>4.8.5.1.14 Guidance for conformance checkers</h6>
  13824. <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>
  13825. attribute as an error unless one of the conditions listed below applies:</p>
  13826. <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
  13827. value that is not the empty string (also as <a href=#unknown-images>described
  13828. above</a>).<li><p>The conformance checker has been configured to assume that the document is an e-mail or
  13829. 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>
  13830. attribute whose value is the empty string. A conformance checker that is not reporting the lack
  13831. 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
  13832. 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>
  13833. attribute as an error. (This case does not represent a case where the document is conforming,
  13834. only that the generator could not determine appropriate alternative text — validators are
  13835. not required to show an error in this case, because such an error might encourage markup
  13836. generators to include bogus alternative text purely in an attempt to silence validators.
  13837. 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>
  13838. attribute; for example, there could be a user option to report <em>all</em> conformance errors
  13839. even those that might be the more or less inevitable result of using a markup
  13840. generator.)</ul>
  13841. <h4 id=the-iframe-element>4.8.6 The <dfn><code>iframe</code></dfn> element</h4>
  13842. <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>
  13843. <pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement id=the-iframe-element:htmlelement>HTMLElement</a> {
  13844. attribute DOMString <a href=#dom-iframe-src id=the-iframe-element:dom-iframe-src>src</a>;
  13845. attribute DOMString <a href=#dom-iframe-srcdoc id=the-iframe-element:dom-iframe-srcdoc>srcdoc</a>;
  13846. attribute DOMString <a href=#dom-iframe-name id=the-iframe-element:dom-iframe-name>name</a>;
  13847. [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>;
  13848. attribute boolean <a href=#dom-iframe-seamless id=the-iframe-element:dom-iframe-seamless>seamless</a>;
  13849. attribute boolean <a href=#dom-iframe-allowfullscreen id=the-iframe-element:dom-iframe-allowfullscreen>allowFullscreen</a>;
  13850. attribute DOMString <a href=#dom-dim-width id=the-iframe-element:dom-dim-width>width</a>;
  13851. attribute DOMString <a href=#dom-dim-height id=the-iframe-element:dom-dim-height>height</a>;
  13852. 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>;
  13853. 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>;
  13854. // <a href="#HTMLIFrameElement-partial">also has obsolete members</a>
  13855. };</pre>
  13856. </dl>
  13857. <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
  13858. context</a>.</p>
  13859. <p>The <dfn id=attr-iframe-src><code>src</code></dfn> attribute gives the address of a page
  13860. 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
  13861. <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
  13862. <code id=the-iframe-element:attr-iframe-src-2><a href=#attr-iframe-src>src</a></code> attribute must also be specified.</p>
  13863. <p>The <dfn id=attr-iframe-srcdoc><code>srcdoc</code></dfn> attribute gives the content of
  13864. 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
  13865. is the source of <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code>
  13866. document</dfn>.</p>
  13867. <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
  13868. HTML syntax</a> that consists of the following syntactic components, in the given order:</p>
  13869. <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>.
  13870. <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>
  13871. <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
  13872. production labeled <code>document</code> in the XML specification. <a href=#refsXML>[XML]</a></p>
  13873. <div class=example>
  13874. <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
  13875. 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
  13876. agents that support this feature with an extra layer of protection from script injection in the
  13877. blog post comments:</p>
  13878. <pre>&lt;article>
  13879. &lt;h1>I got my own magazine!&lt;/h1>
  13880. &lt;p>After much effort, I've finally found a publisher, and so now I
  13881. have my own magazine! Isn't that awesome?! The first issue will come
  13882. out in September, and we have articles about getting food, and about
  13883. getting in boxes, it's going to be great!&lt;/p>
  13884. &lt;footer>
  13885. &lt;p>Written by &lt;a href="/users/cap">cap&lt;/a>, 1 hour ago.
  13886. &lt;/footer>
  13887. &lt;article>
  13888. &lt;footer> Thirteen minutes ago, &lt;a href="/users/ch">ch&lt;/a> wrote: &lt;/footer>
  13889. &lt;iframe seamless sandbox srcdoc="&lt;p>did you get a cover picture yet?">&lt;/iframe>
  13890. &lt;/article>
  13891. &lt;article>
  13892. &lt;footer> Nine minutes ago, &lt;a href="/users/cap">cap&lt;/a> wrote: &lt;/footer>
  13893. &lt;iframe seamless sandbox srcdoc="&lt;p>Yeah, you can see it &lt;a href=&amp;quot;/gallery?mode=cover&amp;amp;amp;page=1&amp;quot;>in my gallery&lt;/a>.">&lt;/iframe>
  13894. &lt;/article>
  13895. &lt;article>
  13896. &lt;footer> Five minutes ago, &lt;a href="/users/ch">ch&lt;/a> wrote: &lt;/footer>
  13897. &lt;iframe seamless sandbox srcdoc="&lt;p>hey that's earl's table.
  13898. &lt;p>you should get earl&amp;amp;amp;me on the next cover.">&lt;/iframe>
  13899. &lt;/article></pre>
  13900. <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
  13901. ampersands (e.g. in URLs or in prose) mentioned in the sandboxed content have to be
  13902. <em>doubly</em> escaped — once so that the ampersand is preserved when originally parsing
  13903. 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
  13904. ampersand from being misinterpreted when parsing the sandboxed content.</p>
  13905. <p>Furthermore, notice that since the <a href=#syntax-doctype id=the-iframe-element:syntax-doctype-2>DOCTYPE</a> is optional in
  13906. <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>,
  13907. <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
  13908. 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>
  13909. 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
  13910. relatively succint despite representing an entire document, since only the contents of the
  13911. <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
  13912. present, but only by implication.</p>
  13913. </div>
  13914. <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
  13915. QUOTATION MARK characters (") to wrap the attribute contents and then to escape all U+0022
  13916. QUOTATION MARK (") and U+0026 AMPERSAND (&amp;) 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>
  13917. <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
  13918. SIGN character (&lt;) 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
  13919. whitespace characters — specifically U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
  13920. (LF), and U+000D CARRIAGE RETURN (CR) — also need to be escaped. <a href=#refsXML>[XML]</a></p>
  13921. <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
  13922. 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>
  13923. <hr>
  13924. <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
  13925. 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
  13926. 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>
  13927. <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
  13928. 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>
  13929. <p class=note>This happens without any <code id=the-iframe-element:event-unload><a href=#event-unload>unload</a></code> events firing
  13930. (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
  13931. document">unloaded</span></em>).</p>
  13932. <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
  13933. <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
  13934. must <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-2>process the <code>iframe</code> attributes</a>.</p>
  13935. <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>
  13936. 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
  13937. <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-3>process the <code>iframe</code> attributes</a>.</p>
  13938. <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code> attributes</dfn>, it must run
  13939. the first appropriate steps from the following list:</p>
  13940. <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>
  13941. 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>
  13942. 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
  13943. 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
  13944. 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
  13945. time"<dd>
  13946. <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>
  13947. <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
  13948. <a href=#dom-manipulation-task-source id=the-iframe-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  13949. <dt>Otherwise<dd>
  13950. <ol><li>
  13951. <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
  13952. value is the empty string, let <var>url</var> be the string
  13953. "<code id=the-iframe-element:about:blank><a href=#about:blank>about:blank</a></code>".</p>
  13954. <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>
  13955. <p>If that is not successful, then let <var>url</var> be the string
  13956. "<code id=the-iframe-element:about:blank-2><a href=#about:blank>about:blank</a></code>". Otherwise, let <var>url</var> be the resulting
  13957. <a href=#absolute-url id=the-iframe-element:absolute-url>absolute URL</a>.</p>
  13958. <li>
  13959. <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
  13960. 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
  13961. identifiers, is equal to <var>url</var>, then abort these steps.</p>
  13962. <li>
  13963. <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>
  13964. to <var>url</var>.</p>
  13965. </ol>
  13966. </dl>
  13967. <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
  13968. 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
  13969. 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
  13970. <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>
  13971. <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
  13972. 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
  13973. 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>
  13974. <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
  13975. 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>
  13976. 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
  13977. 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
  13978. with <a href=#replacement-enabled id=the-iframe-element:replacement-enabled-2>replacement enabled</a>.</p>
  13979. <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
  13980. 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>
  13981. <p class=note>A <code id=the-iframe-element:event-load><a href=#event-load>load</a></code> event is also fired at the
  13982. <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>
  13983. <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
  13984. 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
  13985. that <code id=the-iframe-element:document-9><a href=#document>Document</a></code>.</p>
  13986. <p>The <dfn id=iframe-load-event-steps>iframe load event steps</dfn> are as follows:</p>
  13987. <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
  13988. <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,
  13989. 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>
  13990. 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
  13991. <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>
  13992. flag.</ol>
  13993. <p class=warning>This, in conjunction with scripting, can be used to probe the URL space of the
  13994. local network's HTTP servers. User agents may implement <a href=#origin-2 id=the-iframe-element:origin-2>cross-origin</a>
  13995. access control policies that are stricter than those described above to mitigate this attack, but
  13996. unfortunately such policies are typically not compatible with existing Web content.</p>
  13997. <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
  13998. 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
  13999. <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
  14000. <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
  14001. 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>
  14002. <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
  14003. <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>
  14004. <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
  14005. <a href=#resolve-a-url id=the-iframe-element:resolve-a-url-2>resolved</a>, the browsing context will remain at the initial
  14006. <code id=the-iframe-element:about:blank-4><a href=#about:blank>about:blank</a></code> page.</p>
  14007. <p class=note>If the user <a href=#navigate id=the-iframe-element:navigate-9>navigates</a> away from this page, the
  14008. <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
  14009. <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>
  14010. <hr>
  14011. <p>The <dfn id=attr-iframe-name><code>name</code></dfn> attribute, if present, must be a
  14012. <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
  14013. browsing context</a>. When the browsing context is created, if the attribute
  14014. 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;
  14015. 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>
  14016. <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
  14017. <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
  14018. 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
  14019. the empty string.</p>
  14020. <hr>
  14021. <p>The <dfn id=attr-iframe-sandbox><code>sandbox</code></dfn> attribute, when specified,
  14022. 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
  14023. 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
  14024. 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>
  14025. <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>,
  14026. forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
  14027. targeting other <a href=#browsing-context id=the-iframe-element:browsing-context-8>browsing contexts</a>, and plugins are secured.
  14028. 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
  14029. the content to be treated as being from its real origin instead of forcing it into a unique
  14030. 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>
  14031. 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>;
  14032. 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
  14033. pointer lock API, popups, and scripts respectively. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>
  14034. <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
  14035. 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>
  14036. 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>
  14037. attribute and then reload itself, effectively breaking out of the sandbox altogether.</p>
  14038. <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
  14039. 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
  14040. entire <code id=the-iframe-element:attr-iframe-sandbox-5><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, has no effect on an
  14041. already-loaded page.</p>
  14042. <p class=warning>Potentially hostile files should not be served from the same server as the file
  14043. 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
  14044. attacker can convince the user to just visit the hostile content directly, rather than in the
  14045. <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
  14046. served from a separate dedicated domain. Using a different domain ensures that scripts in the
  14047. files are unable to attack the site, even if the user is tricked into visiting those pages
  14048. directly, without the protection of the <code id=the-iframe-element:attr-iframe-sandbox-6><a href=#attr-iframe-sandbox>sandbox</a></code>
  14049. attribute.</p>
  14050. <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>
  14051. attribute has its <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-13>nested browsing context</a> created (before the initial
  14052. <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>
  14053. 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
  14054. 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
  14055. <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
  14056. <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>
  14057. attribute, the <var>allow fullscreen flag</var>.</p>
  14058. <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>
  14059. 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
  14060. 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
  14061. <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>
  14062. <div class=example>
  14063. <p>In this example, some completely-unknown, potentially hostile, user-provided HTML content is
  14064. embedded in a page. Because it is served from a separate domain, it is affected by all the normal
  14065. cross-site restrictions. In addition, the embedded page has scripting disabled, plugins disabled,
  14066. forms disabled, and it cannot navigate any frames or windows other than itself (or any frames or
  14067. windows it itself embeds).</p>
  14068. <pre>&lt;p>We're not scared of you! Here is your content, unedited:&lt;/p>
  14069. &lt;iframe sandbox src="http://usercontent.example.net/getusercontent.cgi?id=12193">&lt;/iframe></pre>
  14070. <p class=warning>It is important to use a separate domain so that if the attacker convinces the
  14071. user to visit that page directly, the page doesn't run in the context of the site's origin, which
  14072. would make the user vulnerable to any attack found in the page.</p>
  14073. </div>
  14074. <div class=example>
  14075. <p>In this example, a gadget from another site is embedded. The gadget has scripting and forms
  14076. enabled, and the origin sandbox restrictions are lifted, allowing the gadget to communicate with
  14077. its originating server. The sandbox is still useful, however, as it disables plugins and popups,
  14078. thus reducing the risk of the user being exposed to malware and other annoyances.</p>
  14079. <pre>&lt;iframe sandbox="allow-same-origin allow-forms allow-scripts"
  14080. src="http://maps.example.com/embedded.html">&lt;/iframe></pre>
  14081. </div>
  14082. <div class=example>
  14083. <p>Suppose a file A contained the following fragment:</p>
  14084. <pre>&lt;iframe sandbox="allow-same-origin allow-forms" src=B>&lt;/iframe></pre>
  14085. <p>Suppose that file B contained an iframe also:</p>
  14086. <pre>&lt;iframe sandbox="allow-scripts" src=C>&lt;/iframe></pre>
  14087. <p>Further, suppose that file C contained a link:</p>
  14088. <pre>&lt;a href=D>Link&lt;/a></pre>
  14089. <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>
  14090. <p>Page C in this scenario has all the sandboxing flags set. Scripts are disabled, because the
  14091. <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
  14092. <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)
  14093. 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
  14094. set.</p>
  14095. <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.
  14096. This would change nothing immediately. If the user clicked the link in C, loading page D into the
  14097. <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
  14098. 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
  14099. loaded.</p>
  14100. <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
  14101. hard to reason about what will be allowed and what will not.</p>
  14102. </div>
  14103. <hr>
  14104. <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
  14105. 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
  14106. <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
  14107. containing document (seamlessly included in the parent document).</p>
  14108. <div class=example>
  14109. <p id=inclusion>An HTML inclusion is effected using this attribute as in the following example.
  14110. In this case, the inclusion is of a site-wide navigation bar. Any links in the
  14111. <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
  14112. <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
  14113. 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>
  14114. attribute with the value <code>_parent</code>. Similarly, in new user agents the styles
  14115. of the parent page will be automatically applied to the contents of the frame, but to support
  14116. legacy user agents authors might wish to include the styles explicitly.</p>
  14117. <pre>&lt;!DOCTYPE HTML>
  14118. &lt;title>Mirror Mirror — MovieInfo™&lt;/title>
  14119. &lt;header>
  14120. &lt;hgroup>
  14121. &lt;h1>Mirror Mirror&lt;/h1>
  14122. &lt;h2>Part of the MovieInfo™ Database&lt;/h2>
  14123. &lt;/hgroup>
  14124. &lt;nav>
  14125. <strong>&lt;iframe seamless src="nav.inc">&lt;/iframe></strong>
  14126. &lt;/nav>
  14127. &lt;/header>
  14128. ...</pre>
  14129. </div>
  14130. <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
  14131. following conditions are met:</p>
  14132. <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
  14133. <code id=the-iframe-element:the-iframe-element-46><a href=#the-iframe-element>iframe</a></code> element, and
  14134. <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
  14135. 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
  14136. <li>Either:
  14137. <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
  14138. 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
  14139. <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
  14140. <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
  14141. <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
  14142. <code>iframe</code> <code>srcdoc</code> document</a>.
  14143. </ul>
  14144. </ul>
  14145. <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
  14146. requirements apply:</p>
  14147. <ul><li><p>The user agent must set the <dfn id=seamless-browsing-context-flag>seamless browsing context flag</dfn> to true for that
  14148. <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
  14149. 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
  14150. (<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>
  14151. (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
  14152. <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
  14153. <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
  14154. 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
  14155. 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
  14156. <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
  14157. 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
  14158. inheritance only, treat the root element of the <a href=#active-document id=the-iframe-element:active-document-10>active document</a> of the
  14159. <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
  14160. <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
  14161. 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
  14162. <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
  14163. 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
  14164. non-replaced block-level element with 'width: auto', unless that width would be zero (e.g. if the
  14165. element is floating or absolutely positioned), in which case the user agent should set the
  14166. 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
  14167. 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
  14168. 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
  14169. 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
  14170. scrollable overflow at its bottom edge. Scrollable overflow is any overflow that would increase the range to
  14171. which a scrollbar or other scrolling mechanism can scroll.<li>
  14172. <p>In visual media, in a CSS-supporting user agent: the user agent must force the height of the
  14173. 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
  14174. context</a> of the <code id=the-iframe-element:the-iframe-element-65><a href=#the-iframe-element>iframe</a></code> to zero.</p>
  14175. <p class=note>This is intended to get around the otherwise circular dependency of percentage
  14176. dimensions that depend on the height of the containing block, thus affecting the height of the
  14177. document's bounding box, thus affecting the height of the viewport, thus affecting the size of
  14178. the initial containing block.</p>
  14179. <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>
  14180. without announcing that it is a separate document.<li>
  14181. <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
  14182. <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
  14183. <code id=the-iframe-element:the-iframe-element-67><a href=#the-iframe-element>iframe</a></code> is in, if any.</p>
  14184. <p class=example>For example if the user agent supports listing all the links in a document,
  14185. links in "seamlessly" nested documents would be included in that list without being
  14186. significantly distinguished from links in the document itself.</p>
  14187. <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
  14188. <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>
  14189. <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
  14190. 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
  14191. that is clearly distinguishable as a separate <a href=#browsing-context id=the-iframe-element:browsing-context-15>browsing context</a>, and the
  14192. <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
  14193. context</a>.</p>
  14194. <p class=warning>It is important that user agents recheck the above conditions whenever the
  14195. <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
  14196. <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
  14197. 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
  14198. origin.</p>
  14199. <p class=note>The attribute can be set or removed dynamically, with the rendering updating in
  14200. tandem.</p>
  14201. <p class=note>The <code id=the-iframe-element:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute does not
  14202. 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>
  14203. <hr>
  14204. <p>The <dfn id=attr-iframe-allowfullscreen><code>allowfullscreen</code></dfn> attribute is a
  14205. <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
  14206. 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
  14207. 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>
  14208. <div class=example>
  14209. <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
  14210. player to show its video full-screen.</p>
  14211. <pre>&lt;article>
  14212. &lt;header>
  14213. &lt;p>&lt;img src="/usericons/1627591962735"> &lt;b>Fred Flintstone&lt;/b>&lt;/p>
  14214. &lt;p>&lt;a href="/posts/3095182851" rel=bookmark>12:44&lt;/a> — &lt;a href="#acl-3095182851">Private Post&lt;/a>&lt;/p>
  14215. &lt;/header>
  14216. &lt;main>
  14217. &lt;p>Check out my new ride!&lt;/p>
  14218. <strong>&lt;iframe src="https://video.example.com/embed?id=92469812" allowfullscreen>&lt;/iframe></strong>
  14219. &lt;/main>
  14220. &lt;/article></pre>
  14221. </div>
  14222. <hr>
  14223. <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
  14224. embedded content has specific dimensions (e.g. ad units have well-defined dimensions).</p>
  14225. <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
  14226. create a nested <a href=#browsing-context id=the-iframe-element:browsing-context-18>browsing context</a>, regardless of whether the specified initial
  14227. contents are successfully used.</p>
  14228. <hr>
  14229. <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
  14230. 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
  14231. fallback content.)</p>
  14232. <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
  14233. 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
  14234. 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>,
  14235. 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>
  14236. elements being anywhere in the list or as descendants of elements in the list, and with all the
  14237. elements in the list (including their descendants) being themselves conforming.</p>
  14238. <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>
  14239. <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
  14240. text.</p>
  14241. <hr>
  14242. <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
  14243. content attributes of the same name.</p>
  14244. <p>The <dfn id=dom-iframe-allowfullscreen><code>allowFullscreen</code></dfn> IDL attribute
  14245. 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>
  14246. content attribute.</p>
  14247. <p>The <dfn id=dom-iframe-contentdocument><code>contentDocument</code></dfn> IDL attribute
  14248. 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
  14249. <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
  14250. <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
  14251. 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>
  14252. <p>The <dfn id=dom-iframe-contentwindow><code>contentWindow</code></dfn> IDL attribute must
  14253. 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
  14254. browsing context</a>, if any, or null otherwise.</p>
  14255. <div class=example>
  14256. <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
  14257. advertising broker:</p>
  14258. <pre>&lt;iframe src="http://ads.example.com/?customerid=923513721&amp;amp;format=banner"
  14259. width="468" height="60">&lt;/iframe></pre>
  14260. </div>
  14261. <h4 id=the-embed-element>4.8.7 The <dfn><code>embed</code></dfn> element</h4>
  14262. <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>
  14263. <pre class=idl>interface <dfn id=htmlembedelement>HTMLEmbedElement</dfn> : <a href=#htmlelement id=the-embed-element:htmlelement>HTMLElement</a> {
  14264. attribute DOMString <a href=#dom-embed-src id=the-embed-element:dom-embed-src>src</a>;
  14265. attribute DOMString <a href=#dom-embed-type id=the-embed-element:dom-embed-type>type</a>;
  14266. attribute DOMString <a href=#dom-dim-width id=the-embed-element:dom-dim-width>width</a>;
  14267. attribute DOMString <a href=#dom-dim-height id=the-embed-element:dom-dim-height>height</a>;
  14268. <a href=#document id=the-embed-element:document>Document</a> <a href=#dom-embed-getsvgdocument id=the-embed-element:dom-embed-getsvgdocument>getSVGDocument</a>();
  14269. <a href=#dom-embed-caller id=the-embed-element:dom-embed-caller>legacycaller</a> any (any... arguments);
  14270. // <a href="#HTMLEmbedElement-partial">also has obsolete members</a>
  14271. };</pre>
  14272. <p>Depending on the type of content instantiated by the
  14273. <code id=the-embed-element:the-embed-element><a href=#the-embed-element>embed</a></code> element, the node may also support other
  14274. interfaces.</p>
  14275. </dl>
  14276. <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
  14277. non-HTML) application or interactive content.</p>
  14278. <p>The <dfn id=attr-embed-src><code>src</code></dfn> attribute gives the address of the
  14279. 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
  14280. potentially surrounded by spaces</a>.</p>
  14281. <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
  14282. <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
  14283. be specified.</p>
  14284. <p>The <dfn id=attr-embed-type><code>type</code></dfn> attribute, if present, gives the
  14285. <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
  14286. <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
  14287. 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>
  14288. <p>While any of the following conditions are occurring, any <a href=#plugin id=the-embed-element:plugin>plugin</a> instantiated for
  14289. 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>
  14290. nothing:</p>
  14291. <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
  14292. <a href=#fallback-content id=the-embed-element:fallback-content>fallback content</a>.</ul>
  14293. <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
  14294. active</dfn> when the following conditions are all met simultaneously:</p>
  14295. <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>
  14296. 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
  14297. 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
  14298. <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
  14299. the <a href=#event-loop id=the-embed-element:event-loop-2>event loop</a> reached step 1.</ul>
  14300. <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
  14301. 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
  14302. <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
  14303. <code>embed</code> element setup steps</a>.</p>
  14304. <p><dfn id=the-embed-element-setup-steps>The <code>embed</code> element setup steps</dfn> are as follows:</p>
  14305. <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
  14306. <code>embed</code> element setup steps</a> for this element, then abort these steps.<li>
  14307. <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>
  14308. <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
  14309. <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
  14310. 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
  14311. 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
  14312. 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
  14313. the resource has been <a href=#fetch id=the-embed-element:fetch-2>fetched</a> must run the following steps:</p>
  14314. <ol><li><p>If another <a href=#concept-task id=the-embed-element:concept-task-3>task</a> has since been queued to run
  14315. <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
  14316. steps.<li>
  14317. <p>Determine the <dfn id=concept-embed-type>type of the content</dfn> being embedded, as
  14318. follows (stopping at the first substep that determines the type):</p>
  14319. <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
  14320. 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
  14321. <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>
  14322. <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
  14323. the specified resource (after any redirects) results in a <a href=#parsed-url id=the-embed-element:parsed-url>parsed URL</a> whose
  14324. <a href=#concept-url-path id=the-embed-element:concept-url-path>path</a> component matches a pattern that a
  14325. <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
  14326. type</a> is the type that that plugin can handle.</p>
  14327. <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
  14328. "<code>.swf</code>".</p>
  14329. <li><p>Otherwise, if the specified resource has <a href=#content-type id=the-embed-element:content-type-2>explicit
  14330. Content-Type metadata</a>, then that is the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-3>content's
  14331. 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
  14332. can be no appropriate <a href=#plugin id=the-embed-element:plugin-4>plugin</a> for it.</ol>
  14333. <li>
  14334. <p>If the previous step determined that the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-5>content's
  14335. type</a> is <code>image/svg+xml</code>, then run the following substeps:</p>
  14336. <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
  14337. context</a>, associate the element with a newly created <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-2>nested browsing
  14338. context</a>, and, if the element has a <code id=the-embed-element:attr-embed-name><a href=#attr-embed-name>name</a></code>
  14339. 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
  14340. browsing context</a> to the value of this attribute.</p>
  14341. <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
  14342. the fetched resource, with <a href=#replacement-enabled id=the-embed-element:replacement-enabled>replacement enabled</a>, and with the
  14343. <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
  14344. browsing context</a>. (The <code id=the-embed-element:attr-embed-src-10><a href=#attr-embed-src>src</a></code> attribute of the
  14345. <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
  14346. 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
  14347. <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-5>nested browsing context</a>.</ol>
  14348. <li>
  14349. <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
  14350. content of the resource, replacing any previously instantiated plugin for the element. The
  14351. <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>
  14352. <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
  14353. <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
  14354. element.</ol>
  14355. <p>Whether the resource is fetched successfully or not (e.g. whether the response code was a
  14356. 2xx code <a href=#concept-http-equivalent-codes id=the-embed-element:concept-http-equivalent-codes>or equivalent</a>) must be ignored
  14357. when determining the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-7>content's type</a> and when handing
  14358. the resource to the plugin.</p>
  14359. <p class=note>This allows servers to return data for plugins even with error responses (e.g.
  14360. HTTP 500 Internal Server Error codes can still contain plugin data).</p>
  14361. <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>
  14362. <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>
  14363. <p>The user agent should find and instantiate an appropriate <a href=#plugin id=the-embed-element:plugin-8>plugin</a> based on the
  14364. 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>
  14365. element now represents this <a href=#plugin id=the-embed-element:plugin-9>plugin</a> instance.</p>
  14366. <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
  14367. event</a> named <code id=the-embed-element:event-load-2><a href=#event-load>load</a></code> at the element.</p>
  14368. </dl>
  14369. </ol>
  14370. <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
  14371. find a suitable plugin when attempting to find and instantiate one for the algorithm above, then
  14372. the user agent must use a default plugin. This default could be as simple as saying "Unsupported
  14373. Format".</p>
  14374. <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
  14375. active</a> stops being <a href=#concept-embed-active id=the-embed-element:concept-embed-active-6>potentially active</a>, any
  14376. <a href=#plugin id=the-embed-element:plugin-10>plugin</a> that had been instantiated for that element must be unloaded.</p>
  14377. <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
  14378. 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
  14379. sandboxing flag set</a>, then the user agent must not instantiate the <a href=#plugin id=the-embed-element:plugin-12>plugin</a>, and
  14380. 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
  14381. <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
  14382. sandbox and instantiate the <a href=#plugin id=the-embed-element:plugin-14>plugin</a> anyway; if the user invokes such an option, the
  14383. user agent must act as if the conditions above did not apply for the purposes of this element.</p>
  14384. <p class=warning>Plugins that cannot be <a href=#concept-plugin-secure id=the-embed-element:concept-plugin-secure-2>secured</a> are
  14385. disabled in sandboxed browsing contexts because they might not honor the restrictions imposed by
  14386. the sandbox (e.g. they might allow scripting even when scripting in the sandbox is disabled). User
  14387. agents should convey the danger of overriding the sandbox to the user if an option to do so is
  14388. provided.</p>
  14389. <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
  14390. <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>
  14391. 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
  14392. 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
  14393. <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>
  14394. 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
  14395. document.</p>
  14396. <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
  14397. section is the <a href=#dom-manipulation-task-source id=the-embed-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  14398. <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
  14399. 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>
  14400. 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
  14401. parameters to the <a href=#plugin id=the-embed-element:plugin-15>plugin</a>.</p>
  14402. <p class=note>All attributes in <a href=#html-documents id=the-embed-element:html-documents>HTML documents</a> get lowercased automatically, so the
  14403. restriction on uppercase letters doesn't affect such documents.</p>
  14404. <p class=note>The four exceptions are to exclude legacy attributes that have side-effects beyond
  14405. just sending parameters to the <a href=#plugin id=the-embed-element:plugin-16>plugin</a>.</p>
  14406. <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>
  14407. element that have no namespace to the <a href=#plugin id=the-embed-element:plugin-17>plugin</a> used, when one is instantiated.</p>
  14408. <p>The <code id=the-embed-element:htmlembedelement><a href=#htmlembedelement>HTMLEmbedElement</a></code> object representing the element must expose the scriptable
  14409. 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
  14410. minimum, this interface must implement the <dfn id=dom-embed-caller>legacy caller
  14411. operation</dfn>. (It is suggested that the default behavior of this legacy caller operation, e.g.
  14412. the behavior of the default plugin's legacy caller operation, be to throw a
  14413. <code id=the-embed-element:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception.)</p>
  14414. <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>
  14415. <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>
  14416. <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>
  14417. </dl>
  14418. <p>The <dfn id=dom-embed-getsvgdocument><code>getSVGDocument()</code></dfn> method must run
  14419. the following steps:</p>
  14420. <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
  14421. 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
  14422. 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
  14423. <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
  14424. 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
  14425. the <a href=#read-xml id=the-embed-element:read-xml>page load processing model for XML files</a> section because
  14426. <span>the sniffed type of the resource</span> in the <a href=#navigate id=the-embed-element:navigate-2>navigate</a> algorithm was
  14427. <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
  14428. steps.<li><p>Otherwise, return null.</ol>
  14429. <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
  14430. content attributes of the same name.</p>
  14431. <div class=example>
  14432. <p>Here's a way to embed a resource that requires a proprietary plugin, like Flash:</p>
  14433. <pre>&lt;embed src="catgame.swf"></pre>
  14434. <p>If the user does not have the plugin (for example if the plugin vendor doesn't support the
  14435. user's platform), then the user will be unable to use the resource.</p>
  14436. <p>To pass the plugin a parameter "quality" with the value "high", an attribute can be
  14437. specified:</p>
  14438. <pre>&lt;embed src="catgame.swf" quality="high"></pre>
  14439. <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
  14440. instead:</p>
  14441. <pre>&lt;object data="catgame.swf">
  14442. &lt;param name="quality" value="high">
  14443. &lt;/object></pre>
  14444. </div>
  14445. <h4 id=the-object-element>4.8.8 The <dfn><code>object</code></dfn> element</h4>
  14446. <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>
  14447. <pre class=idl>interface <dfn id=htmlobjectelement>HTMLObjectElement</dfn> : <a href=#htmlelement id=the-object-element:htmlelement>HTMLElement</a> {
  14448. attribute DOMString <a href=#dom-object-data id=the-object-element:dom-object-data>data</a>;
  14449. attribute DOMString <a href=#dom-object-type id=the-object-element:dom-object-type>type</a>;
  14450. attribute boolean <a href=#dom-object-typemustmatch id=the-object-element:dom-object-typemustmatch>typeMustMatch</a>;
  14451. attribute DOMString <a href=#dom-object-name id=the-object-element:dom-object-name>name</a>;
  14452. attribute DOMString <a href=#dom-object-usemap id=the-object-element:dom-object-usemap>useMap</a>;
  14453. 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>;
  14454. attribute DOMString <a href=#dom-dim-width id=the-object-element:dom-dim-width>width</a>;
  14455. attribute DOMString <a href=#dom-dim-height id=the-object-element:dom-dim-height>height</a>;
  14456. 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>;
  14457. 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>;
  14458. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-object-element:dom-cva-willvalidate>willValidate</a>;
  14459. 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>;
  14460. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-object-element:dom-cva-validationmessage>validationMessage</a>;
  14461. boolean <a href=#dom-cva-checkvalidity id=the-object-element:dom-cva-checkvalidity>checkValidity</a>();
  14462. boolean <a href=#dom-cva-reportvalidity id=the-object-element:dom-cva-reportvalidity>reportValidity</a>();
  14463. void <a href=#dom-cva-setcustomvalidity id=the-object-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  14464. <a href=#dom-object-caller id=the-object-element:dom-object-caller>legacycaller</a> any (any... arguments);
  14465. // <a href="#HTMLObjectElement-partial">also has obsolete members</a>
  14466. };</pre>
  14467. <p>Depending on the type of content instantiated by the
  14468. <code id=the-object-element:the-object-element><a href=#the-object-element>object</a></code> element, the node also supports other
  14469. interfaces.</p>
  14470. </dl>
  14471. <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
  14472. 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
  14473. context</a>, or as an external resource to be processed by a <a href=#plugin id=the-object-element:plugin>plugin</a>.</p>
  14474. <p>The <dfn id=attr-object-data><code>data</code></dfn> attribute, if present, specifies the
  14475. 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
  14476. surrounded by spaces</a>.</p>
  14477. <p class=warning>Authors who reference resources from other <a href=#origin-2 id=the-object-element:origin-2>origins</a>
  14478. 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
  14479. attribute, it is possible in certain cases for an attacker on the remote host to use the plugin
  14480. mechanism to run arbitrary scripts, even if the author has used features such as the Flash
  14481. "allowScriptAccess" parameter.</p>
  14482. <p>The <dfn id=attr-object-type><code>type</code></dfn> attribute, if present, specifies the
  14483. 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>
  14484. <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>
  14485. <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>
  14486. 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>
  14487. <p>The <dfn id=attr-object-typemustmatch><code>typemustmatch</code></dfn> attribute is a
  14488. <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
  14489. aforementioned resource match.</p>
  14490. <p>The <code id=the-object-element:attr-object-typemustmatch-3><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute must not be
  14491. 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>
  14492. <p>The <dfn id=attr-object-name><code>name</code></dfn> attribute, if present, must be a
  14493. <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
  14494. browsing context</a>, if applicable.</p>
  14495. <p>Whenever one of the following conditions occur:</p>
  14496. <ul><li>the element is created,
  14497. <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
  14498. parser</a> or <a href=#xml-parser id=the-object-element:xml-parser>XML parser</a>,
  14499. <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>
  14500. 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>,
  14501. <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>,
  14502. <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
  14503. <a href=#fallback-content id=the-object-element:fallback-content>fallback content</a>,
  14504. <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
  14505. removed,
  14506. <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
  14507. its <code id=the-object-element:attr-object-data-6><a href=#attr-object-data>data</a></code> attribute is set, changed, or removed,
  14508. <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
  14509. <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,
  14510. <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,
  14511. </ul>
  14512. <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
  14513. 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>
  14514. 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
  14515. 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>
  14516. <ol><li>
  14517. <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
  14518. content</a> be shown instead of the element's usual behavior, then jump to the step below
  14519. labeled <i>fallback</i>.</p>
  14520. <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
  14521. be shown because that content uses a format that the user finds more accessible.</p>
  14522. <li>
  14523. <p>If the element has an ancestor <a href=#media-element id=the-object-element:media-element>media element</a>, or has an ancestor
  14524. <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
  14525. 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
  14526. <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
  14527. 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
  14528. <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
  14529. rendered</a>, then jump to the step below labeled <i>fallback</i>.</p>
  14530. <li>
  14531. <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
  14532. 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>
  14533. suitable according to the value of the <code id=the-object-element:attr-object-classid-5><a href=#attr-object-classid>classid</a></code>
  14534. attribute, and either <a href=#sandboxPluginObject>plugins aren't being sandboxed</a> or that
  14535. <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
  14536. <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
  14537. <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
  14538. <a href=#plugin id=the-object-element:plugin-7>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>.</p>
  14539. <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
  14540. not the empty string, then:</p>
  14541. <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
  14542. not a type that the user agent supports, and is not a type that the user agent can find a
  14543. <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>
  14544. 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
  14545. <i>fallback</i>.<li>
  14546. <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
  14547. <a href=#browsing-context-scope-origin id=the-object-element:browsing-context-scope-origin>browsing context scope origin</a> if it has one.</p>
  14548. <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>
  14549. 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
  14550. <a href=#fetch id=the-object-element:fetch-2>fetched</a> (defined next) has been run.</p>
  14551. <p>For the purposes of the <a href=#application-cache id=the-object-element:application-cache>application cache</a> networking model, this
  14552. <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
  14553. end up being used for one after all, as defined below).</p>
  14554. <li><p>If the resource is not yet available (e.g. because the resource was not available in the
  14555. cache, so that loading the resource required making a request over the network), then jump to
  14556. the step below labeled <i>fallback</i>. The <a href=#concept-task id=the-object-element:concept-task-3>task</a> that is
  14557. <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
  14558. resource is available must restart this algorithm from this step. Resources can load
  14559. incrementally; user agents may opt to consider a resource "available" whenever enough data has
  14560. 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
  14561. 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
  14562. the step below labeled <i>fallback</i>.<li id=object-type-detection>
  14563. <p>Determine the <var>resource type</var>, as follows:</p>
  14564. <ol><li>
  14565. <p>Let the <var>resource type</var> be unknown.</p>
  14566. <li>
  14567. <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>
  14568. attribute and a <code id=the-object-element:attr-object-typemustmatch-4><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute, and
  14569. the resource has <a href=#content-type id=the-object-element:content-type-3>associated Content-Type metadata</a>, and the
  14570. type specified in <a href=#content-type id=the-object-element:content-type-4>the resource's Content-Type metadata</a> is
  14571. 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>
  14572. be that type and jump to the step below labeled <i>handler</i>.</p>
  14573. <li>
  14574. <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
  14575. labeled <i>handler</i>.</p>
  14576. <li>
  14577. <p>If the user agent is configured to strictly obey Content-Type headers for this resource,
  14578. and the resource has <a href=#content-type id=the-object-element:content-type-5>associated Content-Type metadata</a>,
  14579. 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
  14580. labeled <i>handler</i>.</p>
  14581. <p class=warning>This can introduce a vulnerability, wherein a site is trying to embed a
  14582. resource that uses a particular plugin, but the remote site overrides that and instead
  14583. furnishes the user agent with a resource that triggers a different plugin with different
  14584. security characteristics. </p>
  14585. <li>
  14586. <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
  14587. <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
  14588. 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
  14589. <i>handler</i>.</p>
  14590. <li>
  14591. <p>Run the appropriate set of steps from the following
  14592. list:</p>
  14593. <dl class=switch><dt>If the resource has <a href=#content-type id=the-object-element:content-type-7>associated Content-Type
  14594. metadata</a><dd>
  14595. <ol><li>
  14596. <p>Let <var>binary</var> be false.</p>
  14597. <li>
  14598. <p>If the type specified in <a href=#content-type id=the-object-element:content-type-8>the resource's Content-Type
  14599. 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
  14600. text or binary</a> to the resource is that the resource is not
  14601. <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>
  14602. <li>
  14603. <p>If the type specified in <a href=#content-type id=the-object-element:content-type-9>the resource's Content-Type
  14604. 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>
  14605. <li>
  14606. <p>If <var>binary</var> is false, then let the <var>resource
  14607. type</var> be the type specified in <a href=#content-type id=the-object-element:content-type-10>the resource's
  14608. Content-Type metadata</a>, and jump to the step below labeled <i>handler</i>.</p>
  14609. <li>
  14610. <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
  14611. <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>,
  14612. then run the following steps:</p>
  14613. <ol><li>
  14614. <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
  14615. attribute's value is a type that starts with "<code>image/</code>" that is
  14616. 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
  14617. type specified in that <code id=the-object-element:attr-object-type-13><a href=#attr-object-type>type</a></code> attribute.</p>
  14618. <li>
  14619. <p>Jump to the step below labeled <i>handler</i>.</p>
  14620. </ol>
  14621. </ol>
  14622. <dt>Otherwise, if the resource does not have <a href=#content-type id=the-object-element:content-type-11>associated
  14623. Content-Type metadata</a><dd>
  14624. <ol><li>
  14625. <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
  14626. <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
  14627. specified in that <code id=the-object-element:attr-object-type-15><a href=#attr-object-type>type</a></code> attribute.</p>
  14628. <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>
  14629. <li>
  14630. <p>If <var>tentative type</var> is <em>not</em>
  14631. <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
  14632. <var>tentative type</var> and jump to the step below labeled
  14633. <i>handler</i>.</p>
  14634. </ol>
  14635. </dl>
  14636. <li>
  14637. <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
  14638. 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>
  14639. supports, then let <var>resource type</var> be the type that that plugin can
  14640. handle.</p>
  14641. <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
  14642. "<code>.swf</code>".</p>
  14643. </ol>
  14644. <p class=note>It is possible for this step to finish, or for one of the substeps above to
  14645. jump straight to the next step, with <var>resource type</var> still being unknown. In
  14646. both cases, the next step will trigger fallback.</p>
  14647. <li><p><i>Handler</i>: Handle the content as given by the first of the following cases that
  14648. matches:</p>
  14649. <dl class=switch><dt>If the <var>resource type</var> is not a type that the user agent supports, but
  14650. it <em>is</em> a type that a <a href=#plugin id=the-object-element:plugin-12>plugin</a> supports<dd>
  14651. <p>If <a href=#sandboxPluginObject>plugins are being sandboxed</a> and the plugin that
  14652. 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>
  14653. <p>Otherwise, the user agent should <a href=#object-plugin>use the plugin that supports
  14654. <var>resource type</var></a> and pass the content of the resource to that
  14655. <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
  14656. below labeled <i>fallback</i>.</p>
  14657. <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>
  14658. does not start with "<code>image/</code>"<dd>
  14659. <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
  14660. browsing context</a>, if it does not already have one.</p>
  14661. <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
  14662. 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
  14663. <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
  14664. <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
  14665. get updated if the browsing context gets further navigated to other locations.)</p>
  14666. <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,
  14667. 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>
  14668. 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
  14669. <code id=the-object-element:about:blank-3><a href=#about:blank>about:blank</a></code> document itself.</span></p>
  14670. <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
  14671. context</a>.</p>
  14672. <p>If the <code id=the-object-element:attr-object-name-2><a href=#attr-object-name>name</a></code> attribute is present, the
  14673. <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,
  14674. 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>
  14675. <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
  14676. with a <code id=the-object-element:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute that points to a different
  14677. <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
  14678. as to load the resource afresh from the network or a different <a href=#application-cache id=the-object-element:application-cache-3>application
  14679. cache</a>. Even if the resource is then found to have a different type, it is still used
  14680. 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
  14681. is restarted, not this <code id=the-object-element:the-object-element-18><a href=#the-object-element>object</a></code> algorithm.</p>
  14682. <dt>If the <var>resource type</var> starts with "<code>image/</code>", and support
  14683. for images has not been disabled<dd>
  14684. <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
  14685. determine the type of the image.</p>
  14686. <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
  14687. not a <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-8>nested browsing context</a>.</p>
  14688. <p>If the image cannot be rendered, e.g. because it is malformed or in an unsupported
  14689. format, jump to the step below labeled <i>fallback</i>.</p>
  14690. <dt>Otherwise<dd>
  14691. <p>The given <var>resource type</var> is not supported. Jump to the step below
  14692. labeled <i>fallback</i>.</p>
  14693. <p class=note>If the previous step ended with the <var>resource type</var> being
  14694. unknown, this is the case that is triggered.</p>
  14695. </dl>
  14696. <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
  14697. represents.</p>
  14698. <li>
  14699. <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
  14700. <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
  14701. element.</p>
  14702. </ol>
  14703. <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
  14704. <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
  14705. <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
  14706. <a href=#plugin id=the-object-element:plugin-18>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>. Otherwise
  14707. 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
  14708. 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
  14709. 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
  14710. <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
  14711. unload it.</ol>
  14712. <p id=object-plugin>When the algorithm above instantiates a <a href=#plugin id=the-object-element:plugin-20>plugin</a>, the user agent
  14713. 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
  14714. element, in the order they were added to the element, with the attributes added by the parser
  14715. being ordered in source order, followed by a parameter named "PARAM" whose value is null, followed
  14716. by all the names and values of <a href=#concept-param-parameter id=the-object-element:concept-param-parameter>parameters</a> given by
  14717. <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
  14718. order</a>. If the <a href=#plugin id=the-object-element:plugin-22>plugin</a> supports a scriptable interface, the
  14719. <code id=the-object-element:htmlobjectelement><a href=#htmlobjectelement>HTMLObjectElement</a></code> object representing the element should expose that interface. The
  14720. <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
  14721. <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>
  14722. <p id=sandboxPluginObject>Plugins are considered sandboxed for the purpose of an
  14723. <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
  14724. 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
  14725. set</a>.</p>
  14726. <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
  14727. content</a>, used only when referenced resources can't be shown (e.g. because it returned a 404
  14728. 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,
  14729. targeting multiple user agents with different capabilities, with the user agent picking the first
  14730. one it supports.</p>
  14731. <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
  14732. <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>
  14733. 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
  14734. 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
  14735. <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>
  14736. 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
  14737. document.</p>
  14738. <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
  14739. section is the <a href=#dom-manipulation-task-source id=the-object-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  14740. <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
  14741. <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
  14742. <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
  14743. name</a> must be set to the empty string.</p>
  14744. <p>The <code id=the-object-element:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if present while the
  14745. <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
  14746. <a href=#image-map id=the-object-element:image-map-2>image map</a>. The attribute must be ignored if the
  14747. <code id=the-object-element:the-object-element-36><a href=#the-object-element>object</a></code> element doesn't represent an image.</p>
  14748. <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
  14749. <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>
  14750. <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
  14751. from constraint validation</a>.</p>
  14752. <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>
  14753. <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
  14754. content attributes of the same name. The <dfn id=dom-object-typemustmatch><code>typeMustMatch</code></dfn> IDL attribute must
  14755. <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
  14756. attribute. The <dfn id=dom-object-usemap><code>useMap</code></dfn> IDL attribute must
  14757. <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>
  14758. <p>The <dfn id=dom-object-contentdocument><code>contentDocument</code></dfn> IDL attribute
  14759. 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
  14760. <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
  14761. <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
  14762. 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>
  14763. <p>The <dfn id=dom-object-contentwindow><code>contentWindow</code></dfn> IDL attribute must
  14764. 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
  14765. browsing context</a>, if it has one; otherwise, it must return null.</p>
  14766. <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
  14767. <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
  14768. is part of the element's forms API.</p>
  14769. <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
  14770. 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
  14771. supports a scriptable interface that defines a legacy caller operation, then that must be the
  14772. behavior of the object's legacy caller operation. Otherwise, the object's legacy caller operation
  14773. must be to throw a <code id=the-object-element:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception.</p>
  14774. <div class=example>
  14775. <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>
  14776. element. (Generally speaking, it is better to avoid using applets like these and instead use
  14777. native JavaScript and HTML to provide the functionality, since that way the application will work
  14778. on all Web browsers without requiring a third-party plugin. Many devices, especially embedded
  14779. devices, do not support third-party technologies like Java.)</p>
  14780. <pre>&lt;figure>
  14781. &lt;object type="application/x-java-applet">
  14782. &lt;param name="code" value="MyJavaClass">
  14783. &lt;p>You do not have Java available, or it is disabled.&lt;/p>
  14784. &lt;/object>
  14785. &lt;figcaption>My Java Clock&lt;/figcaption>
  14786. &lt;/figure></pre>
  14787. </div>
  14788. <div class=example>
  14789. <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>
  14790. element.</p>
  14791. <pre>&lt;figure>
  14792. &lt;object data="clock.html">&lt;/object>
  14793. &lt;figcaption>My HTML Clock&lt;/figcaption>
  14794. &lt;/figure></pre>
  14795. </div>
  14796. <div class=example>
  14797. <p>The following example shows how a plugin can be used in HTML (in this case the Flash plugin,
  14798. to show a video file). Fallback is provided for users who do not have Flash enabled, in this case
  14799. 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
  14800. <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
  14801. nor a <code id=the-object-element:the-video-element-3><a href=#the-video-element>video</a></code>-capable browser.</p>
  14802. <pre>&lt;p>Look at my video:
  14803. &lt;object type="application/x-shockwave-flash">
  14804. &lt;param name=movie value="http://video.example.com/library/watch.swf">
  14805. &lt;param name=allowfullscreen value=true>
  14806. &lt;param name=flashvars value="http://video.example.com/vids/315981">
  14807. &lt;video controls src="http://video.example.com/vids/315981">
  14808. &lt;a href="http://video.example.com/vids/315981">View video&lt;/a>.
  14809. &lt;/video>
  14810. &lt;/object>
  14811. &lt;/p></pre>
  14812. </div>
  14813. <h4 id=the-param-element>4.8.9 The <dfn><code>param</code></dfn> element</h4>
  14814. <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>
  14815. <pre class=idl>interface <dfn id=htmlparamelement>HTMLParamElement</dfn> : <a href=#htmlelement id=the-param-element:htmlelement>HTMLElement</a> {
  14816. attribute DOMString <a href=#dom-param-name id=the-param-element:dom-param-name>name</a>;
  14817. attribute DOMString <a href=#dom-param-value id=the-param-element:dom-param-value>value</a>;
  14818. // <a href="#HTMLParamElement-partial">also has obsolete members</a>
  14819. };</pre>
  14820. </dl>
  14821. <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>
  14822. elements. It does not <a href=#represents id=the-param-element:represents>represent</a> anything on its own.</p>
  14823. <p>The <dfn id=attr-param-name><code>name</code></dfn> attribute gives the name of the
  14824. parameter.</p>
  14825. <p>The <dfn id=attr-param-value><code>value</code></dfn> attribute gives the value of the
  14826. parameter.</p>
  14827. <p>Both attributes must be present. They may have any value.</p>
  14828. <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
  14829. <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>
  14830. <p>If either the name or value of a <a href=#concept-param-parameter id=the-param-element:concept-param-parameter>parameter</a> defined
  14831. 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
  14832. <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
  14833. <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
  14834. 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
  14835. appropriately exercise that ability to notify the <a href=#plugin id=the-param-element:plugin-4>plugin</a> of the change.</p>
  14836. <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
  14837. content attributes of the same name.</p>
  14838. <div class=example>
  14839. <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
  14840. to a plugin, in this case the O3D plugin.</p>
  14841. <pre>&lt;!DOCTYPE HTML>
  14842. &lt;html lang="en">
  14843. &lt;head>
  14844. &lt;title>O3D Utah Teapot&lt;/title>
  14845. &lt;/head>
  14846. &lt;body>
  14847. &lt;p>
  14848. &lt;object type="application/vnd.o3d.auto">
  14849. <strong>&lt;param name="o3d_features" value="FloatingPointTextures"></strong>
  14850. &lt;img src="o3d-teapot.png"
  14851. title="3D Utah Teapot illustration rendered using O3D."
  14852. alt="When O3D renders the Utah Teapot, it appears as a squat
  14853. teapot with a shiny metallic finish on which the
  14854. surroundings are reflected, with a faint shadow caused by
  14855. the lighting.">
  14856. &lt;p>To see the teapot actually rendered by O3D on your
  14857. computer, please download and install the &lt;a
  14858. href="http://code.google.com/apis/o3d/docs/gettingstarted.html#install">O3D plugin&lt;/a>.&lt;/p>
  14859. &lt;/object>
  14860. &lt;script src="o3d-teapot.js">&lt;/script>
  14861. &lt;/p>
  14862. &lt;/body>
  14863. &lt;/html></pre>
  14864. </div>
  14865. <h4 id=the-video-element>4.8.10 The <dfn id=video><code>video</code></dfn> element</h4>
  14866. <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:
  14867. zero or more <code id=the-video-element:the-track-element><a href=#the-track-element>track</a></code> elements, then
  14868. <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
  14869. zero or more <code id=the-video-element:the-track-element-2><a href=#the-track-element>track</a></code> elements, then
  14870. <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>
  14871. <pre class=idl>interface <dfn id=htmlvideoelement>HTMLVideoElement</dfn> : <a href=#htmlmediaelement id=the-video-element:htmlmediaelement>HTMLMediaElement</a> {
  14872. attribute unsigned long <a href=#dom-dim-width id=the-video-element:dom-dim-width>width</a>;
  14873. attribute unsigned long <a href=#dom-dim-height id=the-video-element:dom-dim-height>height</a>;
  14874. readonly attribute unsigned long <a href=#dom-video-videowidth id=the-video-element:dom-video-videowidth>videoWidth</a>;
  14875. readonly attribute unsigned long <a href=#dom-video-videoheight id=the-video-element:dom-video-videoheight>videoHeight</a>;
  14876. attribute DOMString <a href=#dom-video-poster id=the-video-element:dom-video-poster>poster</a>;
  14877. };</pre>
  14878. </dl>
  14879. <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
  14880. captions.</p>
  14881. <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
  14882. should not show this content to the user; it is intended for older Web browsers which do
  14883. 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
  14884. users of these older browsers informing them of how to access the video contents.</p>
  14885. <p class=note>In particular, this content is not intended to address accessibility concerns. To
  14886. make video content accessible to the partially sighted, the blind, the hard-of-hearing, the deaf,
  14887. and those with other physical or cognitive disabilities, a variety of features are available.
  14888. Captions can be provided, either embedded in the video stream or as external files using the
  14889. <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
  14890. 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>
  14891. object. Audio descriptions can be provided, either as a separate track embedded in the video
  14892. 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
  14893. 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
  14894. synthesized into speech by the user agent. WebVTT can also be used to provide chapter titles. For
  14895. users who would rather not use a media element at all, transcripts or other textual alternatives
  14896. 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>
  14897. <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
  14898. ostensibly video data, possibly with associated audio data.</p>
  14899. <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>,
  14900. <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>
  14901. attributes are <a href=#media-element-attributes id=the-video-element:media-element-attributes>the attributes common to all media
  14902. elements</a>.</p>
  14903. <p>The <dfn id=attr-video-poster><code>poster</code></dfn> attribute gives the address of an
  14904. image file that the user agent can show while no video data is available. The attribute, if
  14905. 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>
  14906. <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
  14907. run the following steps to determine the element's <dfn id=poster-frame>poster frame</dfn> (regardless of the
  14908. value of the element's <a href=#show-poster-flag id=the-video-element:show-poster-flag>show poster flag</a>):</p>
  14909. <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>
  14910. element, abort that instance of this algorithm without changing the <a href=#poster-frame id=the-video-element:poster-frame>poster
  14911. 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
  14912. 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
  14913. 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,
  14914. 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
  14915. <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
  14916. 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,
  14917. there is no <a href=#poster-frame id=the-video-element:poster-frame-5>poster frame</a>.</ol>
  14918. <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,
  14919. 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
  14920. video (typically one of the first non-blank frames) that gives the user an idea of what the video
  14921. is like.</p>
  14922. <hr>
  14923. <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
  14924. list below:</p>
  14925. <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
  14926. 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
  14927. 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,
  14928. 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,
  14929. 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,
  14930. 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
  14931. frame of video corresponding to the <a href=#current-playback-position id=the-video-element:current-playback-position-2>current playback
  14932. 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
  14933. 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
  14934. 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
  14935. 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
  14936. increasing <a href=#current-playback-position id=the-video-element:current-playback-position-4>"current" position</a>. When the
  14937. <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
  14938. 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
  14939. must be rendered.</dl>
  14940. <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
  14941. step 1.</p>
  14942. <p class=note>Which frame in a video stream corresponds to a particular playback position is
  14943. defined by the video stream's format.</p>
  14944. <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
  14945. <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
  14946. 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>
  14947. <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
  14948. 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
  14949. 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
  14950. 1.</p>
  14951. <p>In addition to the above, the user agent may provide messages to the user (such as "buffering",
  14952. "no video loaded", "error", or more detailed information) by overlaying text or icons on the video
  14953. or other areas of the element's playback area, or in another appropriate manner.</p>
  14954. <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
  14955. data itself.</p>
  14956. <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
  14957. 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
  14958. <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width>intrinsic width</a>, whose height is the
  14959. <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
  14960. 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
  14961. (e.g. when the video is seeking or buffering) its previous appearance, if any, or else (e.g.
  14962. because the video is still loading the first frame) blackness.</p>
  14963. <hr>
  14964. <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>
  14965. <p>These attributes return the intrinsic dimensions of the video,
  14966. or zero if the dimensions are not known.</p>
  14967. </dl>
  14968. <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>
  14969. are the dimensions of the resource in CSS pixels after taking into account the resource's
  14970. dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the format used
  14971. by the resource. If an anamorphic format does not define how to apply the aspect ratio to the
  14972. video data's dimensions to obtain the "correct" dimensions, then the user agent must apply the
  14973. ratio by increasing one dimension and leaving the other unchanged.</p>
  14974. <p>The <dfn id=dom-video-videowidth><code>videoWidth</code></dfn> IDL attribute must return
  14975. 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.
  14976. The <dfn id=dom-video-videoheight><code>videoHeight</code></dfn> IDL attribute must return
  14977. the <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height-2>intrinsic height</a> of the video in CSS
  14978. 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>
  14979. <p id=dimUpdate>Whenever the <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width-3>intrinsic width</a>
  14980. or <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height-3>intrinsic height</a> of the video changes
  14981. (including, for example, because the <a href=#dom-videotrack-selected id=the-video-element:dom-videotrack-selected-2>selected video
  14982. 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>
  14983. 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
  14984. <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>
  14985. <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>
  14986. <p>In the absence of style rules to the contrary, video content should be rendered inside the
  14987. element's playback area such that the video content is shown centered in the playback area at the
  14988. largest possible size that fits completely within it, with the video content's aspect ratio being
  14989. preserved. Thus, if the aspect ratio of the playback area does not match the aspect ratio of the
  14990. video, the video will be shown letterboxed or pillarboxed. Areas of the element's playback area
  14991. that do not contain the video represent nothing.</p>
  14992. <p class=note>In user agents that implement CSS, the above requirement can be implemented by
  14993. using the <a href=#video-object-fit>style rule suggested in the rendering section</a>.</p>
  14994. <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
  14995. the <a href=#poster-frame id=the-video-element:poster-frame-9>poster frame</a>, if that is available and the element currently
  14996. <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
  14997. available; otherwise the intrinsic width is missing.</p>
  14998. <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
  14999. the <a href=#poster-frame id=the-video-element:poster-frame-10>poster frame</a>, if that is available and the element currently
  15000. <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
  15001. available; otherwise the intrinsic height is missing.</p>
  15002. <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
  15003. pixels. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  15004. <hr>
  15005. <p>User agents should provide controls to enable or disable the display of closed captions, audio
  15006. description tracks, and other additional data associated with the video stream, though such
  15007. features should, again, not interfere with the page's normal rendering.</p>
  15008. <p>User agents may allow users to view the video content in manners more suitable to the user
  15009. (e.g. full-screen or in an independent resizable window). As for the other user interface
  15010. features, controls to enable this should not interfere with the page's normal rendering unless the
  15011. 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>.
  15012. In such an independent context, however, user agents may make full user interfaces visible, with,
  15013. 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>
  15014. <p>User agents may allow video playback to affect system features that could interfere with the
  15015. user's experience; for example, user agents could disable screensavers while video playback is in
  15016. progress.</p>
  15017. <hr>
  15018. <p>The <dfn id=dom-video-poster><code>poster</code></dfn> IDL attribute must
  15019. <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>
  15020. <div class=example>
  15021. <p>This example shows how to detect when a video has failed to play correctly:</p>
  15022. <pre>&lt;script>
  15023. function failed(e) {
  15024. // video playback failed - show a message saying why
  15025. switch (e.target.error.code) {
  15026. case e.target.error.MEDIA_ERR_ABORTED:
  15027. alert('You aborted the video playback.');
  15028. break;
  15029. case e.target.error.MEDIA_ERR_NETWORK:
  15030. alert('A network error caused the video download to fail part-way.');
  15031. break;
  15032. case e.target.error.MEDIA_ERR_DECODE:
  15033. alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
  15034. break;
  15035. case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
  15036. alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
  15037. break;
  15038. default:
  15039. alert('An unknown error occurred.');
  15040. break;
  15041. }
  15042. }
  15043. &lt;/script>
  15044. &lt;p>&lt;video src="tgif.vid" autoplay controls onerror="failed(event)">&lt;/video>&lt;/p>
  15045. &lt;p>&lt;a href="tgif.vid">Download the video file&lt;/a>.&lt;/p></pre>
  15046. </div>
  15047. <h4 id=the-audio-element>4.8.11 The <dfn id=audio><code>audio</code></dfn> element</h4>
  15048. <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:
  15049. zero or more <code id=the-audio-element:the-track-element><a href=#the-track-element>track</a></code> elements, then
  15050. <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
  15051. zero or more <code id=the-audio-element:the-track-element-2><a href=#the-track-element>track</a></code> elements, then
  15052. <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>
  15053. <pre class=idl>[NamedConstructor=<a href=#dom-audio id=the-audio-element:dom-audio>Audio</a>(optional DOMString src)]
  15054. interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediaelement id=the-audio-element:htmlmediaelement>HTMLMediaElement</a> {};</pre>
  15055. </dl>
  15056. <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>
  15057. <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
  15058. should not show this content to the user; it is intended for older Web browsers which do
  15059. 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
  15060. users of these older browsers informing them of how to access the audio contents.</p>
  15061. <p class=note>In particular, this content is not intended to address accessibility concerns. To
  15062. make audio content accessible to the deaf or to those with other physical or cognitive
  15063. disabilities, a variety of features are available. If captions or a sign language video are
  15064. 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
  15065. play the audio, allowing users to enable the visual alternatives. Chapter titles can be provided
  15066. 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,
  15067. naturally, transcripts or other textual alternatives can be provided by simply linking to them in
  15068. 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>
  15069. <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
  15070. ostensibly audio data.</p>
  15071. <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>,
  15072. <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>
  15073. attributes are <a href=#media-element-attributes id=the-audio-element:media-element-attributes>the attributes common to all media
  15074. elements</a>.</p>
  15075. <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
  15076. 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
  15077. <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
  15078. were enabled when the <a href=#event-loop id=the-audio-element:event-loop>event loop</a> last reached step 1.</p>
  15079. <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
  15080. for the element.</p>
  15081. <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>
  15082. <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>
  15083. attribute set to the value passed in the argument, if applicable.</p>
  15084. </dl>
  15085. <p>A constructor is provided for creating <code id=the-audio-element:htmlaudioelement><a href=#htmlaudioelement>HTMLAudioElement</a></code> objects (in addition to
  15086. 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
  15087. 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>
  15088. 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>
  15089. 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
  15090. <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
  15091. <a href=#concept-media-load-algorithm id=the-audio-element:concept-media-load-algorithm>resource selection algorithm</a> before returning).
  15092. 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
  15093. 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
  15094. constructor is found.</p>
  15095. <h4 id=the-source-element>4.8.12 The <dfn><code>source</code></dfn> element</h4>
  15096. <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>
  15097. 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>
  15098. <pre class=idl>interface <dfn id=htmlsourceelement>HTMLSourceElement</dfn> : <a href=#htmlelement id=the-source-element:htmlelement>HTMLElement</a> {
  15099. attribute DOMString <a href=#dom-source-src id=the-source-element:dom-source-src>src</a>;
  15100. attribute DOMString <a href=#dom-source-type id=the-source-element:dom-source-type>type</a>;
  15101. // <a href="#the-source-element-when-used-with-the-picture-element:htmlsourceelement">also has obsolete members</a>
  15102. };</pre>
  15103. </dl>
  15104. <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
  15105. elements</a>. It does not <a href=#represents id=the-source-element:represents>represent</a> anything on its own.</p>
  15106. <p>The <dfn id=attr-source-src><code>src</code></dfn> attribute gives the address of the
  15107. <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
  15108. by spaces</a>. This attribute must be present.</p>
  15109. <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
  15110. 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
  15111. 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
  15112. 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
  15113. 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
  15114. been parsed is an unnecessarily complicated approach.</p>
  15115. <p>The <dfn id=attr-source-type><code>type</code></dfn> attribute gives the type of the
  15116. <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
  15117. 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
  15118. type</a>. The <code>codecs</code> parameter, which certain MIME types define, might be
  15119. necessary to specify exactly how the resource is encoded. <a href=#refsRFC4281>[RFC4281]</a></p>
  15120. <div class=example>
  15121. <p>The following list shows some examples of how to use the <code>codecs=</code> MIME
  15122. parameter in the <code id=the-source-element:attr-source-type-2><a href=#attr-source-type>type</a></code> attribute.</p>
  15123. <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>&lt;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>&lt;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>&lt;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>&lt;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>&lt;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>&lt;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>&lt;source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'></pre><dt>Theora video and Vorbis audio in Ogg container<dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'></pre><dt>Theora video and Speex audio in Ogg container<dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="theora, speex"'></pre><dt>Vorbis audio alone in Ogg container<dd><pre>&lt;source src='audio.ogg' type='audio/ogg; codecs=vorbis'></pre><dt>Speex audio alone in Ogg container<dd><pre>&lt;source src='audio.spx' type='audio/ogg; codecs=speex'></pre><dt>FLAC audio alone in Ogg container<dd><pre>&lt;source src='audio.oga' type='audio/ogg; codecs=flac'></pre><dt>Dirac video and Vorbis audio in Ogg container<dd><pre>&lt;source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'></pre></dl>
  15124. </div>
  15125. <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
  15126. 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
  15127. element</a>'s <a href=#concept-media-load-algorithm id=the-source-element:concept-media-load-algorithm>resource selection
  15128. algorithm</a>.</p>
  15129. <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
  15130. attributes of the same name.</p>
  15131. <div class=example>
  15132. <p>If the author isn't sure if user agents will all be able to render the media resources
  15133. 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
  15134. <code id=the-source-element:the-source-element-5><a href=#the-source-element>source</a></code> element and trigger fallback behavior:</p>
  15135. <pre>&lt;script>
  15136. function fallback(video) {
  15137. // replace &lt;video> with its contents
  15138. while (video.hasChildNodes()) {
  15139. if (video.firstChild instanceof HTMLSourceElement)
  15140. video.removeChild(video.firstChild);
  15141. else
  15142. video.parentNode.insertBefore(video.firstChild, video);
  15143. }
  15144. video.parentNode.removeChild(video);
  15145. }
  15146. &lt;/script>
  15147. &lt;video controls autoplay>
  15148. &lt;source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  15149. &lt;source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'
  15150. onerror="fallback(parentNode)">
  15151. ...
  15152. &lt;/video></pre>
  15153. </div>
  15154. <h4 id=the-track-element>4.8.13 The <dfn><code>track</code></dfn> element</h4>
  15155. <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>
  15156. <pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement id=the-track-element:htmlelement>HTMLElement</a> {
  15157. attribute DOMString <a href=#dom-track-kind id=the-track-element:dom-track-kind>kind</a>;
  15158. attribute DOMString <a href=#dom-track-src id=the-track-element:dom-track-src>src</a>;
  15159. attribute DOMString <a href=#dom-track-srclang id=the-track-element:dom-track-srclang>srclang</a>;
  15160. attribute DOMString <a href=#dom-track-label id=the-track-element:dom-track-label>label</a>;
  15161. attribute boolean <a href=#dom-track-default id=the-track-element:dom-track-default>default</a>;
  15162. const unsigned short <a href=#dom-track-none id=the-track-element:dom-track-none>NONE</a> = 0;
  15163. const unsigned short <a href=#dom-track-loading id=the-track-element:dom-track-loading>LOADING</a> = 1;
  15164. const unsigned short <a href=#dom-track-loaded id=the-track-element:dom-track-loaded>LOADED</a> = 2;
  15165. const unsigned short <a href=#dom-track-error id=the-track-element:dom-track-error>ERROR</a> = 3;
  15166. readonly attribute unsigned short <a href=#dom-track-readystate id=the-track-element:dom-track-readystate>readyState</a>;
  15167. 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>;
  15168. };</pre>
  15169. </dl>
  15170. <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
  15171. does not <a href=#represents id=the-track-element:represents>represent</a> anything on its own.</p>
  15172. <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
  15173. attribute</a>. The following table lists the keywords defined for this attribute. The keyword
  15174. given in the first cell of each row maps to the state given in the second cell.</p>
  15175. <table><thead><tr><th>Keyword
  15176. <th>State
  15177. <th>Brief description
  15178. <tbody><tr><td><dfn id=attr-track-kind-keyword-subtitles><code>subtitles</code></dfn>
  15179. <td><dfn id=attr-track-kind-subtitles>Subtitles</dfn>
  15180. <td>
  15181. 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).
  15182. Overlaid on the video.
  15183. <tr><td><dfn id=attr-track-kind-keyword-captions><code>captions</code></dfn>
  15184. <td><dfn id=attr-track-kind-captions>Captions</dfn>
  15185. <td>
  15186. 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).
  15187. Overlaid on the video; labeled as appropriate for the hard-of-hearing.
  15188. <tr><td><dfn id=attr-track-kind-keyword-descriptions><code>descriptions</code></dfn>
  15189. <td><dfn id=attr-track-kind-descriptions>Descriptions</dfn>
  15190. <td>
  15191. 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).
  15192. Synthesized as audio.
  15193. <tr><td><dfn id=attr-track-kind-keyword-chapters><code>chapters</code></dfn>
  15194. <td><dfn id=attr-track-kind-chapters>Chapters</dfn>
  15195. <td>
  15196. Chapter titles, intended to be used for navigating the <a href=#media-resource id=the-track-element:media-resource-3>media resource</a>.
  15197. Displayed as an interactive (potentially nested) list in the user agent's interface.
  15198. <tr><td><dfn id=attr-track-kind-keyword-metadata><code>metadata</code></dfn>
  15199. <td><dfn id=attr-track-kind-metadata>Metadata</dfn>
  15200. <td>
  15201. Tracks intended for use from script.
  15202. Not displayed by the user agent.
  15203. </table>
  15204. <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>
  15205. <p>The <dfn id=attr-track-src><code>src</code></dfn> attribute gives the address of the text
  15206. 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>.
  15207. This attribute must be present.</p>
  15208. <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
  15209. 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
  15210. 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
  15211. URL</a> is the empty string.</p>
  15212. <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
  15213. <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>
  15214. <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
  15215. 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
  15216. <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
  15217. cues</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  15218. <p>The <dfn id=attr-track-srclang><code>srclang</code></dfn> attribute gives the language of
  15219. the text track data. The value must be a valid BCP 47 language tag. This attribute must be present
  15220. 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>
  15221. <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
  15222. not the empty string, then the element's <dfn id=track-language>track language</dfn> is the value of the attribute.
  15223. Otherwise, the element has no <a href=#track-language id=the-track-element:track-language>track language</a>.</p>
  15224. <p>The <dfn id=attr-track-label><code>label</code></dfn> attribute gives a user-readable
  15225. 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>
  15226. <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
  15227. 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>
  15228. 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
  15229. 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
  15230. again both missing or both have the same value.</p>
  15231. <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
  15232. the empty string, then the element's <dfn id=track-label>track label</dfn> is the value of the attribute.
  15233. Otherwise, the element's <a href=#track-label id=the-track-element:track-label>track label</a> is an empty string.</p>
  15234. <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
  15235. attribute</a>, which, if specified, indicates that the track is to be enabled if the user's
  15236. preferences do not indicate that another track would be more appropriate.</p>
  15237. <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
  15238. 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>
  15239. <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
  15240. 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>
  15241. <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
  15242. 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>
  15243. <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>
  15244. <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>
  15245. <p>Returns the <a href=#text-track-readiness-state id=the-track-element:text-track-readiness-state>text track readiness state</a>,
  15246. represented by a number from the following list:</p>
  15247. <dl><dt><var>track</var> . <code id=the-track-element:dom-track-none-2><a href=#dom-track-none>NONE</a></code> (0)<dd>
  15248. <p>The <a href=#text-track-not-loaded id=the-track-element:text-track-not-loaded>text track not loaded</a> state.</p>
  15249. <dt><var>track</var> . <code id=the-track-element:dom-track-loading-2><a href=#dom-track-loading>LOADING</a></code> (1)<dd>
  15250. <p>The <a href=#text-track-loading id=the-track-element:text-track-loading>text track loading</a> state.</p>
  15251. <dt><var>track</var> . <code id=the-track-element:dom-track-loaded-2><a href=#dom-track-loaded>LOADED</a></code> (2)<dd>
  15252. <p>The <a href=#text-track-loaded id=the-track-element:text-track-loaded>text track loaded</a> state.</p>
  15253. <dt><var>track</var> . <code id=the-track-element:dom-track-error-2><a href=#dom-track-error>ERROR</a></code> (3)<dd>
  15254. <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>
  15255. </dl>
  15256. <dt><var>track</var> . <code id=the-track-element:dom-track-track-2><a href=#dom-track-track>track</a></code><dd>
  15257. <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>
  15258. </dl>
  15259. <p>The <dfn id=dom-track-readystate><code>readyState</code></dfn> attribute must return the
  15260. 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
  15261. <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>
  15262. <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>
  15263. <p>The <dfn id=dom-track-track><code>track</code></dfn> IDL attribute must, on getting,
  15264. 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
  15265. <code id=the-track-element:texttrack-3><a href=#texttrack>TextTrack</a></code> object.</p>
  15266. <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
  15267. 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
  15268. 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>
  15269. <div class=example>
  15270. <p>This video has subtitles in several languages:</p>
  15271. <pre>&lt;video src="brave.webm">
  15272. &lt;track kind=subtitles src=brave.en.vtt srclang=en label="English">
  15273. &lt;track kind=captions src=brave.en.hoh.vtt srclang=en label="English for the Hard of Hearing">
  15274. &lt;track kind=subtitles src=brave.fr.vtt srclang=fr lang=fr label="Français">
  15275. &lt;track kind=subtitles src=brave.de.vtt srclang=de lang=de label="Deutsch">
  15276. &lt;/video></pre>
  15277. <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
  15278. 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
  15279. 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>
  15280. </div>
  15281. <h4 id=media-elements>4.8.14 Media elements</h4>
  15282. <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
  15283. this specification) implement the following interface:</p>
  15284. <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>" };
  15285. 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>;
  15286. interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement id=media-elements:htmlelement>HTMLElement</a> {
  15287. // error state
  15288. readonly attribute <a href=#mediaerror id=media-elements:mediaerror>MediaError</a>? <a href=#dom-media-error id=media-elements:dom-media-error>error</a>;
  15289. // network state
  15290. attribute DOMString <a href=#dom-media-src id=media-elements:dom-media-src>src</a>;
  15291. attribute <a href=#mediaprovider id=media-elements:mediaprovider>MediaProvider</a>? <a href=#dom-media-srcobject id=media-elements:dom-media-srcobject>srcObject</a>;
  15292. readonly attribute DOMString <a href=#dom-media-currentsrc id=media-elements:dom-media-currentsrc>currentSrc</a>;
  15293. attribute DOMString? <a href=#dom-media-crossorigin id=media-elements:dom-media-crossorigin>crossOrigin</a>;
  15294. const unsigned short <a href=#dom-media-network_empty id=media-elements:dom-media-network_empty>NETWORK_EMPTY</a> = 0;
  15295. const unsigned short <a href=#dom-media-network_idle id=media-elements:dom-media-network_idle>NETWORK_IDLE</a> = 1;
  15296. const unsigned short <a href=#dom-media-network_loading id=media-elements:dom-media-network_loading>NETWORK_LOADING</a> = 2;
  15297. const unsigned short <a href=#dom-media-network_no_source id=media-elements:dom-media-network_no_source>NETWORK_NO_SOURCE</a> = 3;
  15298. readonly attribute unsigned short <a href=#dom-media-networkstate id=media-elements:dom-media-networkstate>networkState</a>;
  15299. attribute DOMString <a href=#dom-media-preload id=media-elements:dom-media-preload>preload</a>;
  15300. readonly attribute <a href=#timeranges id=media-elements:timeranges>TimeRanges</a> <a href=#dom-media-buffered id=media-elements:dom-media-buffered>buffered</a>;
  15301. void <a href=#dom-media-load id=media-elements:dom-media-load>load</a>();
  15302. <a href=#canplaytyperesult id=media-elements:canplaytyperesult>CanPlayTypeResult</a> <a href=#dom-navigator-canplaytype id=media-elements:dom-navigator-canplaytype>canPlayType</a>(DOMString type);
  15303. // ready state
  15304. const unsigned short <a href=#dom-media-have_nothing id=media-elements:dom-media-have_nothing>HAVE_NOTHING</a> = 0;
  15305. const unsigned short <a href=#dom-media-have_metadata id=media-elements:dom-media-have_metadata>HAVE_METADATA</a> = 1;
  15306. const unsigned short <a href=#dom-media-have_current_data id=media-elements:dom-media-have_current_data>HAVE_CURRENT_DATA</a> = 2;
  15307. const unsigned short <a href=#dom-media-have_future_data id=media-elements:dom-media-have_future_data>HAVE_FUTURE_DATA</a> = 3;
  15308. const unsigned short <a href=#dom-media-have_enough_data id=media-elements:dom-media-have_enough_data>HAVE_ENOUGH_DATA</a> = 4;
  15309. readonly attribute unsigned short <a href=#dom-media-readystate id=media-elements:dom-media-readystate>readyState</a>;
  15310. readonly attribute boolean <a href=#dom-media-seeking id=media-elements:dom-media-seeking>seeking</a>;
  15311. // playback state
  15312. attribute double <a href=#dom-media-currenttime id=media-elements:dom-media-currenttime>currentTime</a>;
  15313. void <a href=#dom-media-fastseek id=media-elements:dom-media-fastseek>fastSeek</a>(double time);
  15314. readonly attribute unrestricted double <a href=#dom-media-duration id=media-elements:dom-media-duration>duration</a>;
  15315. <a href=#idl-date id=media-elements:idl-date>Date</a> <a href=#dom-media-getstartdate id=media-elements:dom-media-getstartdate>getStartDate</a>();
  15316. readonly attribute boolean <a href=#dom-media-paused id=media-elements:dom-media-paused>paused</a>;
  15317. attribute double <a href=#dom-media-defaultplaybackrate id=media-elements:dom-media-defaultplaybackrate>defaultPlaybackRate</a>;
  15318. attribute double <a href=#dom-media-playbackrate id=media-elements:dom-media-playbackrate>playbackRate</a>;
  15319. 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>;
  15320. 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>;
  15321. readonly attribute boolean <a href=#dom-media-ended id=media-elements:dom-media-ended>ended</a>;
  15322. attribute boolean <a href=#dom-media-autoplay id=media-elements:dom-media-autoplay>autoplay</a>;
  15323. attribute boolean <a href=#dom-media-loop id=media-elements:dom-media-loop>loop</a>;
  15324. void <a href=#dom-media-play id=media-elements:dom-media-play>play</a>();
  15325. void <a href=#dom-media-pause id=media-elements:dom-media-pause>pause</a>();
  15326. // media controller
  15327. attribute DOMString <a href=#dom-media-mediagroup id=media-elements:dom-media-mediagroup>mediaGroup</a>;
  15328. attribute <a href=#mediacontroller id=media-elements:mediacontroller>MediaController</a>? <a href=#dom-media-controller id=media-elements:dom-media-controller>controller</a>;
  15329. // controls
  15330. attribute boolean <a href=#dom-media-controls id=media-elements:dom-media-controls>controls</a>;
  15331. attribute double <a href=#dom-media-volume id=media-elements:dom-media-volume>volume</a>;
  15332. attribute boolean <a href=#dom-media-muted id=media-elements:dom-media-muted>muted</a>;
  15333. attribute boolean <a href=#dom-media-defaultmuted id=media-elements:dom-media-defaultmuted>defaultMuted</a>;
  15334. // tracks
  15335. readonly attribute <a href=#audiotracklist id=media-elements:audiotracklist>AudioTrackList</a> <a href=#dom-media-audiotracks id=media-elements:dom-media-audiotracks>audioTracks</a>;
  15336. readonly attribute <a href=#videotracklist id=media-elements:videotracklist>VideoTrackList</a> <a href=#dom-media-videotracks id=media-elements:dom-media-videotracks>videoTracks</a>;
  15337. readonly attribute <a href=#texttracklist id=media-elements:texttracklist>TextTrackList</a> <a href=#dom-media-texttracks id=media-elements:dom-media-texttracks>textTracks</a>;
  15338. <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 = "");
  15339. };</pre>
  15340. <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>,
  15341. <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>,
  15342. <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
  15343. elements</a>. They are defined in this section.</p>
  15344. <p><a href=#media-element id=media-elements:media-element-2>Media elements</a> are used to present audio data, or video and
  15345. audio data, to the user. This is referred to as <dfn id=media-data>media data</dfn> in this section, since this
  15346. section applies equally to <a href=#media-element id=media-elements:media-element-3>media elements</a> for audio or for
  15347. video.
  15348. The term <dfn id=media-resource>media resource</dfn> is used to refer to the complete set of media data, e.g. the
  15349. complete video file, or complete audio file.
  15350. </p>
  15351. <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
  15352. <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
  15353. 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
  15354. 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
  15355. 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
  15356. reached step 1.</p>
  15357. <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
  15358. 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
  15359. 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>
  15360. element does.</p>
  15361. <p>Except where otherwise explicitly specified, the <a href=#task-source id=media-elements:task-source>task source</a> for all the tasks
  15362. <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
  15363. element event task source</dfn> of the <a href=#media-element id=media-elements:media-element-5>media element</a> in question.</p>
  15364. <h5 id=error-codes>4.8.14.1 Error codes</h5>
  15365. <dl class=domintro><dt><var>media</var> . <code id=error-codes:dom-media-error><a href=#dom-media-error>error</a></code><dd>
  15366. <p>Returns a <code id=error-codes:mediaerror><a href=#mediaerror>MediaError</a></code> object representing the current error state of the
  15367. element.</p>
  15368. <p>Returns null if there is no error.</p>
  15369. </dl>
  15370. <p>All <a href=#media-element id=error-codes:media-element>media elements</a> have an associated error status, which
  15371. 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
  15372. <dfn id=dom-media-error><code>error</code></dfn> attribute, on getting, must return the
  15373. <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
  15374. error.</p>
  15375. <pre class=idl>interface <dfn id=mediaerror>MediaError</dfn> {
  15376. const unsigned short <a href=#dom-mediaerror-media_err_aborted id=error-codes:dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a> = 1;
  15377. const unsigned short <a href=#dom-mediaerror-media_err_network id=error-codes:dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a> = 2;
  15378. const unsigned short <a href=#dom-mediaerror-media_err_decode id=error-codes:dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a> = 3;
  15379. 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;
  15380. readonly attribute unsigned short <a href=#dom-mediaerror-code id=error-codes:dom-mediaerror-code>code</a>;
  15381. };</pre>
  15382. <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>
  15383. <p>Returns the current error's error code, from the list below.</p>
  15384. </dl>
  15385. <p>The <dfn id=dom-mediaerror-code><code>code</code></dfn> attribute of a
  15386. <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
  15387. following:</p>
  15388. <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
  15389. 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
  15390. 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
  15391. 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>
  15392. attribute or <a href=#assigned-media-provider-object id=error-codes:assigned-media-provider-object>assigned media provider object</a> was not suitable.</dl>
  15393. <h5 id=location-of-the-media-resource>4.8.14.2 Location of the media resource</h5>
  15394. <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
  15395. 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
  15396. spaces</a>.</p>
  15397. <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
  15398. 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
  15399. specified.</p>
  15400. <p>The <dfn id=attr-media-crossorigin><code>crossorigin</code></dfn> content attribute on
  15401. <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>
  15402. <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
  15403. <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
  15404. <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
  15405. algorithm</a>.</p>
  15406. <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
  15407. 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
  15408. 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
  15409. 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>
  15410. <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
  15411. name.</p>
  15412. <p>The <dfn id=dom-media-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
  15413. <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>
  15414. <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>,
  15415. 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>
  15416. 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>
  15417. <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
  15418. <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
  15419. <a href=#assigned-media-provider-object id=location-of-the-media-resource:assigned-media-provider-object>assigned media provider object</a>.</p>
  15420. <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>
  15421. <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>
  15422. <dt><var>media</var> . <code id=location-of-the-media-resource:dom-media-currentsrc><a href=#dom-media-currentsrc>currentSrc</a></code><dd>
  15423. <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>
  15424. <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>
  15425. </dl>
  15426. <p>The <dfn id=dom-media-currentsrc><code>currentSrc</code></dfn> IDL attribute must initially be set to
  15427. 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
  15428. selection algorithm</a> defined below.</p>
  15429. <p>The <dfn id=dom-media-srcobject><code>srcObject</code></dfn> IDL attribute, on getting,
  15430. 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.
  15431. 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
  15432. 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>
  15433. <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
  15434. attribute takes priority, followed by the content attribute, followed by the elements.</p>
  15435. <h5 id=mime-types>4.8.14.3 MIME types</h5>
  15436. <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
  15437. <a href=#mime-type id=mime-types:mime-type>MIME type</a>, in some cases with a <code>codecs</code> parameter. (Whether the
  15438. <code>codecs</code> parameter is allowed or not depends on the MIME type.) <a href=#refsRFC4281>[RFC4281]</a></p>
  15439. <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
  15440. type like "<code>video/mp4; codecs="avc1.42E01E, mp4a.40.2"</code>" doesn't
  15441. include information like the actual bitrate (only the maximum bitrate). Thus, given a type, a user
  15442. agent can often only know whether it <em>might</em> be able to play media of that type (with
  15443. varying levels of confidence), or whether it definitely <em>cannot</em> play media of that
  15444. type.</p>
  15445. <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
  15446. that the user agent definitely does not support, for example because it doesn't recognise the
  15447. container type, or it doesn't support the listed codecs.</p>
  15448. <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
  15449. <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
  15450. as equivalent to the lack of any explicit <a href=#content-type id=mime-types:content-type>Content-Type metadata</a>
  15451. when it is used to label a potential <a href=#media-resource id=mime-types:media-resource-2>media resource</a>.</p>
  15452. <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
  15453. parameters is special-cased here; if any parameter appears with it, it will be treated just like
  15454. 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>
  15455. <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>
  15456. <p>Returns the empty string (a negative response), "maybe", or "probably" based on how confident
  15457. the user agent is that it can play media resources of the given type.</p>
  15458. </dl>
  15459. <p>The <dfn id=dom-navigator-canplaytype><code>canPlayType(<var>type</var>)</code></dfn> method must return <dfn id=dom-canplaytyperesult-nil>the
  15460. 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
  15461. 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
  15462. 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
  15463. <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
  15464. to return "<code id=mime-types:dom-canplaytyperesult-maybe><a href=#dom-canplaytyperesult-maybe>maybe</a></code>" unless the type can be
  15465. confidently established as being supported or not. Generally, a user agent should never return
  15466. "<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>
  15467. <div class=example>
  15468. <p>This script tests to see if the user agent supports a (fictional) new format to dynamically
  15469. 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>
  15470. <pre>&lt;section id="video">
  15471. &lt;p>&lt;a href="playing-cats.nfv">Download video&lt;/a>&lt;/p>
  15472. &lt;/section>
  15473. &lt;script>
  15474. var videoSection = document.getElementById('video');
  15475. var videoElement = document.createElement('video');
  15476. var support = videoElement.canPlayType('video/x-new-fictional-format;codecs="kittens,bunnies"');
  15477. if (support != "probably" &amp;&amp; "New Fictional Video Plugin" in navigator.plugins) {
  15478. // not confident of browser support
  15479. // but we have a plugin
  15480. // so use plugin instead
  15481. videoElement = document.createElement("embed");
  15482. } else if (support == "") {
  15483. // no support from browser and no plugin
  15484. // do nothing
  15485. videoElement = null;
  15486. }
  15487. if (videoElement) {
  15488. while (videoSection.hasChildNodes())
  15489. videoSection.removeChild(videoSection.firstChild);
  15490. videoElement.setAttribute("src", "playing-cats.nfv");
  15491. videoSection.appendChild(videoElement);
  15492. }
  15493. &lt;/script></pre>
  15494. </div>
  15495. <p class=note>The <code id=mime-types:attr-source-type><a href=#attr-source-type>type</a></code> attribute of the
  15496. <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
  15497. it cannot render.</p>
  15498. <h5 id=network-states>4.8.14.4 Network states</h5>
  15499. <dl class=domintro><dt><var>media</var> . <code id=network-states:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code><dd>
  15500. <p>Returns the current state of network activity for the element, from the codes in the list
  15501. below.</p>
  15502. </dl>
  15503. <p>As <a href=#media-element id=network-states:media-element>media elements</a> interact with the network, their current
  15504. network activity is represented by the <dfn id=dom-media-networkstate><code>networkState</code></dfn> attribute. On getting, it must
  15505. return the current network state of the element, which must be one of the following values:</p>
  15506. <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
  15507. 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
  15508. 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>
  15509. <p>The <a href=#concept-media-load-algorithm id=network-states:concept-media-load-algorithm-3>resource selection algorithm</a> defined
  15510. below describes exactly when the <code id=network-states:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code>
  15511. attribute changes value and what events fire to indicate changes in this state.</p>
  15512. <h5 id=loading-the-media-resource>4.8.14.5 Loading the media resource</h5>
  15513. <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>
  15514. <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>
  15515. from scratch.</p>
  15516. </dl>
  15517. <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>,
  15518. which must begin in the true state, and a <dfn id=delaying-the-load-event-flag>delaying-the-load-event flag</dfn>, which must
  15519. 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
  15520. 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>
  15521. <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
  15522. 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
  15523. algorithm</a>.</p>
  15524. <p>The <dfn id=media-element-load-algorithm>media element load algorithm</dfn> consists of the following steps.</p>
  15525. <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
  15526. element.<li>
  15527. <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
  15528. 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>
  15529. <p class=note>Basically, pending events and callbacks for the media element are discarded when
  15530. the media element starts loading a new resource.</p>
  15531. <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
  15532. 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
  15533. element</a>.<li>
  15534. <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>
  15535. 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
  15536. substeps:</p>
  15537. <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
  15538. 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.
  15539. <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
  15540. 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>
  15541. <p>Set the <a href=#current-playback-position id=loading-the-media-resource:current-playback-position>current playback position</a> to 0.</p>
  15542. <p>Set the <a href=#official-playback-position id=loading-the-media-resource:official-playback-position>official playback position</a> to 0.</p>
  15543. <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>
  15544. 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>
  15545. <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>
  15546. <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
  15547. (NaN).</p>
  15548. <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
  15549. the duration.</p>
  15550. </ol>
  15551. <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
  15552. 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
  15553. <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>
  15554. <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
  15555. stops.</p>
  15556. </ol>
  15557. <p>The <dfn id=concept-media-load-algorithm>resource selection algorithm</dfn> for a
  15558. <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
  15559. of the first steps in the algorithm is to return and continue running the remaining steps
  15560. 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
  15561. 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>
  15562. algorithm). Steps in such sections are marked with ⌛.</p>
  15563. <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
  15564. 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
  15565. (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
  15566. section</a> consists of all the remaining steps of this algorithm until the algorithm says the
  15567. <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>
  15568. <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,
  15569. 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>
  15570. <li>
  15571. <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
  15572. object</a>, then let <var>mode</var> be <i>object</i>.</p>
  15573. <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
  15574. object</a> but has a <code id=loading-the-media-resource:attr-media-src><a href=#attr-media-src>src</a></code>
  15575. attribute, then let <var>mode</var> be <i>attribute</i>.</p>
  15576. <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
  15577. 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
  15578. let <var>mode</var> be <i>children</i> and let <var>candidate</var>
  15579. 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>
  15580. <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
  15581. 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
  15582. <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
  15583. <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-5>synchronous section</a> ends.</p>
  15584. <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>
  15585. <p>Run the appropriate steps from the following list:</p>
  15586. <dl class=switch><dt>If <var>mode</var> is <i>object</i><dd>
  15587. <ol><li><p>⌛ Set the <code id=loading-the-media-resource:dom-media-currentsrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to
  15588. 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
  15589. asynchronously.<li><p>Run the <a href=#concept-media-load-resource id=loading-the-media-resource:concept-media-load-resource>resource fetch algorithm</a>
  15590. 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
  15591. aborting <em>this</em> one, then the load failed.<li><p><i>Failed with media provider</i>: Reaching this step indicates that the media
  15592. 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
  15593. 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
  15594. executed.<li><p>Abort these steps. The element won't attempt to load another resource until this
  15595. algorithm is triggered again.</ol>
  15596. <dt>If <var>mode</var> is <i>attribute</i><dd>
  15597. <ol><li><p>⌛ If the <code id=loading-the-media-resource:attr-media-src-4><a href=#attr-media-src>src</a></code>
  15598. 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
  15599. 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
  15600. 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>
  15601. 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
  15602. <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
  15603. changed.</p>
  15604. <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
  15605. 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
  15606. 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
  15607. URL</var>. If that algorithm returns without aborting <em>this</em> one, then the load
  15608. failed.<li><p><i>Failed with attribute</i>: Reaching this step indicates that the media resource
  15609. 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
  15610. 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
  15611. executed.<li><p>Abort these steps. The element won't attempt to load another resource until this
  15612. algorithm is triggered again.</ol>
  15613. <dt>Otherwise (<var>mode</var> is <i>children</i>)<dd>
  15614. <ol><li>
  15615. <p>⌛ Let <var>pointer</var> be a position defined by two adjacent nodes in the
  15616. <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
  15617. child in the list, if any) and end of the list (after the last child in the list, if any) as
  15618. nodes in their own right. One node is the node before <var>pointer</var>, and the
  15619. 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
  15620. next node, if there are any, or the end of the list, if it is the last node.</p>
  15621. <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>
  15622. <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
  15623. 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
  15624. as with the previous case, <var>pointer</var> doesn't move relative to the remaining
  15625. nodes.</dl>
  15626. <p>Other changes don't affect <var>pointer</var>.</p>
  15627. <li><p>⌛ <i>Process candidate</i>: If <var>candidate</var> does not have a
  15628. <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
  15629. <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
  15630. 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
  15631. 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>
  15632. specified by <var>candidate</var>'s <code id=loading-the-media-resource:attr-source-src-3><a href=#attr-source-src>src</a></code>
  15633. 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>
  15634. <li><p>⌛ If <var>absolute URL</var> was not obtained successfully, then end the
  15635. <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
  15636. 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
  15637. type</a> (including any codecs described by the <code>codecs</code> parameter, for
  15638. 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
  15639. 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
  15640. 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
  15641. <var>absolute URL</var>. If that algorithm returns without aborting <em>this</em> one,
  15642. 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
  15643. 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>
  15644. consists of all the remaining steps of this algorithm until the algorithm says the
  15645. <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
  15646. tracks</a>.<li><p>⌛ <i>Find next candidate</i>: Let <var>candidate</var> be
  15647. null.<li><p>⌛ <i>Search loop</i>: If the node after <var>pointer</var> is
  15648. 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,
  15649. 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
  15650. 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
  15651. 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
  15652. 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
  15653. 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
  15654. asynchronously.<li><p>Wait until the node after <var>pointer</var> is a node other than the end of
  15655. 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>
  15656. consists of all the remaining steps of this algorithm until the algorithm says the
  15657. <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
  15658. <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
  15659. fired yet).</p>
  15660. <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>
  15661. </dl>
  15662. <p>The <dfn id=dedicated-media-source-failure-steps>dedicated media source failure steps</dfn> are the following steps:</p>
  15663. <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
  15664. <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
  15665. 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
  15666. 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
  15667. 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>
  15668. </ol>
  15669. <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
  15670. 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
  15671. follows:</p>
  15672. <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
  15673. <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
  15674. 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
  15675. <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
  15676. 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
  15677. 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
  15678. 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
  15679. any.</p>
  15680. <li>
  15681. <p>Run the appropriate steps from the following list:</p>
  15682. <dl class=switch><dt>If <var>mode</var> is remote<dd>
  15683. <ol><li>
  15684. <p>Optionally, run the following substeps. This is the expected behavior if the user agent
  15685. intends to not attempt to fetch the resource until the user requests it explicitly (e.g. as
  15686. 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>
  15687. <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>
  15688. to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-6>delaying the load
  15689. 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
  15690. 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
  15691. yet).</p>
  15692. <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>
  15693. <li>
  15694. <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
  15695. 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
  15696. <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
  15697. 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
  15698. <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>
  15699. <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
  15700. 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
  15701. 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
  15702. <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
  15703. on it.</p>
  15704. <p>The <dfn id=stall-timeout>stall timeout</dfn> is a user-agent defined length of time, which should be about
  15705. 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
  15706. <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
  15707. 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
  15708. event</a> named <code id=loading-the-media-resource:event-media-stalled><a href=#event-media-stalled>stalled</a></code> at the element.</p>
  15709. <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.
  15710. 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
  15711. act as if it was stalled (as opposed to acting as if the connection was closed). The rate of the
  15712. download may also be throttled automatically by the user agent, e.g. to balance the download
  15713. with other connections sharing the same bandwidth.</p>
  15714. <p id=resourceSuspend>User agents may decide to not download more content at any time, e.g.
  15715. after buffering five minutes of a one hour media resource, while waiting for the user to decide
  15716. whether to play the resource or not, while waiting for user input in an interactive resource, or
  15717. 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
  15718. 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
  15719. <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
  15720. 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,
  15721. 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,
  15722. as described above).</p>
  15723. <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
  15724. 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>
  15725. <p>When a user agent decides to completely stall a download, e.g. if it is waiting until the
  15726. 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
  15727. 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
  15728. <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-8>delaying the load event</a>.</p>
  15729. <p>The user agent may use whatever means necessary to fetch the resource (within the constraints
  15730. put forward by this and other specifications); for example, reconnecting to the server in the
  15731. face of network errors, using HTTP range retrieval requests, or switching to a streaming
  15732. protocol. The user agent must consider a resource erroneous only if it has given up trying to
  15733. fetch it.</p>
  15734. <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
  15735. <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>
  15736. <p>While the load is not suspended (see below), every 350ms (±200ms) or for every byte
  15737. 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
  15738. 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>
  15739. <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
  15740. 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
  15741. 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>
  15742. below. (A new task is used for this so that the work described below occurs relative to the
  15743. <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
  15744. source</a>.)</p>
  15745. <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
  15746. 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
  15747. <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
  15748. completes without errors, including decoding the media data, and if all of the data is available
  15749. to the user agent without network access, then, the user agent must move on to the <i>final step</i> below.
  15750. This might never happen, e.g. when streaming an infinite resource such as Web radio, or if the
  15751. resource is longer than the user agent's ability to cache data.</p>
  15752. <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
  15753. resource</a>, the user agent must remain on this step.</p>
  15754. <p class=example>For example, if the user agent has discarded the first half of a video, the
  15755. user agent will remain at this step even once the <a href=#ended-playback id=loading-the-media-resource:ended-playback>playback has
  15756. ended</a>, because there is always the chance the user will seek back to the start. In fact,
  15757. in this situation, once <a href=#ended-playback id=loading-the-media-resource:ended-playback-2>playback has ended</a>, the user agent
  15758. 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
  15759. earlier.</p>
  15760. </ol>
  15761. <dt>Otherwise (<var>mode</var> is <i>local</i>)<dd>
  15762. <p>The resource described by the <var>current media resource</var>, if any, contains the
  15763. <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>
  15764. <p>If the <var>current media resource</var> is a raw data stream (e.g. from a
  15765. <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>,
  15766. 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>.
  15767. Otherwise, if the data stream is pre-decoded, then the format is the format given by the
  15768. relevant specification.</p>
  15769. <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
  15770. 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
  15771. list</a> below.</p>
  15772. <p>When the <var>current media resource</var> is permanently exhausted (e.g. all the bytes of
  15773. 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
  15774. agent must move on to the <i>final step</i> below. This might never happen, e.g. if the
  15775. <var>current media resource</var> is a <code id=loading-the-media-resource:mediastream><a href=#mediastream>MediaStream</a></code>.</p>
  15776. </dl>
  15777. <p>The <dfn id=media-data-processing-steps-list>media data processing steps list</dfn> is as follows:</p>
  15778. <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
  15779. 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
  15780. unsupported format, or can otherwise not be rendered at all<dd>
  15781. <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in other protocols), and other fatal
  15782. 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
  15783. container format, or using unsupported codecs for all the data, must cause the user agent to
  15784. execute the following steps:</p>
  15785. <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>
  15786. </ol>
  15787. <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
  15788. track<dd>
  15789. <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>
  15790. 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>
  15791. <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
  15792. media resource</var> indicate a particular set of audio tracks to enable, or if the user
  15793. agent has information that would facilitate the selection of specific audio tracks to
  15794. improve the user's experience, then: if this audio track is one of the ones to enable, then
  15795. set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var>
  15796. to <i>false</i>.</p>
  15797. <p class=example>This could be triggered by <cite>Media Fragments URI</cite> fragment
  15798. identifier syntax, but it could also be triggered e.g. by the user agent selecting a 5.1
  15799. surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
  15800. <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
  15801. element</a> does not yet have an <a href=#dom-audiotrack-enabled id=loading-the-media-resource:dom-audiotrack-enabled>enabled</a>
  15802. 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,
  15803. 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,
  15804. 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
  15805. <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>
  15806. <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
  15807. track<dd>
  15808. <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>
  15809. 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>
  15810. <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
  15811. media resource</var> indicate a particular set of video tracks to enable, or if the user
  15812. agent has information that would facilitate the selection of specific video tracks to
  15813. improve the user's experience, then: if this video track is the first such video track, then
  15814. set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var>
  15815. to <i>false</i>.</p>
  15816. <p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
  15817. fragment identifier syntax.</p>
  15818. <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
  15819. element</a> does not yet have a <a href=#dom-videotrack-selected id=loading-the-media-resource:dom-videotrack-selected>selected</a>
  15820. 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
  15821. previously selected video tracks, otherwise, do not select this video track. If other tracks
  15822. 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,
  15823. 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
  15824. <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>
  15825. <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
  15826. determine the duration of the <a href=#media-resource id=loading-the-media-resource:media-resource-12>media resource</a>, its dimensions, and other
  15827. metadata<dd>
  15828. <p>This indicates that the resource is usable. The user agent must follow these substeps:</p>
  15829. <ol><li>
  15830. <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
  15831. 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
  15832. position</a>, based on the <a href=#media-data id=loading-the-media-resource:media-data-9>media data</a>.</p>
  15833. <li>
  15834. <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
  15835. 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
  15836. 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
  15837. offset</a> must be set to Not-a-Number (NaN).</p>
  15838. <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
  15839. position</a> to the <a href=#earliest-possible-position id=loading-the-media-resource:earliest-possible-position-2>earliest possible position</a>.<li>
  15840. <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
  15841. 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
  15842. 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>
  15843. <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>
  15844. 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>
  15845. <li>
  15846. <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>
  15847. 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
  15848. the <a href=#media-element id=loading-the-media-resource:media-element-35>media element</a>.</p>
  15849. <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
  15850. if the dimensions subsequently change.</p>
  15851. <li>
  15852. <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>
  15853. <p class=note>A <code id=loading-the-media-resource:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> DOM event
  15854. <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>
  15855. <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
  15856. 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
  15857. start position</a> be zero.<li>
  15858. <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
  15859. 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
  15860. 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
  15861. true.</p>
  15862. <p class=example>For example, with media formats that support the <cite>Media Fragments
  15863. URI</cite> fragment identifier syntax, the fragment identifier can be used to indicate a
  15864. start position. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
  15865. <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
  15866. 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,
  15867. 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:
  15868. 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>,
  15869. 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
  15870. <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
  15871. <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
  15872. 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;
  15873. 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
  15874. <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
  15875. timeline.</ol>
  15876. <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
  15877. the <code>loadeddata</code> event has been fired</a>, set the
  15878. 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>
  15879. <p class=note>A user agent that is attempting to reduce network usage while still fetching
  15880. 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,
  15881. following <a href=#resourceSuspend>the rules described previously</a>, which involve the
  15882. <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>
  15883. <p class=note>The user agent is <em>required</em> to determine the duration of the
  15884. <a href=#media-resource id=loading-the-media-resource:media-resource-16>media resource</a> and go through this step before playing.</p>
  15885. <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>
  15886. (but potentially before any of it has been decoded)<dd>
  15887. <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>
  15888. at the <a href=#media-element id=loading-the-media-resource:media-element-42>media element</a>.</p>
  15889. <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
  15890. <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>
  15891. <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
  15892. 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>
  15893. <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
  15894. algorithm will continue to its <i>final step</i> below, which aborts the algorithm.</p>
  15895. <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,
  15896. causing the user agent to give up trying to fetch the resource<dd>
  15897. <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
  15898. <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
  15899. following steps:</p>
  15900. <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
  15901. <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
  15902. 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
  15903. 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
  15904. 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
  15905. algorithm</a>.</ol>
  15906. <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>
  15907. <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
  15908. 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
  15909. <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
  15910. user agent to execute the following steps:</p>
  15911. <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
  15912. <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
  15913. 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
  15914. 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
  15915. 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
  15916. algorithm</a>.</ol>
  15917. <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>
  15918. <p>The fetching process is aborted by the user, e.g. because the user
  15919. pressed a "stop" button, the user agent must execute the following steps. These steps are not
  15920. 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
  15921. these steps are running, as the steps above handle that particular kind of abort.</p>
  15922. <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
  15923. <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
  15924. 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
  15925. the <a href=#media-element id=loading-the-media-resource:media-element-48>media element</a>.<li>
  15926. <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>
  15927. 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
  15928. the element's <code id=loading-the-media-resource:dom-media-networkstate-18><a href=#dom-media-networkstate>networkState</a></code> attribute to the
  15929. <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
  15930. <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>
  15931. <p>Otherwise, set the element's <code id=loading-the-media-resource:dom-media-networkstate-19><a href=#dom-media-networkstate>networkState</a></code>
  15932. 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>
  15933. <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
  15934. algorithm</a>.</ol>
  15935. <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
  15936. errors or uses, in part, codecs that are unsupported, preventing the user agent from rendering
  15937. the content completely correctly but not preventing playback altogether<dd>
  15938. <p>The server returning data that is partially usable but cannot be optimally rendered must
  15939. cause the user agent to render just the bits it can handle, and ignore the rest.</p>
  15940. <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
  15941. 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
  15942. supports<dd>
  15943. <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
  15944. expose a media-resource-specific text track</a> with the relevant data.</p>
  15945. <p class=note>Cross-origin videos do not expose their subtitles, since that would allow
  15946. attacks such as hostile sites reading subtitles from confidential videos on a user's
  15947. intranet.</p>
  15948. </dl>
  15949. <li><p><i>Final step:</i> If the user agent ever reaches this step (which can only happen if the entire resource
  15950. 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>
  15951. <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
  15952. 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
  15953. 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
  15954. 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,
  15955. 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>
  15956. 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>
  15957. events, fired by the algorithms that invoke this one, can be used instead.</p>
  15958. <hr>
  15959. <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
  15960. attribute</a>. The following table lists the keywords and states for the attribute — the
  15961. keywords in the left column map to the states in the cell in the second column on the same row as
  15962. 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
  15963. buffered or played; the descriptions in the table below are to be interpreted with that in
  15964. mind.</p>
  15965. <table><thead><tr><th> Keyword
  15966. <th> State
  15967. <th> Brief description
  15968. <tbody><tr><td><dfn id=attr-media-preload-none><code>none</code></dfn>
  15969. <td><dfn id=attr-media-preload-none-state>None</dfn>
  15970. <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.
  15971. 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").
  15972. <tr><td><dfn id=attr-media-preload-metadata><code>metadata</code></dfn>
  15973. <td><dfn id=attr-media-preload-metadata-state>Metadata</dfn>
  15974. <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>.
  15975. 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.
  15976. <tr><td><dfn id=attr-media-preload-auto><code>auto</code></dfn>
  15977. <td><dfn id=attr-media-preload-auto-state>Automatic</dfn>
  15978. <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.
  15979. </table>
  15980. <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
  15981. between reducing server load and providing an optimal user experience.</p>
  15982. <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
  15983. example, on a page with many videos this might be used to indicate that the many videos are not to
  15984. be downloaded unless requested, but that once one <em>is</em> requested it is to be downloaded
  15985. aggressively.</p>
  15986. <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
  15987. the user agent about what the author thinks will lead to the best user experience. The attribute
  15988. may be ignored altogether, for example based on explicit user preferences or based on the
  15989. available connectivity.</p>
  15990. <p>The <dfn id=dom-media-preload><code>preload</code></dfn> IDL attribute must
  15991. <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
  15992. values</a>.</p>
  15993. <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
  15994. <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
  15995. 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>
  15996. <hr>
  15997. <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>
  15998. <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
  15999. resource</a> that the user agent has buffered.</p>
  16000. </dl>
  16001. <p>The <dfn id=dom-media-buffered><code>buffered</code></dfn> attribute must return a new
  16002. 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
  16003. <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
  16004. is evaluated. Users agents must accurately determine the ranges available, even for media streams
  16005. where this can only be determined by tedious inspection.</p>
  16006. <p class=note>Typically this will be a single range anchored at the zero point, but if, e.g. the
  16007. user agent uses HTTP range requests in response to seeking, then there could be multiple
  16008. ranges.</p>
  16009. <p>User agents may discard previously buffered data.</p>
  16010. <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
  16011. the range(s) of objects returned by the same attribute at later times.</p>
  16012. <h5 id=offsets-into-the-media-resource>4.8.14.6 Offsets into the media resource</h5>
  16013. <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>
  16014. <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
  16015. the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-2>media resource</a> is at time zero.</p>
  16016. <p>Returns NaN if the duration isn't available.</p>
  16017. <p>Returns Infinity for unbounded streams.</p>
  16018. <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>
  16019. <p>Returns the <a href=#official-playback-position id=offsets-into-the-media-resource:official-playback-position>official playback position</a>, in seconds.</p>
  16020. <p>Can be set, to seek to the given time.</p>
  16021. <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
  16022. 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>
  16023. </dl>
  16024. <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
  16025. 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
  16026. position. The duration of a timeline is its last defined position.</p>
  16027. <p><dfn id=defineTimeline>Establishing the media
  16028. 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
  16029. origin is not negative (i.e. gives each frame a specific time offset and gives the first frame a
  16030. 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
  16031. 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
  16032. explicit start time <em>and date</em>, then that time and date should be considered the zero point
  16033. 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,
  16034. exposed using the <code id=offsets-into-the-media-resource:dom-media-getstartdate><a href=#dom-media-getstartdate>getStartDate()</a></code> method.</p>
  16035. <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
  16036. 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
  16037. 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
  16038. <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
  16039. data</a> has out-of-order or even overlapping time codes.</p>
  16040. <p class=example>For example, if two clips have been concatenated into one video file, but the
  16041. video format exposes the original times for the two clips, the video data might expose a timeline
  16042. that goes, say, 00:15..00:29 and then 00:05..00:38. However, the user agent would not expose those
  16043. times; it would instead expose the times as 00:15..00:29 and 00:29..01:02, as a single video.</p>
  16044. <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
  16045. 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
  16046. <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
  16047. explicit timings of any kind, not even frame durations, the user agent must itself determine the
  16048. time for each frame in a user-agent-defined manner.
  16049. <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>
  16050. </p>
  16051. <p class=note>An example of a file format with no explicit timeline but with explicit frame
  16052. durations is the Animated GIF format. An example of a file format with no explicit timings at all
  16053. 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
  16054. used as the format for MJPEG streams).</p>
  16055. <p>If, in the case of a resource with no timing information, the user agent will nonetheless be
  16056. able to seek to an earlier point than the first frame originally provided by the server, then the
  16057. 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>;
  16058. otherwise, it should correspond to the first frame received from the server (the point in the
  16059. <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>
  16060. <p class=note>At the time of writing, there is no known format that lacks explicit frame time
  16061. offsets yet still supports seeking to a frame before the first frame sent by the server.</p>
  16062. <div class=example>
  16063. <p>Consider a stream from a TV broadcaster, which begins streaming on a sunny Friday afternoon in
  16064. October, and always sends connecting user agents the media data on the same media timeline, with
  16065. its zero time set to the start of this stream. Months later, user agents connecting to this
  16066. 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
  16067. broadcast started; this would allow controllers to display real times in their scrubber (e.g.
  16068. "2:30pm") rather than a time relative to when the broadcast began ("8 months, 4 hours, 12
  16069. minutes, and 23 seconds").</p>
  16070. <p>Consider a stream that carries a video with several concatenated fragments, broadcast by a
  16071. server that does not allow user agents to request specific times but instead just streams the
  16072. video data in a predetermined order, with the first frame delivered always being identified as
  16073. the frame with time zero. If a user agent connects to this stream and receives fragments defined
  16074. 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
  16075. 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
  16076. at 0s and extending to 3,600s (one hour). Assuming the streaming server disconnected at the end
  16077. 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
  16078. 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
  16079. <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
  16080. different user agent connected five minutes later, <em>it</em> would (presumably) receive
  16081. fragments covering timestamps 2010-03-20 23:20:00 UTC to 2010-03-21 00:05:00 UTC and 2010-02-12
  16082. 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>
  16083. 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
  16084. with a time corresponding to 2010-03-20 23:20:00 UTC.</p>
  16085. <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
  16086. would give the ranges that the controller would want to actually display in its UI; typically, if
  16087. the servers don't support seeking to arbitrary times, this would be the range of time from the
  16088. moment the user agent connected to the stream up to the latest frame that the user agent has
  16089. obtained; however, if the user agent starts discarding earlier information, the actual range
  16090. might be shorter.</p>
  16091. </div>
  16092. <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
  16093. 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
  16094. zero.</p>
  16095. <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
  16096. 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
  16097. wall clock.</p>
  16098. <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
  16099. 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>
  16100. <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>,
  16101. 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
  16102. <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>
  16103. <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
  16104. 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
  16105. 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
  16106. stable while scripts are running.</p>
  16107. <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
  16108. position</dfn>, which must initially be set to zero seconds. This time is used to allow the
  16109. element to be seeked even before the media is loaded.</p>
  16110. <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
  16111. element</a> is created, this flag must be set to true. This flag is used to control when the
  16112. 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
  16113. contents.</p>
  16114. <p>The <dfn id=dom-media-currenttime><code>currentTime</code></dfn> attribute must, on
  16115. 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>,
  16116. 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
  16117. 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
  16118. 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
  16119. <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
  16120. 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
  16121. 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
  16122. seconds.</p>
  16123. <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>,
  16124. 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
  16125. <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.
  16126. 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>
  16127. <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
  16128. to obtain certain parts of the resource after it has expired from its buffer. Similarly, some
  16129. <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
  16130. doesn't start at zero. The <dfn id=earliest-possible-position>earliest possible position</dfn> is the earliest position in the
  16131. 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
  16132. timeline</a>.</p>
  16133. <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;
  16134. 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
  16135. the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-3>current playback position</a> otherwise.</p>
  16136. <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
  16137. 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
  16138. 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
  16139. element in the past 15 to 250ms and is not still running event handlers for such an event, then
  16140. 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>
  16141. <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
  16142. 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>
  16143. <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
  16144. 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
  16145. 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
  16146. 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>
  16147. 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
  16148. 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
  16149. 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
  16150. <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
  16151. 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>
  16152. <p>The <dfn id=dom-media-duration><code>duration</code></dfn> attribute must return the time
  16153. 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
  16154. 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)
  16155. 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
  16156. live event with no announced end time), then the attribute must return the positive Infinity
  16157. value.</p>
  16158. <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
  16159. 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
  16160. parts of the resource.</p>
  16161. <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
  16162. (e.g. from being unknown to known, or from a previously established length to a new length) the
  16163. 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
  16164. event is not fired when the duration is reset as part of loading a new media resource.) If the
  16165. 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
  16166. 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>
  16167. <p class=example>If an "infinite" stream ends for some reason, then the duration would change
  16168. 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
  16169. 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
  16170. it precisely, and later revises the estimate based on new information, then the duration would
  16171. 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
  16172. fired.</p>
  16173. <p>Some video files also have an explicit date and time corresponding to the zero time in the
  16174. <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
  16175. <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>
  16176. <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
  16177. <a href=#timeline-offset id=offsets-into-the-media-resource:timeline-offset-3>timeline offset</a>.</p>
  16178. <hr>
  16179. <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
  16180. 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
  16181. 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>
  16182. <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
  16183. <a href=#current-media-controller id=offsets-into-the-media-resource:current-media-controller-4>current media controller</a>.</p>
  16184. <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>
  16185. the content attribute of the same name.</p>
  16186. <h5 id=ready-states>4.8.14.7 Ready states</h5>
  16187. <dl class=domintro><dt><var>media</var> . <code id=ready-states:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code><dd>
  16188. <p>Returns a value that expresses the current state of the element with respect to rendering the
  16189. <a href=#current-playback-position id=ready-states:current-playback-position>current playback position</a>, from the codes in the list below.</p>
  16190. </dl>
  16191. <p><a href=#media-element id=ready-states:media-element>Media elements</a> have a <i>ready state</i>, which describes to
  16192. 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
  16193. possible values are as follows; the ready state of a media element at any particular time is the
  16194. greatest value describing the state of the element:</p>
  16195. <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
  16196. <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
  16197. elements</a> whose <code id=ready-states:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> attribute are set
  16198. 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.
  16199. 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
  16200. 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
  16201. 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
  16202. 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
  16203. playback position</a> in the <a href=#direction-of-playback id=ready-states:direction-of-playback>direction of playback</a> at all without immediately
  16204. 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
  16205. 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
  16206. corresponds to the user agent having data from the current frame, but not the next frame, when
  16207. 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
  16208. 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
  16209. <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
  16210. ready</a>. For example, in video this corresponds to the user agent having data for at least
  16211. 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
  16212. instant in time between the two frames, or to the user agent having the video data for the
  16213. 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
  16214. 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>
  16215. can never advance in this case.<dt><dfn id=dom-media-have_enough_data><code>HAVE_ENOUGH_DATA</code></dfn> (numeric value 4)<dd>
  16216. <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,
  16217. either of the following conditions is also true:</p>
  16218. <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
  16219. 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>,
  16220. would not overtake the available data before playback reaches the end of the <a href=#media-resource id=ready-states:media-resource-2>media
  16221. resource</a>.<li>The user agent has entered a state where waiting longer will not result in further data
  16222. being obtained, and therefore nothing would be gained by delaying playback any further. (For
  16223. example, the buffer might be full.)</ul>
  16224. </dl>
  16225. <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
  16226. 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
  16227. <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
  16228. 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,
  16229. 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
  16230. 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
  16231. this frame and the next) can be negligible (in the extreme, only one frame). The only time that
  16232. distinction really matters is when a page provides an interface for "frame-by-frame"
  16233. navigation.</p>
  16234. <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
  16235. given below:</p>
  16236. <ol><li>
  16237. <p>Apply the first applicable set of substeps from the following list:</p>
  16238. <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>,
  16239. 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>
  16240. <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>
  16241. <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
  16242. 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>
  16243. <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>
  16244. <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
  16245. element</a> since the <code id=ready-states:dom-media-load><a href=#dom-media-load>load()</a></code> algorithm was last
  16246. 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>
  16247. named <code id=ready-states:event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> at the element.</p>
  16248. <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>
  16249. 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
  16250. below must then be run also.</p>
  16251. <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
  16252. <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>
  16253. <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
  16254. playing</a> before its <code id=ready-states:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute
  16255. 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
  16256. <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>,
  16257. <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
  16258. 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>
  16259. 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
  16260. the element.</p>
  16261. <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
  16262. is <code id=ready-states:dom-media-have_future_data-6><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code><dd>
  16263. <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
  16264. <code id=ready-states:event-media-canplay><a href=#event-media-canplay>canplay</a></code> at the element.</p>
  16265. <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
  16266. 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>
  16267. <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>
  16268. <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
  16269. <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
  16270. <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>
  16271. at the element.</p>
  16272. <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>
  16273. has an <code id=ready-states:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute specified, and the
  16274. <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>
  16275. 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
  16276. the user agent may also run the following substeps:</p>
  16277. <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
  16278. <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>
  16279. <p class=note>User agents do not need to support autoplay, and it is suggested that user
  16280. 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
  16281. video to play, so as to allow the user to override the behavior if so desired.</p>
  16282. <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
  16283. event</a> named <code id=ready-states:event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> at the element.</p>
  16284. </dl>
  16285. <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
  16286. <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
  16287. controller</a>.</ol>
  16288. <p class=note>It is possible for the ready state of a media element to jump between these states
  16289. 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>
  16290. <p>The <dfn id=dom-media-readystate><code>readyState</code></dfn> IDL attribute must, on
  16291. getting, return the value described above that describes the current ready state of the
  16292. <a href=#media-element id=ready-states:media-element-10>media element</a>.</p>
  16293. <p>The <dfn id=attr-media-autoplay><code>autoplay</code></dfn> attribute is a <a href=#boolean-attribute id=ready-states:boolean-attribute>boolean
  16294. attribute</a>. When present, the user agent (as described in the algorithm
  16295. described herein) will automatically begin playback of the <a href=#media-resource id=ready-states:media-resource-3>media resource</a> as
  16296. soon as it can do so without stopping.</p>
  16297. <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>
  16298. attribute rather than using script to trigger automatic playback, as this allows the user to
  16299. override the automatic playback when it is not desired, e.g. when using a screen reader. Authors
  16300. are also encouraged to consider not using the automatic playback behavior at all, and instead to
  16301. let the user agent wait for the user to start playback explicitly.</p>
  16302. <p>The <dfn id=dom-media-autoplay><code>autoplay</code></dfn> IDL attribute must
  16303. <a href=#reflect id=ready-states:reflect>reflect</a> the content attribute of the same name.</p>
  16304. <h5 id=playing-the-media-resource>4.8.14.8 Playing the media resource</h5>
  16305. <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>
  16306. <p>Returns true if playback is paused; false otherwise.</p>
  16307. <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-ended><a href=#dom-media-ended>ended</a></code><dd>
  16308. <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>
  16309. <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>
  16310. <p>Returns the default rate of playback, for when the user is not fast-forwarding or reversing
  16311. through the <a href=#media-resource id=playing-the-media-resource:media-resource-2>media resource</a>.</p>
  16312. <p>Can be set, to change the default rate of playback.</p>
  16313. <p>The default rate has no direct effect on playback, but if the user switches to a fast-forward
  16314. mode, when they return to the normal playback mode, it is expected that the rate of playback
  16315. will be returned to the default rate of playback.</p>
  16316. <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
  16317. <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>
  16318. <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>
  16319. <p>Returns the current rate playback, where 1.0 is normal speed.</p>
  16320. <p>Can be set, to change the rate of playback.</p>
  16321. <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
  16322. media controller</a>'s <code id=playing-the-media-resource:dom-mediacontroller-playbackrate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> is
  16323. used instead.</p>
  16324. <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-played><a href=#dom-media-played>played</a></code><dd>
  16325. <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
  16326. resource</a> that the user agent has played.</p>
  16327. <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-play><a href=#dom-media-play>play</a></code>()<dd>
  16328. <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
  16329. <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
  16330. restart it from the start.</p>
  16331. <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-pause><a href=#dom-media-pause>pause</a></code>()<dd>
  16332. <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
  16333. <a href=#media-resource id=playing-the-media-resource:media-resource-5>media resource</a> if necessary.</p>
  16334. </dl>
  16335. <p>The <dfn id=dom-media-paused><code>paused</code></dfn> attribute represents whether the
  16336. <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>
  16337. <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
  16338. <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>
  16339. <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
  16340. 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
  16341. <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
  16342. <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
  16343. element</a>.</p>
  16344. <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
  16345. <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>
  16346. <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>
  16347. <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
  16348. <li>
  16349. <p>Either:
  16350. <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>,
  16351. and
  16352. <li>The <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback>direction of playback</a> is forwards, and
  16353. <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
  16354. a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-7>current media controller</a>.
  16355. </ul>
  16356. <p>Or:
  16357. <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>,
  16358. and
  16359. <li>The <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-2>direction of playback</a> is backwards.
  16360. </ul>
  16361. </ul>
  16362. <p>The <dfn id=dom-media-ended><code>ended</code></dfn> attribute must return true if, the
  16363. 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
  16364. <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
  16365. otherwise.</p>
  16366. <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
  16367. 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
  16368. <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
  16369. <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-3>current playback position</a>.</p>
  16370. <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
  16371. <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
  16372. 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
  16373. 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
  16374. 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
  16375. 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
  16376. <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
  16377. 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
  16378. element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-11>current media controller</a>.</p>
  16379. <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
  16380. <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>
  16381. <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
  16382. 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
  16383. 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>
  16384. <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
  16385. <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
  16386. 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
  16387. 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
  16388. 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
  16389. 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
  16390. 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
  16391. <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
  16392. 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
  16393. 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
  16394. <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>
  16395. <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
  16396. 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
  16397. 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
  16398. 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>
  16399. <hr>
  16400. <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
  16401. <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
  16402. agent must follow these steps:</p>
  16403. <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>
  16404. 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
  16405. <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
  16406. 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
  16407. <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
  16408. 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
  16409. 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
  16410. 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
  16411. <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
  16412. controller</a>.</ol>
  16413. <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
  16414. 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
  16415. 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
  16416. 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>
  16417. <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
  16418. 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>
  16419. <hr>
  16420. <p>The <dfn id=dom-media-defaultplaybackrate><code>defaultPlaybackRate</code></dfn> attribute
  16421. 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
  16422. intrinsic speed. The attribute is mutable: on getting it must return the last value it was set to,
  16423. or 1.0 if it hasn't yet been set; on setting the attribute must be set to the new value.</p>
  16424. <p class=note>The <code id=playing-the-media-resource:dom-media-defaultplaybackrate-3><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> is used
  16425. 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
  16426. interface to the user</a>.</p>
  16427. <p>The <dfn id=dom-media-playbackrate><code>playbackRate</code></dfn> attribute gives the
  16428. <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>
  16429. 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
  16430. 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
  16431. user is using a feature such as fast forward or slow motion playback. The attribute is mutable: on
  16432. getting it must return the last value it was set to, or 1.0 if it hasn't yet been set; on setting
  16433. the attribute must be set to the new value, and the playback will change speed (if the element is
  16434. <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>
  16435. <p id=rateUpdate>When the <code id=playing-the-media-resource:dom-media-defaultplaybackrate-5><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
  16436. or <code id=playing-the-media-resource:dom-media-playbackrate-3><a href=#dom-media-playbackrate>playbackRate</a></code> attributes change value (either by
  16437. being set by script or by being changed directly by the user agent, e.g. in response to user
  16438. 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
  16439. <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>
  16440. <p class=note>The <code id=playing-the-media-resource:dom-media-defaultplaybackrate-6><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> and
  16441. <code id=playing-the-media-resource:dom-media-playbackrate-4><a href=#dom-media-playbackrate>playbackRate</a></code> attributes have no effect when the
  16442. <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
  16443. the <code id=playing-the-media-resource:mediacontroller><a href=#mediacontroller>MediaController</a></code> object are used instead in that situation.</p>
  16444. <hr>
  16445. <p>The <dfn id=dom-media-played><code>played</code></dfn> attribute must return a new static
  16446. <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
  16447. <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
  16448. 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
  16449. the attribute is evaluated.</p>
  16450. <hr>
  16451. <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
  16452. element</a> is invoked, the user agent must run the following steps.</p>
  16453. <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
  16454. <a href=#concept-media-load-algorithm id=playing-the-media-resource:concept-media-load-algorithm>resource selection algorithm</a>.<li>
  16455. <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
  16456. 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
  16457. 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
  16458. position</a> of the <a href=#media-resource id=playing-the-media-resource:media-resource-17>media resource</a>.</p>
  16459. <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
  16460. 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>
  16461. <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
  16462. <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>
  16463. <li>
  16464. <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
  16465. true, run the following substeps:</p>
  16466. <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
  16467. 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>
  16468. <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>
  16469. 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
  16470. <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
  16471. element.</p>
  16472. <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
  16473. <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
  16474. element.</p>
  16475. </ol>
  16476. <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
  16477. <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
  16478. controller</a>.</ol>
  16479. <hr>
  16480. <p>When the <dfn id=dom-media-pause><code>pause()</code></dfn> method is invoked, and when
  16481. 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
  16482. following steps:</p>
  16483. <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
  16484. <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>
  16485. <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>
  16486. <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
  16487. is false, run the following steps:</p>
  16488. <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
  16489. event</a> named <code id=playing-the-media-resource:event-media-timeupdate-5><a href=#event-media-timeupdate>timeupdate</a></code> at the
  16490. 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
  16491. event</a> named <code id=playing-the-media-resource:event-media-pause-2><a href=#event-media-pause>pause</a></code>
  16492. 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
  16493. position</a>.</ol>
  16494. <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
  16495. <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
  16496. controller</a>.</ol>
  16497. <hr>
  16498. <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
  16499. <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
  16500. <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
  16501. <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
  16502. controller</a> overrides the <a href=#media-element id=playing-the-media-resource:media-element-54>media element</a>.</p>
  16503. <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
  16504. playback</dfn> is forwards. Otherwise, it is backwards.</p>
  16505. <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
  16506. 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
  16507. 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
  16508. 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
  16509. refers to this as an <i>increase</i>, but that increase could actually be a <em>de</em>crease if
  16510. the <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-6>effective playback rate</a> is negative.)</p>
  16511. <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
  16512. <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>
  16513. <p class=note>This specification doesn't define how the user agent achieves the appropriate
  16514. playback rate — depending on the protocol and media available, it is plausible that the user
  16515. agent could negotiate with the server to have the server provide the media data at the appropriate
  16516. rate, so that (except for the period between when the rate is changed and when the server updates
  16517. the stream's playback rate) the client doesn't actually have to drop or interpolate any
  16518. frames.</p>
  16519. <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>,
  16520. 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
  16521. position</a>.</p>
  16522. <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
  16523. <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
  16524. so low or so high that the user agent cannot play audio usefully, the corresponding audio must
  16525. 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
  16526. rate</a> is not 1.0, the user agent may apply pitch adjustments to the audio as necessary to
  16527. render it faithfully.</p>
  16528. <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>
  16529. 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
  16530. audio component. Media elements must not stop playing just because all references to them have
  16531. been removed; only once a media element is in a state where no further audio could ever be played
  16532. by that element may the element be garbage collected.</p>
  16533. <p class=note>It is possible for an element to which no explicit references exist to play audio,
  16534. 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
  16535. media controller</a> that still has references and can still be unpaused, or it could be
  16536. unpaused but stalled waiting for content to buffer.</p>
  16537. <hr>
  16538. <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
  16539. 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
  16540. 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
  16541. 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
  16542. 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
  16543. 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
  16544. 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
  16545. <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
  16546. 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
  16547. <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
  16548. run the <i id=playing-the-media-resource:time-marches-on-2><a href=#time-marches-on>time marches on</a></i> steps.</p>
  16549. <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
  16550. 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
  16551. 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
  16552. 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
  16553. <i id=playing-the-media-resource:time-marches-on-3><a href=#time-marches-on>time marches on</a></i> steps.</p>
  16554. <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.
  16555. 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
  16556. <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
  16557. must wait for the steps to complete, and then must immediately rerun the steps. (These steps are
  16558. thus run as often as possible or needed — if one iteration takes a long time, this can cause
  16559. 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
  16560. to "catch up".)</p>
  16561. <p>The <dfn id=time-marches-on><i>time marches on</i></dfn> steps are as follows:</p>
  16562. <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
  16563. 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
  16564. 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
  16565. 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
  16566. 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>,
  16567. 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
  16568. 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
  16569. 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
  16570. 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
  16571. 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>.
  16572. 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>
  16573. 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
  16574. 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
  16575. 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
  16576. 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
  16577. 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
  16578. explicit seeks, relevant events get fired as part of the overall process of changing the
  16579. <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-20>current playback position</a>.)</p>
  16580. <p class=note>The event thus is not to be fired faster than about 66Hz or slower than 4Hz
  16581. (assuming the event handlers don't take longer than 250ms to run). User agents are encouraged to
  16582. vary the frequency of the event based on the system load and the average cost of processing the
  16583. event each time, so that the UI updates are not any more frequent than the user agent can
  16584. 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>
  16585. 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
  16586. flag</a> set, and <var>missed cues</var> is empty, then abort these steps.<li>
  16587. <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
  16588. position</a> during normal playback, and there are <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-14>cues</a>
  16589. 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>
  16590. 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
  16591. <a href=#media-element id=playing-the-media-resource:media-element-72>media element</a>. </p>
  16592. <p class=note>In the other cases, such as explicit seeks, playback is not paused by going past
  16593. 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>
  16594. <li>
  16595. <p>Let <var>events</var> be a list of <a href=#concept-task id=playing-the-media-resource:concept-task>tasks</a>,
  16596. initially empty. Each <a href=#concept-task id=playing-the-media-resource:concept-task-2>task</a> in this list will be associated
  16597. 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
  16598. sort the list before the <a href=#concept-task id=playing-the-media-resource:concept-task-3>tasks</a> are queued.</p>
  16599. <p>Let <var>affected tracks</var> be a list of <a href=#text-track id=playing-the-media-resource:text-track-9>text
  16600. tracks</a>, initially empty.</p>
  16601. <p>When the steps below say to <dfn id=prepare-an-event>prepare an event</dfn> named <var>event</var> for a
  16602. <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
  16603. user agent must run these substeps:</p>
  16604. <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
  16605. 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>
  16606. 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
  16607. 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>
  16608. <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
  16609. 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
  16610. <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
  16611. 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
  16612. <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
  16613. 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
  16614. 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>
  16615. 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>
  16616. <p>Sort the <a href=#concept-task id=playing-the-media-resource:concept-task-6>tasks</a> in <var>events</var> in ascending
  16617. time order (<a href=#concept-task id=playing-the-media-resource:concept-task-7>tasks</a> with earlier times first).</p>
  16618. <p>Further sort <a href=#concept-task id=playing-the-media-resource:concept-task-8>tasks</a> in <var>events</var> that have
  16619. 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>
  16620. <p>Finally, sort <a href=#concept-task id=playing-the-media-resource:concept-task-10>tasks</a> in <var>events</var> that have
  16621. 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
  16622. those that fire <code id=playing-the-media-resource:event-media-exit-2><a href=#event-media-exit>exit</a></code> events.</p>
  16623. <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
  16624. <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
  16625. tracks</a>, and remove duplicates.</p>
  16626. <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
  16627. 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
  16628. <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
  16629. simple event</a> named <code id=playing-the-media-resource:event-media-cuechange-2><a href=#event-media-cuechange>cuechange</a></code> at the
  16630. <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
  16631. 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
  16632. 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>
  16633. 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>
  16634. <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
  16635. 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
  16636. merely if it is associated with the <a href=#text-track id=playing-the-media-resource:text-track-18>text track</a>.</p>
  16637. <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
  16638. <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>
  16639. until the document is active again.</p>
  16640. <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
  16641. from a <code>Document</code></a>, the user agent must run the following steps:</p>
  16642. <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
  16643. <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
  16644. 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
  16645. ⌛.)<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>,
  16646. 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>
  16647. </ol>
  16648. <h5 id=seeking>4.8.14.9 Seeking</h5>
  16649. <dl class=domintro><dt><var>media</var> . <code id=seeking:dom-media-seeking><a href=#dom-media-seeking>seeking</a></code><dd>
  16650. <p>Returns true if the user agent is currently seeking.</p>
  16651. <dt><var>media</var> . <code id=seeking:dom-media-seekable><a href=#dom-media-seekable>seekable</a></code><dd>
  16652. <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
  16653. resource</a> to which it is possible for the user agent to seek.</p>
  16654. <dt><var>media</var> . <code id=seeking:dom-media-fastseek><a href=#dom-media-fastseek>fastSeek</a></code>( <var>time</var> )<dd>
  16655. <p>Seeks to near the given <var>time</var> as fast as possible, trading precision for
  16656. 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>
  16657. <p>This does nothing if the media resource has not been loaded.</p>
  16658. </dl>
  16659. <p>The <dfn id=dom-media-seeking><code>seeking</code></dfn> attribute must initially have the
  16660. value false.</p>
  16661. <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
  16662. <i>approximate-for-speed</i> flag set.</p>
  16663. <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
  16664. <i>approximate-for-speed</i> flag set, it means that the user agent must run the following steps.
  16665. This algorithm interacts closely with the <a href=#event-loop id=seeking:event-loop>event loop</a> mechanism; in particular, it has
  16666. 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>
  16667. algorithm). Steps in that section are marked with ⌛.</p>
  16668. <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>
  16669. 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,
  16670. then another instance of this algorithm is already running. Abort that other instance of the
  16671. 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
  16672. continue the script. The remainder of these steps must be run asynchronously. With the exception
  16673. of the steps marked with ⌛, they could be aborted at any time by another instance of this
  16674. 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
  16675. 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
  16676. 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
  16677. the ranges given in the <code id=seeking:dom-media-seekable-2><a href=#dom-media-seekable>seekable</a></code> attribute, then let it
  16678. 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
  16679. 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
  16680. 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>
  16681. <p>If the <i>approximate-for-speed</i> flag is set, adjust the <var>new playback
  16682. position</var> to a value that will allow for playback to resume promptly. If <var>new
  16683. playback position</var> before this step is before <a href=#current-playback-position id=seeking:current-playback-position-2>current playback position</a>, then
  16684. the adjusted <var>new playback position</var> must also be before the <a href=#current-playback-position id=seeking:current-playback-position-3>current
  16685. playback position</a>. Similarly, if the <var>new playback position</var> before
  16686. this step is after <a href=#current-playback-position id=seeking:current-playback-position-4>current playback position</a>, then the adjusted <var>new
  16687. playback position</var> must also be after the <a href=#current-playback-position id=seeking:current-playback-position-5>current playback position</a>.</p>
  16688. <p class=example>For example, the user agent could snap to a nearby key frame, so that it
  16689. doesn't have to spend time decoding then discarding intermediate frames before resuming
  16690. playback.</p>
  16691. <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>
  16692. <p>Set the <a href=#current-playback-position id=seeking:current-playback-position-6>current playback position</a> to the <var>new playback
  16693. position</var>.</p>
  16694. <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>
  16695. 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
  16696. fired</a> at the element.</p>
  16697. <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
  16698. 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
  16699. handles looping), even before the user agent is actually able to render the media data for that
  16700. position (as determined in the next step).</p>
  16701. <p class=note>The <code id=seeking:dom-media-currenttime-2><a href=#dom-media-currenttime>currentTime</a></code> attribute returns
  16702. 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
  16703. therefore gets updated before script execution, separate from this algorithm.</p>
  16704. <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
  16705. the <var>new playback position</var> is available, and, if it is, until it has decoded
  16706. enough data to play back that position.</p>
  16707. <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
  16708. the remaining steps of this algorithm. (Steps in the <a href=#synchronous-section id=seeking:synchronous-section-3>synchronous section</a> are marked
  16709. with ⌛.)<li><p>⌛ Set the <code id=seeking:dom-media-seeking-5><a href=#dom-media-seeking>seeking</a></code> IDL attribute to
  16710. 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>
  16711. 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>
  16712. <hr>
  16713. <p>The <dfn id=dom-media-seekable><code>seekable</code></dfn> attribute must return a new
  16714. static <a href=#normalised-timeranges-object id=seeking:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the ranges of the
  16715. <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
  16716. attribute is evaluated.</p>
  16717. <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.
  16718. because it is a simple movie file and the user agent and the server support HTTP Range requests,
  16719. then the attribute would return an object with one range, whose start is the time of the first
  16720. 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
  16721. the time of the first frame plus the <code id=seeking:dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute's
  16722. value (which would equal the time of the last frame, and might be positive Infinity).</p>
  16723. <p class=note>The range might be continuously changing, e.g. if the user agent is buffering a
  16724. sliding window on an infinite stream. This is the behavior seen with DVRs viewing live TV, for
  16725. instance.</p>
  16726. <p><a href=#media-resource id=seeking:media-resource-7>Media resources</a> might be internally scripted or
  16727. interactive. Thus, a <a href=#media-element id=seeking:media-element-4>media element</a> could play in a non-linear fashion. If this
  16728. 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>
  16729. changes in a discontinuous fashion (so that the relevant events fire). If the <a href=#media-element id=seeking:media-element-5>media
  16730. 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
  16731. the media controller</a> appropriately instead. </p>
  16732. <h5 id=media-resources-with-multiple-media-tracks>4.8.14.10 Media resources with multiple media tracks</h5>
  16733. <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,
  16734. 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
  16735. foreign-language dubbed dialogues, director's commentaries, audio descriptions, alternative
  16736. angles, or sign-language overlays.</p>
  16737. <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>
  16738. <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
  16739. <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-3>media resource</a>.</p>
  16740. <dt><var>media</var> . <code id=media-resources-with-multiple-media-tracks:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code><dd>
  16741. <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
  16742. <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-4>media resource</a>.</p>
  16743. </dl>
  16744. <p>The <dfn id=dom-media-audiotracks><code>audioTracks</code></dfn> attribute of a
  16745. <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
  16746. 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
  16747. resource</a>. The same object must be returned each time.</p>
  16748. <p>The <dfn id=dom-media-videotracks><code>videoTracks</code></dfn> attribute of a
  16749. <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
  16750. 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
  16751. resource</a>. The same object must be returned each time.</p>
  16752. <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
  16753. <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
  16754. 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>
  16755. and <code id=media-resources-with-multiple-media-tracks:videotrack><a href=#videotrack>VideoTrack</a></code> objects are not, though.)</p>
  16756. <div class=example>
  16757. <p>In this example, a script defines a function that takes a URL to a video and a reference to an
  16758. element where the video is to be placed. That function then tries to load the video, and, once it
  16759. is loaded, checks to see if there is a sign-language track available. If there is, it also
  16760. displays that track. Both tracks are just placed in the given container; it's assumed that styles
  16761. have been applied to make this work in a pretty way!</p>
  16762. <pre>&lt;script>
  16763. function loadVideo(url, container) {
  16764. var controller = new MediaController();
  16765. var video = document.createElement('video');
  16766. video.src = url;
  16767. video.autoplay = true;
  16768. video.controls = true;
  16769. video.controller = controller;
  16770. container.appendChild(video);
  16771. video.onloadedmetadata = function (event) {
  16772. for (var i = 0; i &lt; video.videoTracks.length; i += 1) {
  16773. if (video.videoTracks[i].kind == 'sign') {
  16774. var sign = document.createElement('video');
  16775. sign.src = url + '#track=' + video.videoTracks[i].id;
  16776. sign.autoplay = true;
  16777. sign.controller = controller;
  16778. container.appendChild(sign);
  16779. return;
  16780. }
  16781. }
  16782. };
  16783. }
  16784. &lt;/script></pre>
  16785. </div>
  16786. <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>
  16787. <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
  16788. attributes defined in the previous section.</p>
  16789. <pre class=idl>interface <dfn id=audiotracklist>AudioTrackList</dfn> : <a href=#eventtarget id=audiotracklist-and-videotracklist-objects:eventtarget>EventTarget</a> {
  16790. readonly attribute unsigned long <a href=#dom-audiotracklist-length id=audiotracklist-and-videotracklist-objects:dom-audiotracklist-length>length</a>;
  16791. getter <a href=#audiotrack id=audiotracklist-and-videotracklist-objects:audiotrack>AudioTrack</a> (unsigned long index);
  16792. <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);
  16793. 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>;
  16794. 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>;
  16795. 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>;
  16796. };
  16797. interface <dfn id=audiotrack>AudioTrack</dfn> {
  16798. readonly attribute DOMString <a href=#dom-audiotrack-id id=audiotracklist-and-videotracklist-objects:dom-audiotrack-id>id</a>;
  16799. readonly attribute DOMString <a href=#dom-audiotrack-kind id=audiotracklist-and-videotracklist-objects:dom-audiotrack-kind>kind</a>;
  16800. readonly attribute DOMString <a href=#dom-audiotrack-label id=audiotracklist-and-videotracklist-objects:dom-audiotrack-label>label</a>;
  16801. readonly attribute DOMString <a href=#dom-audiotrack-language id=audiotracklist-and-videotracklist-objects:dom-audiotrack-language>language</a>;
  16802. attribute boolean <a href=#dom-audiotrack-enabled id=audiotracklist-and-videotracklist-objects:dom-audiotrack-enabled>enabled</a>;
  16803. };
  16804. interface <dfn id=videotracklist>VideoTrackList</dfn> : <a href=#eventtarget id=audiotracklist-and-videotracklist-objects:eventtarget-2>EventTarget</a> {
  16805. readonly attribute unsigned long <a href=#dom-videotracklist-length id=audiotracklist-and-videotracklist-objects:dom-videotracklist-length>length</a>;
  16806. getter <a href=#videotrack id=audiotracklist-and-videotracklist-objects:videotrack>VideoTrack</a> (unsigned long index);
  16807. <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);
  16808. readonly attribute long <a href=#dom-videotracklist-selectedindex id=audiotracklist-and-videotracklist-objects:dom-videotracklist-selectedindex>selectedIndex</a>;
  16809. 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>;
  16810. 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>;
  16811. 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>;
  16812. };
  16813. interface <dfn id=videotrack>VideoTrack</dfn> {
  16814. readonly attribute DOMString <a href=#dom-videotrack-id id=audiotracklist-and-videotracklist-objects:dom-videotrack-id>id</a>;
  16815. readonly attribute DOMString <a href=#dom-videotrack-kind id=audiotracklist-and-videotracklist-objects:dom-videotrack-kind>kind</a>;
  16816. readonly attribute DOMString <a href=#dom-videotrack-label id=audiotracklist-and-videotracklist-objects:dom-videotrack-label>label</a>;
  16817. readonly attribute DOMString <a href=#dom-videotrack-language id=audiotracklist-and-videotracklist-objects:dom-videotrack-language>language</a>;
  16818. attribute boolean <a href=#dom-videotrack-selected id=audiotracklist-and-videotracklist-objects:dom-videotrack-selected>selected</a>;
  16819. };</pre>
  16820. <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>
  16821. <p>Returns the number of tracks in the list.</p>
  16822. <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>
  16823. <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>
  16824. <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>
  16825. <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>
  16826. <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>
  16827. <p>Returns the ID of the given track. This is the ID that can be used with a fragment identifier
  16828. if the format supports the <cite>Media Fragments URI</cite> syntax, and that can be used with
  16829. the <code>getTrackById()</code> method. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
  16830. <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>
  16831. <p>Returns the category the given track falls into. The <a href=#dom-TrackList-getKind-categories>possible track categories</a> are given below.</p>
  16832. <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>
  16833. <p>Returns the label of the given track, if known, or the empty string otherwise.</p>
  16834. <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>
  16835. <p>Returns the language of the given track, if known, or the empty string otherwise.</p>
  16836. <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>
  16837. <p>Returns true if the given track is active, and false otherwise.</p>
  16838. <p>Can be set, to change whether the track is enabled or not. If multiple audio tracks are
  16839. enabled simultaneously, they are mixed.</p>
  16840. <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>
  16841. <p>Returns the index of the currently selected track, if any, or −1 otherwise.</p>
  16842. <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>
  16843. <p>Returns true if the given track is active, and false otherwise.</p>
  16844. <p>Can be set, to change whether the track is selected or not. Either zero or one video track is
  16845. selected; selecting a new track while a previous one is selected will unselect the previous
  16846. one.</p>
  16847. </dl>
  16848. <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,
  16849. of which zero or more can be enabled at a time. Each audio track is represented by an
  16850. <code id=audiotracklist-and-videotracklist-objects:audiotrack-5><a href=#audiotrack>AudioTrack</a></code> object.</p>
  16851. <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
  16852. which zero or one can be selected at a time. Each video track is represented by a
  16853. <code id=audiotracklist-and-videotracklist-objects:videotrack-5><a href=#videotrack>VideoTrack</a></code> object.</p>
  16854. <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
  16855. 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,
  16856. then that order must be used; otherwise, the order must be the relative order in which the tracks
  16857. 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>
  16858. of the list.</p>
  16859. <p class=note>Each track in one of these objects thus has an index; the first has the index
  16860. 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
  16861. resource</a> dynamically adds or removes audio or video tracks, then the indices of the tracks
  16862. 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
  16863. previous tracks will be removed and replaced with new tracks.</p>
  16864. <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
  16865. the number of tracks represented by their objects at the time of getting.</p>
  16866. <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
  16867. <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
  16868. tracks represented by the respective object minus one, if any tracks are represented. If an
  16869. <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
  16870. <a href=#supported-property-indices id=audiotracklist-and-videotracklist-objects:supported-property-indices-2>supported property indices</a>.</p>
  16871. <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
  16872. <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>
  16873. <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
  16874. <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
  16875. <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
  16876. <var>id</var> argument (in the natural order of the list, as defined above). When no
  16877. tracks match the given argument, the methods must return null.</p>
  16878. <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
  16879. <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.
  16880. These aspects of a track are permanent for the lifetime of the track; even if a track is removed
  16881. 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>
  16882. objects, those aspects do not change.</p>
  16883. <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
  16884. 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>
  16885. must be set to false (disabled). The <a href=#concept-media-load-resource id=audiotracklist-and-videotracklist-objects:concept-media-load-resource>resource fetch
  16886. algorithm</a> can override this.</p>
  16887. <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
  16888. 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
  16889. 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>
  16890. <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
  16891. 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
  16892. in a format that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the
  16893. identifier returned for a particular track must be the same identifier that would enable the track
  16894. 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>
  16895. <p class=example>For example, in Ogg files, this would be the Name header field of the track. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a></p>
  16896. <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
  16897. of the track, if it has one, or the empty string otherwise.</p>
  16898. <p>The category of a track is the string given in the first column of the table below that is the
  16899. most appropriate for the track based on the definitions in the table's second and third columns,
  16900. 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
  16901. in the third column of a row says what the category given in the cell in the first column of that
  16902. row applies to; a category is only appropriate for an audio track if it applies to audio tracks,
  16903. and a category is only appropriate for video tracks if it applies to video tracks. Categories must
  16904. 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
  16905. 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>
  16906. <p>For Ogg files, the Role header field of the track gives the relevant metadata. For DASH media
  16907. resources, the <code>Role</code> element conveys the information. For WebM, only the
  16908. <code>FlagDefault</code> element currently maps to a value. The <cite>Sourcing In-band
  16909. Media Resource Tracks from Media Containers into HTML</cite> specification has further details.
  16910. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a> <a href=#refsDASH>[DASH]</a> <a href=#refsWEBMCG>[WEBMCG]</a> <a href=#refsINBAND>[INBAND]</a></p>
  16911. <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
  16912. <th>Definition
  16913. <th>Applies to...<th>Examples
  16914. <tbody><tr><td>"<dfn id=value-track-kind-alternate><code>alternative</code></dfn>"
  16915. <td>A possible alternative to the main track, e.g. a different take of a song (audio), or a different angle (video).
  16916. <td>Audio and video.
  16917. <td>Ogg: "audio/alternate" or "video/alternate"; DASH: "alternate" without "main" and "commentary" roles, and, for audio, without the "dub" role (other roles ignored).
  16918. <tr><td>"<dfn id=value-track-kind-caption><code>captions</code></dfn>"
  16919. <td>A version of the main video track with captions burnt in. (For legacy content; new content would use text tracks.)
  16920. <td>Video only.
  16921. <td>DASH: "caption" and "main" roles together (other roles ignored).
  16922. <tr><td>"<dfn id=value-track-kind-descriptions><code>descriptions</code></dfn>"
  16923. <td>An audio description of a video track.
  16924. <td>Audio only.
  16925. <td>Ogg: "audio/audiodesc".
  16926. <tr><td>"<dfn id=value-track-kind-main><code>main</code></dfn>"
  16927. <td>The primary audio or video track.
  16928. <td>Audio and video.
  16929. <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).
  16930. <tr><td>"<dfn id=value-track-kind-main-desc><code>main-desc</code></dfn>"
  16931. <td>The primary audio track, mixed with audio descriptions.
  16932. <td>Audio only.
  16933. <td>AC3 audio in MPEG-2 TS: bsmod=2 and full_svc=1.
  16934. <tr><td>"<dfn id=value-track-kind-sign><code>sign</code></dfn>"
  16935. <td>A sign-language interpretation of an audio track.
  16936. <td>Video only.
  16937. <td>Ogg: "video/sign".
  16938. <tr><td>"<dfn id=value-track-kind-subtitle><code>subtitles</code></dfn>"
  16939. <td>A version of the main video track with subtitles burnt in. (For legacy content; new content would use text tracks.)
  16940. <td>Video only.
  16941. <td>DASH: "subtitle" and "main" roles together (other roles ignored).
  16942. <tr><td>"<dfn id=value-track-kind-translation><code>translation</code></dfn>"
  16943. <td>A translated version of the main audio track.
  16944. <td>Audio only.
  16945. <td>Ogg: "audio/dub". DASH: "dub" and "main" roles together (other roles ignored).
  16946. <tr><td>"<dfn id=value-track-kind-commentary><code>commentary</code></dfn>"
  16947. <td>Commentary on the primary audio or video track, e.g. a director's commentary.
  16948. <td>Audio and video.
  16949. <td>DASH: "commentary" role without "main" role (other roles ignored).
  16950. <tr><td>"<dfn id=value-track-kind-none><code></code></dfn>" (empty string)
  16951. <td>No explicit kind, or the kind given by the track's metadata is not recognised by the user agent.
  16952. <td>Audio and video.
  16953. <td>Any other track type, track role, or combination of track roles not described above.
  16954. </table>
  16955. <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
  16956. of the track, if it has one, or the empty string otherwise. <a href=#refsINBAND>[INBAND]</a></p>
  16957. <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
  16958. BCP 47 language tag of the language of the track, if it has one, or the empty string otherwise. If
  16959. the user agent is not able to express that language as a BCP 47 language tag (for example because
  16960. 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
  16961. a defined interpretation), then the method must return the empty string, as if the track had no
  16962. language. <a href=#refsINBAND>[INBAND]</a></p>
  16963. <p>The <dfn id=dom-audiotrack-enabled><code>AudioTrack.enabled</code></dfn> attribute, on
  16964. getting, must return true if the track is currently enabled, and false otherwise. On setting, it
  16965. must enable the track if the new value is true, and disable it otherwise. (If the track is no
  16966. 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
  16967. 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>
  16968. <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
  16969. disabled is enabled, and whenever one that was enabled is disabled, the user agent must
  16970. <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>
  16971. <p>The <dfn id=dom-videotracklist-selectedindex><code>VideoTrackList.selectedIndex</code></dfn> attribute
  16972. 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>
  16973. object does not currently represent any tracks, or if none of the tracks are selected, it must
  16974. instead return −1.</p>
  16975. <p>The <dfn id=dom-videotrack-selected><code>VideoTrack.selected</code></dfn> attribute, on
  16976. getting, must return true if the track is currently selected, and false otherwise. On setting, it
  16977. must select the track if the new value is true, and unselect it otherwise. If the track is in a
  16978. <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
  16979. 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
  16980. being selected or unselected has no effect beyond changing the value of the attribute on the
  16981. <code id=audiotracklist-and-videotracklist-objects:videotrack-13><a href=#videotrack>VideoTrack</a></code> object.)</p>
  16982. <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
  16983. 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
  16984. 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
  16985. event</a> named <code id=audiotracklist-and-videotracklist-objects:event-media-change-2><a href=#event-media-change>change</a></code> at the
  16986. <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
  16987. the <code id=audiotracklist-and-videotracklist-objects:event-media-resize><a href=#event-media-resize>resize</a></code> event, if any.</p>
  16988. <hr>
  16989. <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>,
  16990. 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>
  16991. interfaces:</p>
  16992. <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>
  16993. <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>
  16994. <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>
  16995. <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>
  16996. </table>
  16997. <h6 id=selecting-specific-audio-and-video-tracks-declaratively>4.8.14.10.2 Selecting specific audio and video tracks declaratively</h6>
  16998. <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
  16999. should play, but it is also possible to select specific tracks declaratively, by specifying
  17000. 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
  17001. 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
  17002. 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>
  17003. <div class=example>
  17004. <p>In this example, a video that uses a format that supports the <cite>Media Fragments URI</cite>
  17005. fragment identifier syntax is embedded in such a way that the alternative angles labeled
  17006. "Alternative" are enabled instead of the default video track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
  17007. <pre>&lt;video src="myvideo#track=Alternative">&lt;/video></pre>
  17008. </div>
  17009. <h5 id=synchronising-multiple-media-elements>4.8.14.11 Synchronising multiple media elements</h5>
  17010. <h6 id=introduction-4>4.8.14.11.1 Introduction</h6>
  17011. <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
  17012. <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
  17013. track can be overlaid on a video track, with the two being kept in sync.</p>
  17014. <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
  17015. <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
  17016. <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>
  17017. <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
  17018. to be <i>slaved</i> to their controller. The <code id=introduction-4:mediacontroller-7><a href=#mediacontroller>MediaController</a></code> modifies the playback
  17019. rate and the playback volume of each of the <a href=#media-element id=introduction-4:media-element-5>media elements</a>
  17020. slaved to it, and ensures that when any of its slaved <a href=#media-element id=introduction-4:media-element-6>media
  17021. elements</a> unexpectedly stall, the others are stopped at the same time.</p>
  17022. <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
  17023. 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
  17024. looping is disabled.</p>
  17025. <h6 id=media-controllers>4.8.14.11.2 Media controllers</h6>
  17026. <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>" };
  17027. [<a href=#dom-mediacontroller id=media-controllers:dom-mediacontroller>Constructor</a>]
  17028. interface <dfn id=mediacontroller>MediaController</dfn> : <a href=#eventtarget id=media-controllers:eventtarget>EventTarget</a> {
  17029. 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
  17030. readonly attribute <a href=#timeranges id=media-controllers:timeranges>TimeRanges</a> <a href=#dom-mediacontroller-buffered id=media-controllers:dom-mediacontroller-buffered>buffered</a>;
  17031. 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>;
  17032. readonly attribute unrestricted double <a href=#dom-mediacontroller-duration id=media-controllers:dom-mediacontroller-duration>duration</a>;
  17033. attribute double <a href=#dom-mediacontroller-currenttime id=media-controllers:dom-mediacontroller-currenttime>currentTime</a>;
  17034. readonly attribute boolean <a href=#dom-mediacontroller-paused id=media-controllers:dom-mediacontroller-paused>paused</a>;
  17035. readonly attribute <a href=#mediacontrollerplaybackstate id=media-controllers:mediacontrollerplaybackstate>MediaControllerPlaybackState</a> <a href=#dom-mediacontroller-playbackstate id=media-controllers:dom-mediacontroller-playbackstate>playbackState</a>;
  17036. 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>;
  17037. void <a href=#dom-mediacontroller-pause id=media-controllers:dom-mediacontroller-pause>pause</a>();
  17038. void <a href=#dom-mediacontroller-unpause id=media-controllers:dom-mediacontroller-unpause>unpause</a>();
  17039. void <a href=#dom-mediacontroller-play id=media-controllers:dom-mediacontroller-play>play</a>(); // calls play() on all media elements as well
  17040. attribute double <a href=#dom-mediacontroller-defaultplaybackrate id=media-controllers:dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a>;
  17041. attribute double <a href=#dom-mediacontroller-playbackrate id=media-controllers:dom-mediacontroller-playbackrate>playbackRate</a>;
  17042. attribute double <a href=#dom-mediacontroller-volume id=media-controllers:dom-mediacontroller-volume>volume</a>;
  17043. attribute boolean <a href=#dom-mediacontroller-muted id=media-controllers:dom-mediacontroller-muted>muted</a>;
  17044. attribute <a href=#eventhandler id=media-controllers:eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onemptied id=media-controllers:handler-mediacontroller-onemptied>onemptied</a>;
  17045. attribute <a href=#eventhandler id=media-controllers:eventhandler-2>EventHandler</a> <a href=#handler-mediacontroller-onloadedmetadata id=media-controllers:handler-mediacontroller-onloadedmetadata>onloadedmetadata</a>;
  17046. attribute <a href=#eventhandler id=media-controllers:eventhandler-3>EventHandler</a> <a href=#handler-mediacontroller-onloadeddata id=media-controllers:handler-mediacontroller-onloadeddata>onloadeddata</a>;
  17047. attribute <a href=#eventhandler id=media-controllers:eventhandler-4>EventHandler</a> <a href=#handler-mediacontroller-oncanplay id=media-controllers:handler-mediacontroller-oncanplay>oncanplay</a>;
  17048. attribute <a href=#eventhandler id=media-controllers:eventhandler-5>EventHandler</a> <a href=#handler-mediacontroller-oncanplaythrough id=media-controllers:handler-mediacontroller-oncanplaythrough>oncanplaythrough</a>;
  17049. attribute <a href=#eventhandler id=media-controllers:eventhandler-6>EventHandler</a> <a href=#handler-mediacontroller-onplaying id=media-controllers:handler-mediacontroller-onplaying>onplaying</a>;
  17050. attribute <a href=#eventhandler id=media-controllers:eventhandler-7>EventHandler</a> <a href=#handler-mediacontroller-onended id=media-controllers:handler-mediacontroller-onended>onended</a>;
  17051. attribute <a href=#eventhandler id=media-controllers:eventhandler-8>EventHandler</a> <a href=#handler-mediacontroller-onwaiting id=media-controllers:handler-mediacontroller-onwaiting>onwaiting</a>;
  17052. attribute <a href=#eventhandler id=media-controllers:eventhandler-9>EventHandler</a> <a href=#handler-mediacontroller-ondurationchange id=media-controllers:handler-mediacontroller-ondurationchange>ondurationchange</a>;
  17053. attribute <a href=#eventhandler id=media-controllers:eventhandler-10>EventHandler</a> <a href=#handler-mediacontroller-ontimeupdate id=media-controllers:handler-mediacontroller-ontimeupdate>ontimeupdate</a>;
  17054. attribute <a href=#eventhandler id=media-controllers:eventhandler-11>EventHandler</a> <a href=#handler-mediacontroller-onplay id=media-controllers:handler-mediacontroller-onplay>onplay</a>;
  17055. attribute <a href=#eventhandler id=media-controllers:eventhandler-12>EventHandler</a> <a href=#handler-mediacontroller-onpause id=media-controllers:handler-mediacontroller-onpause>onpause</a>;
  17056. attribute <a href=#eventhandler id=media-controllers:eventhandler-13>EventHandler</a> <a href=#handler-mediacontroller-onratechange id=media-controllers:handler-mediacontroller-onratechange>onratechange</a>;
  17057. attribute <a href=#eventhandler id=media-controllers:eventhandler-14>EventHandler</a> <a href=#handler-mediacontroller-onvolumechange id=media-controllers:handler-mediacontroller-onvolumechange>onvolumechange</a>;
  17058. };</pre>
  17059. <dl class=domintro><dt><var>controller</var> = new <code id=media-controllers:dom-mediacontroller-2><a href=#dom-mediacontroller>MediaController</a></code>()<dd>
  17060. <p>Returns a new <code id=media-controllers:mediacontroller><a href=#mediacontroller>MediaController</a></code> object.</p>
  17061. <dt><var>media</var> . <code id=media-controllers:dom-media-controller><a href=#dom-media-controller>controller</a></code> [ = <var>controller</var> ]<dd>
  17062. <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;
  17063. returns null otherwise.</p>
  17064. <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>
  17065. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-readystate-2><a href=#dom-mediacontroller-readystate>readyState</a></code><dd>
  17066. <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
  17067. as a result of <a href=#report-the-controller-state id=media-controllers:report-the-controller-state>reporting the controller state</a>.
  17068. 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
  17069. elements</a>.</p>
  17070. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-buffered-2><a href=#dom-mediacontroller-buffered>buffered</a></code><dd>
  17071. <p>Returns a <code id=media-controllers:timeranges-4><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
  17072. 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>
  17073. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-seekable-2><a href=#dom-mediacontroller-seekable>seekable</a></code><dd>
  17074. <p>Returns a <code id=media-controllers:timeranges-5><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
  17075. into which the user agent can seek for all the slaved <a href=#media-element id=media-controllers:media-element-4>media
  17076. elements</a>.</p>
  17077. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-duration-2><a href=#dom-mediacontroller-duration>duration</a></code><dd>
  17078. <p>Returns the difference between the earliest playable moment and the latest playable moment
  17079. (not considering whether the data in question is actually buffered or directly seekable, but not
  17080. including time in the future for infinite streams). Will return zero if there is no media.</p>
  17081. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-currenttime-2><a href=#dom-mediacontroller-currenttime>currentTime</a></code> [ = <var>value</var> ]<dd>
  17082. <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
  17083. time and the current <code id=media-controllers:dom-mediacontroller-duration-3><a href=#dom-mediacontroller-duration>duration</a></code>.</p>
  17084. <p>Can be set, to seek to the given time.</p>
  17085. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-paused-2><a href=#dom-mediacontroller-paused>paused</a></code><dd>
  17086. <p>Returns true if playback is paused; false otherwise. When this attribute is true, any
  17087. <a href=#media-element id=media-controllers:media-element-5>media element</a> slaved to this controller will be stopped.</p>
  17088. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-playbackstate-2><a href=#dom-mediacontroller-playbackstate>playbackState</a></code><dd>
  17089. <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
  17090. as a result of <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-2>reporting the controller state</a>.
  17091. 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
  17092. playing, "<code id=media-controllers:dom-mediacontroller-ended-2><a href=#dom-mediacontroller-ended>ended</a></code>", indicating that the media is
  17093. 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>,
  17094. or "<code id=media-controllers:dom-mediacontroller-waiting-2><a href=#dom-mediacontroller-waiting>waiting</a></code>", indicating that the media is not
  17095. playing for some other reason (e.g. the <code id=media-controllers:mediacontroller-6><a href=#mediacontroller>MediaController</a></code> is paused).</p>
  17096. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-pause-2><a href=#dom-mediacontroller-pause>pause</a></code>()<dd>
  17097. <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-3><a href=#dom-mediacontroller-paused>paused</a></code> attribute to true.</p>
  17098. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-unpause-2><a href=#dom-mediacontroller-unpause>unpause</a></code>()<dd>
  17099. <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-4><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false.</p>
  17100. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-play-2><a href=#dom-mediacontroller-play>play</a></code>()<dd>
  17101. <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-5><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false and
  17102. 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>
  17103. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-played-2><a href=#dom-mediacontroller-played>played</a></code><dd>
  17104. <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
  17105. the slaved <a href=#media-element id=media-controllers:media-element-6>media elements</a> that have been played.</p>
  17106. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-defaultplaybackrate-2><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var>value</var> ]<dd>
  17107. <p>Returns the default rate of playback.</p>
  17108. <p>Can be set, to change the default rate of playback.</p>
  17109. <p>This default rate has no direct effect on playback, but if the user switches to a
  17110. fast-forward mode, when they return to the normal playback mode, it is expected that rate of
  17111. playback (<code id=media-controllers:dom-mediacontroller-playbackrate-2><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will be returned
  17112. to this default rate.</p>
  17113. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-playbackrate-3><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> [ = <var>value</var> ]<dd>
  17114. <p>Returns the current rate of playback.</p>
  17115. <p>Can be set, to change the rate of playback.</p>
  17116. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-volume-2><a href=#dom-mediacontroller-volume>volume</a></code> [ = <var>value</var> ]<dd>
  17117. <p>Returns the current playback volume multiplier, as a number in the range 0.0 to 1.0, where
  17118. 0.0 is the quietest and 1.0 the loudest.</p>
  17119. <p>Can be set, to change the volume multiplier.</p>
  17120. <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>
  17121. <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-muted-2><a href=#dom-mediacontroller-muted>muted</a></code> [ = <var>value</var> ]<dd>
  17122. <p>Returns true if all audio is muted (regardless of other attributes either on the controller
  17123. or on any <a href=#media-element id=media-controllers:media-element-7>media elements</a> slaved to this controller), and
  17124. false otherwise.</p>
  17125. <p>Can be set, to change whether the audio is muted or not.</p>
  17126. </dl>
  17127. <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
  17128. <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
  17129. controller</a>. (If it is created <em>with</em> such an attribute, then that attribute
  17130. initializes the <a href=#current-media-controller id=media-controllers:current-media-controller-2>current media controller</a>, as defined below.)</p>
  17131. <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
  17132. <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
  17133. <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
  17134. 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
  17135. were last associated with the <code id=media-controllers:mediacontroller-11><a href=#mediacontroller>MediaController</a></code>.</p>
  17136. <hr>
  17137. <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
  17138. 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
  17139. any, or null otherwise. On setting, the user agent must run the following steps:</p>
  17140. <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
  17141. 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
  17142. 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
  17143. 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
  17144. 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
  17145. 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
  17146. controller</var> are the same (whether both null or both the same controller) then abort these
  17147. 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
  17148. 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
  17149. 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
  17150. state</a> for <var>new controller</var>.</ol>
  17151. <hr>
  17152. <p>The <dfn id=dom-mediacontroller><code>MediaController()</code></dfn> constructor, when
  17153. invoked, must return a newly created <code id=media-controllers:mediacontroller-12><a href=#mediacontroller>MediaController</a></code> object.</p>
  17154. <hr>
  17155. <p>The <dfn id=dom-mediacontroller-readystate><code>readyState</code></dfn> attribute must
  17156. 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
  17157. 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
  17158. controller state</a> algorithm below.</p>
  17159. <p>The <dfn id=dom-mediacontroller-seekable><code>seekable</code></dfn> attribute must return
  17160. a new static <a href=#normalised-timeranges-object id=media-controllers:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the
  17161. intersection of the ranges of the <a href=#media-resource id=media-controllers:media-resource>media resources</a> of the
  17162. <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
  17163. attribute is evaluated.</p>
  17164. <p>The <dfn id=dom-mediacontroller-buffered><code>buffered</code></dfn> attribute must return
  17165. a new static <a href=#normalised-timeranges-object id=media-controllers:normalised-timeranges-object-2>normalised <code>TimeRanges</code> object</a> that represents the
  17166. intersection of the ranges of the <a href=#media-resource id=media-controllers:media-resource-2>media resources</a> of the
  17167. <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
  17168. evaluated. Users agents must accurately determine the ranges available, even for media streams
  17169. where this can only be determined by tedious inspection.</p>
  17170. <p>The <dfn id=dom-mediacontroller-duration><code>duration</code></dfn> attribute must return
  17171. the <a href=#media-controller-duration id=media-controllers:media-controller-duration>media controller duration</a>.</p>
  17172. <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
  17173. duration</a> changes, whichever happens least often, the user agent must <a href=#queue-a-task id=media-controllers:queue-a-task>queue a
  17174. 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
  17175. <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
  17176. 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
  17177. <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
  17178. controller</a> to <a href=#media-controller-duration id=media-controllers:media-controller-duration-5>media controller duration</a>.</p>
  17179. <p>The <dfn id=dom-mediacontroller-currenttime><code>currentTime</code></dfn> attribute must
  17180. 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
  17181. media controller</a> to the new value.</p>
  17182. <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
  17183. 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
  17184. 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
  17185. <code id=media-controllers:mediacontroller-18><a href=#mediacontroller>MediaController</a></code>.</p>
  17186. <hr>
  17187. <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
  17188. can be changed into a <dfn id=paused-media-controller>paused media controller</dfn> and back either via the user agent's user
  17189. 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
  17190. interface to the user</a>) or by script using the APIs defined in this section (see below).</p>
  17191. <p>The <dfn id=dom-mediacontroller-paused><code>paused</code></dfn> attribute must return
  17192. 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
  17193. false otherwise.</p>
  17194. <p>When the <dfn id=dom-mediacontroller-pause><code>pause()</code></dfn> method is invoked,
  17195. 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
  17196. 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>,
  17197. <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
  17198. <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>
  17199. <p>When the <dfn id=dom-mediacontroller-unpause><code>unpause()</code></dfn> method is
  17200. 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
  17201. 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>,
  17202. <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
  17203. <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>
  17204. <p>When the <dfn id=dom-mediacontroller-play><code>play()</code></dfn> method is invoked, the
  17205. 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>
  17206. <p>The <dfn id=dom-mediacontroller-playbackstate><code>playbackState</code></dfn> attribute
  17207. 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>
  17208. 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
  17209. controller state</a> algorithm below.</p>
  17210. <p>The <dfn id=dom-mediacontroller-played><code>played</code></dfn> attribute must return a
  17211. 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
  17212. 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
  17213. 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
  17214. attribute is evaluated.</p>
  17215. <hr>
  17216. <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
  17217. <dfn id=media-controller-playback-rate>media controller playback rate</dfn>, which must both be set to 1.0 when the
  17218. <code id=media-controllers:mediacontroller-32><a href=#mediacontroller>MediaController</a></code> object is created.</p>
  17219. <p>The <dfn id=dom-mediacontroller-defaultplaybackrate><code>defaultPlaybackRate</code></dfn>
  17220. 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
  17221. default playback rate</a>, and on setting, must set the <code id=media-controllers:mediacontroller-34><a href=#mediacontroller>MediaController</a></code>'s
  17222. <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
  17223. 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
  17224. <code id=media-controllers:mediacontroller-35><a href=#mediacontroller>MediaController</a></code>.</p>
  17225. <p>The <dfn id=dom-mediacontroller-playbackrate><code>playbackRate</code></dfn> attribute, on
  17226. 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
  17227. 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
  17228. 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
  17229. event</a> named <code id=media-controllers:event-mediacontroller-ratechange-2><a href=#event-mediacontroller-ratechange>ratechange</a></code> at the
  17230. <code id=media-controllers:mediacontroller-38><a href=#mediacontroller>MediaController</a></code>.</p>
  17231. <hr>
  17232. <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
  17233. 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
  17234. mute override</dfn>, much must initially be false.</p>
  17235. <p>The <dfn id=dom-mediacontroller-volume><code>volume</code></dfn> attribute, on getting,
  17236. 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>,
  17237. and on setting, if the new value is in the range 0.0 to 1.0 inclusive, must set the
  17238. <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
  17239. 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
  17240. <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
  17241. setting, an <code id=media-controllers:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>
  17242. <p>The <dfn id=dom-mediacontroller-muted><code>muted</code></dfn> attribute, on getting, must
  17243. 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
  17244. 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>
  17245. 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
  17246. <code id=media-controllers:mediacontroller-46><a href=#mediacontroller>MediaController</a></code>.</p>
  17247. <hr>
  17248. <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
  17249. elements</a> of a <code id=media-controllers:mediacontroller-47><a href=#mediacontroller>MediaController</a></code> have a defined temporal relationship which
  17250. provides relative offsets between the zero time of each such <a href=#media-resource id=media-controllers:media-resource-5>media resource</a>: for
  17251. <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
  17252. relative offsets are the difference between their <a href=#timeline-offset id=media-controllers:timeline-offset-2>timeline offset</a>; the zero times of
  17253. 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>
  17254. are not offset from each other (i.e. the origins of their timelines are cotemporal); and finally,
  17255. 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>
  17256. (if any) is not offset from the zero times of the <a href=#media-resource id=media-controllers:media-resource-9>media
  17257. 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
  17258. 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
  17259. earliest <a href=#timeline-offset id=media-controllers:timeline-offset-7>timeline offset</a>).</p>
  17260. <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
  17261. 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
  17262. 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
  17263. resource</a>'s timeline (the last defined position on that timeline); otherwise, the
  17264. <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
  17265. 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
  17266. that <a href=#media-resource id=media-controllers:media-resource-16>media resource</a>.</p>
  17267. <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
  17268. <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>
  17269. of the <code id=media-controllers:mediacontroller-49><a href=#mediacontroller>MediaController</a></code> are temporally aligned according to their defined offsets. The
  17270. <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
  17271. 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>
  17272. 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
  17273. 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
  17274. resource end position</a> of the <a href=#media-resource id=media-controllers:media-resource-19>media resources</a> of the
  17275. <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
  17276. <code id=media-controllers:mediacontroller-54><a href=#mediacontroller>MediaController</a></code> timeline.</p>
  17277. <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
  17278. 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
  17279. <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
  17280. <a href=#media-controller-position id=media-controllers:media-controller-position-4>media controller position</a> is initially zero.</p>
  17281. <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
  17282. <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
  17283. element</a>'s timeline.</p>
  17284. <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>
  17285. <ol><li><p>If the <var>new playback position</var> is less than zero, then set it to
  17286. 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
  17287. 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
  17288. 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
  17289. media element</a> to the <var>new playback position</var> relative to the <a href=#media-element id=media-controllers:media-element-16>media
  17290. element</a> timeline.</ol>
  17291. <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
  17292. <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
  17293. 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
  17294. its <code id=media-controllers:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute set to true, or, all of its
  17295. <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>
  17296. attribute set to true.</p>
  17297. <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
  17298. <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
  17299. <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
  17300. 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
  17301. 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
  17302. 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>
  17303. <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
  17304. <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
  17305. 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
  17306. possible position</a> relative to the <code id=media-controllers:mediacontroller-64><a href=#mediacontroller>MediaController</a></code>'s timeline or after the end
  17307. 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>
  17308. <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
  17309. controller</a> and it has at least one <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-21>slaved media
  17310. 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>,
  17311. 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
  17312. 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
  17313. <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
  17314. elements</a>.</p>
  17315. <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
  17316. 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
  17317. position</a> must be decremented by <var>ΔT</var>.</p>
  17318. <p class=note>In some situations, e.g. when playing back a live stream without buffering
  17319. anything, the <a href=#media-controller-position id=media-controllers:media-controller-position-10>media controller position</a> would increase monotonically as described
  17320. above at the same rate as the <var>ΔT</var> described in the previous paragraph
  17321. 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
  17322. position</a> would appear to remain constant (probably with the value 0).</p>
  17323. <hr>
  17324. <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
  17325. 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
  17326. playback state</dfn>, which is either <i>playing</i>, <i>waiting</i>, or <i>ended</i>.</p>
  17327. <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
  17328. 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
  17329. set to <i>waiting</i>.</p>
  17330. <p>When a user agent is required to <dfn id=report-the-controller-state>report the controller state</dfn> for a
  17331. <code id=media-controllers:mediacontroller-73><a href=#mediacontroller>MediaController</a></code>, the user agent must run the following steps:</p>
  17332. <ol><li>
  17333. <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>
  17334. <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
  17335. elements</a>.</p>
  17336. <li>
  17337. <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
  17338. less than the <var>new readiness state</var>, then run these substeps:</p>
  17339. <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
  17340. recently reported readiness state</a>.<li><p><i>Loop</i>: Increment <var>next state</var> by one.<li>
  17341. <p><a href=#queue-a-task id=media-controllers:queue-a-task-9>Queue a task</a> to run the following steps:</p>
  17342. <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
  17343. name is the event name corresponding to the value of <var>next state</var> given in
  17344. the table below.</ol>
  17345. <li><p>If <var>next state</var> is less than <var>new readiness state</var>,
  17346. then return to the step labeled <i>loop</i>.</ol>
  17347. <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
  17348. 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
  17349. 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,
  17350. whose name is the event name corresponding to the value of <var>new readiness
  17351. state</var> given in the table below.</p>
  17352. <table><thead><tr><th>Value of <var>new readiness state</var>
  17353. <th>Event name
  17354. <tbody><tr><td> 0
  17355. <td> <code id=media-controllers:event-mediacontroller-emptied><a href=#event-mediacontroller-emptied>emptied</a></code>
  17356. <tr><td> 1
  17357. <td> <code id=media-controllers:event-mediacontroller-loadedmetadata><a href=#event-mediacontroller-loadedmetadata>loadedmetadata</a></code>
  17358. <tr><td> 2
  17359. <td> <code id=media-controllers:event-mediacontroller-loadeddata><a href=#event-mediacontroller-loadeddata>loadeddata</a></code>
  17360. <tr><td> 3
  17361. <td> <code id=media-controllers:event-mediacontroller-canplay><a href=#event-mediacontroller-canplay>canplay</a></code>
  17362. <tr><td> 4
  17363. <td> <code id=media-controllers:event-mediacontroller-canplaythrough><a href=#event-mediacontroller-canplaythrough>canplaythrough</a></code>
  17364. </table>
  17365. <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>
  17366. be <var>new readiness state</var>.<li>
  17367. <p>Initialise <var>new playback state</var> by setting it to the state given for the
  17368. first matching condition from the following list:</p>
  17369. <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
  17370. <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
  17371. 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>
  17372. <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>
  17373. is not equal to <var>new playback state</var> and the <var>new playback
  17374. 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
  17375. <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
  17376. <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
  17377. 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,
  17378. 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
  17379. 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>
  17380. object.<li>
  17381. <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
  17382. 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
  17383. following steps:</p>
  17384. <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
  17385. 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
  17386. is the value given in the third column of the row of the following table whose first column
  17387. contains the <var>new playback state</var>.</ol>
  17388. <table><thead><tr><th>New playback state
  17389. <th>New value for <code id=media-controllers:dom-mediacontroller-playbackstate-4><a href=#dom-mediacontroller-playbackstate>playbackState</a></code>
  17390. <th>Event name
  17391. <tbody><tr><td><i>playing</i>
  17392. <td>"<dfn id=dom-mediacontroller-playing><code>playing</code></dfn>"
  17393. <td><code id=media-controllers:event-mediacontroller-playing><a href=#event-mediacontroller-playing>playing</a></code>
  17394. <tr><td><i>waiting</i>
  17395. <td>"<dfn id=dom-mediacontroller-waiting><code>waiting</code></dfn>"
  17396. <td><code id=media-controllers:event-mediacontroller-waiting><a href=#event-mediacontroller-waiting>waiting</a></code>
  17397. <tr><td><i>ended</i>
  17398. <td>"<dfn id=dom-mediacontroller-ended><code>ended</code></dfn>"
  17399. <td><code id=media-controllers:event-mediacontroller-ended><a href=#event-mediacontroller-ended>ended</a></code>
  17400. </table>
  17401. <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>
  17402. be <var>new playback state</var>.</ol>
  17403. <hr>
  17404. <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>,
  17405. by all objects implementing the <code id=media-controllers:mediacontroller-94><a href=#mediacontroller>MediaController</a></code> interface:</p>
  17406. <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>
  17407. <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>
  17408. <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>
  17409. <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>
  17410. <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>
  17411. <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>
  17412. <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>
  17413. <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>
  17414. <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>
  17415. <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>
  17416. <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>
  17417. <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>
  17418. <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>
  17419. <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>
  17420. <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>
  17421. </table>
  17422. <hr>
  17423. <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
  17424. section is the <a href=#dom-manipulation-task-source id=media-controllers:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  17425. <h6 id=assigning-a-media-controller-declaratively>4.8.14.11.3 Assigning a media controller declaratively</h6>
  17426. <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
  17427. value is text; <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-3>media elements</a> with the same value are
  17428. automatically linked by the user agent.</p>
  17429. <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
  17430. <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
  17431. user agent must run the following steps:</p>
  17432. <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
  17433. 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
  17434. 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
  17435. is being removed, then jump to the <i>update controllers</i> step below.<li>
  17436. <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
  17437. <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
  17438. 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
  17439. 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
  17440. <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
  17441. 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
  17442. controller</a>.</p>
  17443. <p>Otherwise, let <var>controller</var> be a newly created
  17444. <code id=assigning-a-media-controller-declaratively:mediacontroller-2><a href=#mediacontroller>MediaController</a></code>.</p>
  17445. <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
  17446. 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
  17447. controller</a>.<li><p><i>Update controllers</i>: If <var>old
  17448. controller</var> and <var>new controller</var> are the
  17449. same (whether both null or both the same controller) then abort
  17450. 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
  17451. 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
  17452. 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
  17453. state</a> for <var>new controller</var>.</ol>
  17454. <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>
  17455. <div class=example>
  17456. <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
  17457. resource</a> will share a single network request. This can be used to efficiently play two
  17458. (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.
  17459. 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
  17460. also be kept synchronised.</p>
  17461. <p>In this example, a sign-languge interpreter track from a movie file is overlaid on the primary
  17462. 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
  17463. implicit <code id=assigning-a-media-controller-declaratively:mediacontroller-3><a href=#mediacontroller>MediaController</a></code>:</p>
  17464. <pre>&lt;article>
  17465. &lt;style scoped>
  17466. div { margin: 1em auto; position: relative; width: 400px; height: 300px; }
  17467. video { position; absolute; bottom: 0; right: 0; }
  17468. video:first-child { width: 100%; height: 100%; }
  17469. video:last-child { width: 30%; }
  17470. &lt;/style>
  17471. &lt;div>
  17472. &lt;video src="movie.vid#track=Video&amp;amp;track=English" autoplay controls mediagroup=movie>&lt;/video>
  17473. &lt;video src="movie.vid#track=sign" autoplay mediagroup=movie>&lt;/video>
  17474. &lt;/div>
  17475. &lt;/article></pre>
  17476. </div>
  17477. <h5 id=timed-text-tracks>4.8.14.12 Timed text tracks</h5>
  17478. <h6 id=text-track-model>4.8.14.12.1 Text track model</h6>
  17479. <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
  17480. 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>
  17481. <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
  17482. 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
  17483. first.<li>Any <a href=#media-resource-specific-text-track id=text-track-model:media-resource-specific-text-track>media-resource-specific text
  17484. tracks</a> (<a href=#text-track id=text-track-model:text-track-4>text tracks</a> corresponding to data in the
  17485. <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
  17486. specification.</ol>
  17487. <p>A <a href=#text-track id=text-track-model:text-track-5>text track</a> consists of:</p>
  17488. <dl><dt><dfn id=text-track-kind>The kind of text track</dfn>
  17489. <dd>
  17490. <p>This decides how the track is handled by the user agent. The kind is represented by a string.
  17491. The possible strings are:</p>
  17492. <ul class=brief><li><dfn id=dom-texttrack-kind-subtitles><code>subtitles</code></dfn>
  17493. <li><dfn id=dom-texttrack-kind-captions><code>captions</code></dfn>
  17494. <li><dfn id=dom-texttrack-kind-descriptions><code>descriptions</code></dfn>
  17495. <li><dfn id=dom-texttrack-kind-chapters><code>chapters</code></dfn>
  17496. <li><dfn id=dom-texttrack-kind-metadata><code>metadata</code></dfn>
  17497. </ul>
  17498. <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
  17499. 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>
  17500. <dt><dfn id=text-track-label>A label</dfn>
  17501. <dd>
  17502. <p>This is a human-readable string intended to identify the track for the user.</p>
  17503. <p>The <a href=#text-track-label id=text-track-model:text-track-label>label of a track</a> can change dynamically, in the
  17504. 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>
  17505. <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
  17506. generate an appropriate label from the text track's other properties (e.g. the kind of text
  17507. track and the text track's language) for use in its user interface. This automatically-generated
  17508. label is not exposed in the API.</p>
  17509. <dt><dfn id=text-track-in-band-metadata-track-dispatch-type>An in-band metadata track dispatch type</dfn>
  17510. <dd>
  17511. <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
  17512. metadata tracks to enable such tracks to be dispatched to different scripts in the document.</p>
  17513. <p class=example>For example, a traditional TV station broadcast streamed on the Web and
  17514. augmented with Web-specific interactive features could include text tracks with metadata for ad
  17515. targeting, trivia game data during game shows, player states during sports games, recipe
  17516. information during food programs, and so forth. As each program starts and ends, new tracks
  17517. might be added or removed from the stream, and as each one is added, the user agent could bind
  17518. them to dedicated script modules using the value of this attribute.</p>
  17519. <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
  17520. 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
  17521. media-resource-specific text track</a>.</p>
  17522. <dt><dfn id=text-track-language>A language</dfn>
  17523. <dd>
  17524. <p>This is a string (a BCP 47 language tag) representing the language of the text track's cues.
  17525. <a href=#refsBCP47>[BCP47]</a></p>
  17526. <p>The <a href=#text-track-language id=text-track-model:text-track-language>language of a text track</a> can change dynamically,
  17527. 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>
  17528. <dt><dfn id=text-track-readiness-state>A readiness state</dfn>
  17529. <dd>
  17530. <p>One of the following:</p>
  17531. <dl><dt><dfn id=text-track-not-loaded>Not loaded</dfn>
  17532. <dd>
  17533. <p>Indicates that the text track's cues have not been obtained.</p>
  17534. <dt><dfn id=text-track-loading>Loading</dfn>
  17535. <dd>
  17536. <p>Indicates that the text track is loading and there have been no fatal errors encountered so
  17537. far. Further cues might still be added to the track by the parser.</p>
  17538. <dt><dfn id=text-track-loaded>Loaded</dfn>
  17539. <dd>
  17540. <p>Indicates that the text track has been loaded with no fatal errors.</p>
  17541. <dt><dfn id=text-track-failed-to-load>Failed to load</dfn>
  17542. <dd>
  17543. <p>Indicates that the text track was enabled, but when the user agent attempted to obtain it,
  17544. 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
  17545. likely missing and will not be obtained.</p>
  17546. </dl>
  17547. <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
  17548. track</a> changes dynamically as the track is obtained.</p>
  17549. <dt><dfn id=text-track-mode>A mode</dfn>
  17550. <dd>
  17551. <p>One of the following:</p>
  17552. <dl><dt><dfn id=text-track-disabled>Disabled</dfn>
  17553. <dd>
  17554. <p>Indicates that the text track is not active. Other than for the purposes of exposing the
  17555. track in the DOM, the user agent is ignoring the text track. No cues are active, no events are
  17556. fired, and the user agent will not attempt to obtain the track's cues.</p>
  17557. <dt><dfn id=text-track-hidden>Hidden</dfn>
  17558. <dd>
  17559. <p>Indicates that the text track is active, but that the user agent is not actively displaying
  17560. the cues. If no attempt has yet been made to obtain the track's cues, the user agent will
  17561. perform such an attempt momentarily. The user agent is maintaining a list of which cues are
  17562. active, and events are being fired accordingly.</p>
  17563. <dt><dfn id=text-track-showing>Showing</dfn>
  17564. <dd>
  17565. <p>Indicates that the text track is active. If no attempt has yet been made to obtain the
  17566. track's cues, the user agent will perform such an attempt momentarily. The user agent is
  17567. maintaining a list of which cues are active, and events are being fired accordingly. In
  17568. 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
  17569. 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
  17570. 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
  17571. 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
  17572. resource</a> by selecting a cue.</p>
  17573. </dl>
  17574. <dt><dfn id=text-track-list-of-cues>A list of zero or more cues</dfn>
  17575. <dd>
  17576. <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
  17577. 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
  17578. the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a> </p>
  17579. <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
  17580. 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>,
  17581. or due to DOM manipulation.</p>
  17582. </dl>
  17583. <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>
  17584. <hr>
  17585. <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
  17586. initially be empty, a <dfn id=blocked-on-parser>blocked-on-parser</dfn> flag, which must initially be false, and a
  17587. <dfn id=did-perform-automatic-track-selection>did-perform-automatic-track-selection</dfn> flag, which must also initially be false.</p>
  17588. <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
  17589. <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
  17590. 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
  17591. <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
  17592. <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>
  17593. <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
  17594. 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
  17595. in.</p>
  17596. <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
  17597. <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
  17598. 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
  17599. it is in.</p>
  17600. <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
  17601. 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.
  17602. 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
  17603. <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
  17604. 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
  17605. 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>
  17606. <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
  17607. 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>
  17608. <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>,
  17609. which must initially be unset.</p>
  17610. <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
  17611. 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
  17612. following steps for the <a href=#media-element id=text-track-model:media-element-11>media element</a>:</p>
  17613. <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
  17614. 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
  17615. flag</a>.<li>
  17616. <p><a href=#queue-a-task id=text-track-model:queue-a-task>Queue a task</a> that runs the following substeps:</p>
  17617. <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
  17618. 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
  17619. 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>
  17620. attribute's <code id=text-track-model:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</ol>
  17621. <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
  17622. <i id=text-track-model:time-marches-on><a href=#time-marches-on>time marches on</a></i> steps.</ol>
  17623. <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
  17624. section is the <a href=#dom-manipulation-task-source id=text-track-model:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  17625. <hr>
  17626. <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>,
  17627. corresponding for instance for subtitles and captions to the text that appears at a particular
  17628. time and disappears at another time.</p>
  17629. <p>Each <a href=#text-track-cue id=text-track-model:text-track-cue-2>text track cue</a> consists of:</p>
  17630. <dl><dt><dfn id=text-track-cue-identifier>An identifier</dfn>
  17631. <dd>
  17632. <p>An arbitrary string.</p>
  17633. <dt><dfn id=text-track-cue-start-time>A start time</dfn>
  17634. <dd>
  17635. <p>The time, in seconds and fractions of a second, that describes the beginning of the range of
  17636. the <a href=#media-data id=text-track-model:media-data>media data</a> to which the cue applies.</p>
  17637. <dt><dfn id=text-track-cue-end-time>An end time</dfn>
  17638. <dd>
  17639. <p>The time, in seconds and fractions of a second, that describes the end of the range of the
  17640. <a href=#media-data id=text-track-model:media-data-2>media data</a> to which the cue applies.</p>
  17641. <dt><dfn id=text-track-cue-pause-on-exit-flag>A pause-on-exit flag</dfn>
  17642. <dd>
  17643. <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
  17644. end of the range to which the cue applies is reached.</p>
  17645. <dt>Some additional format-specific data<dd>
  17646. <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
  17647. writing direction</a> and so forth. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  17648. <dt><dfn id=text-track-cue-data>The data of the cue</dfn>
  17649. <dd>
  17650. <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>
  17651. <p>The precise nature of this data is defined by the format. For example, WebVTT uses text.</p>
  17652. </dl>
  17653. <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
  17654. 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,
  17655. though, so cues entirely before time zero cannot be active.)</p>
  17656. <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
  17657. specifically, an object that inherits from <code id=text-track-model:texttrackcue-2><a href=#texttrackcue>TextTrackCue</a></code> — for example, WebVTT
  17658. 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
  17659. 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>
  17660. <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
  17661. 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
  17662. cue</a>. These rules are used specifically when the object representing the cue is added to a
  17663. <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>
  17664. method.</p>
  17665. <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>
  17666. <dl><dt>The <dfn id=text-track-cue-active-flag>active flag</dfn>
  17667. <dd>
  17668. <p>This flag must be initially unset. The flag is used to ensure events are fired appropriately
  17669. when the cue becomes active or inactive, and to make sure the right cues are rendered.</p>
  17670. <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
  17671. 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
  17672. <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
  17673. 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
  17674. 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
  17675. 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
  17676. 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
  17677. of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p> <dt>The <dfn id=text-track-cue-display-state>display state</dfn>
  17678. <dd>
  17679. <p>This is used as part of the rendering model, to keep cues in a consistent position. It must
  17680. 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
  17681. 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>
  17682. </dl>
  17683. <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
  17684. <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
  17685. 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
  17686. 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
  17687. <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
  17688. time</a>, earliest first; then, any <a href=#text-track-cue id=text-track-model:text-track-cue-12>cues</a> with the same
  17689. <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
  17690. 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
  17691. list of cues</a>, oldest first (so e.g. for cues from a WebVTT file, that would initially be
  17692. the order in which the cues were listed in the file). <a href=#refsWEBVTT>[WEBVTT]</a></p>
  17693. <h6 id=sourcing-in-band-text-tracks>4.8.14.12.2 Sourcing in-band text tracks</h6>
  17694. <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
  17695. to data found in the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource>media resource</a>.</p>
  17696. <p>Rules for processing and rendering such data are defined by the relevant specifications, e.g.
  17697. 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
  17698. some legacy formats can be found in the <cite>Sourcing In-band Media Resource Tracks from Media
  17699. Containers into HTML</cite> specification. <a href=#refsINBAND>[INBAND]</a></p>
  17700. <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
  17701. 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
  17702. media-resource-specific text track</dfn> with the relevant data, as follows.</p>
  17703. <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
  17704. <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
  17705. 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>
  17706. based on the semantics of the relevant data, as defined by the relevant specification. If there
  17707. 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
  17708. 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
  17709. text track rendering</a> appropriate for the format in question.</p>
  17710. <li>
  17711. <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
  17712. 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
  17713. resource</a>:</p>
  17714. <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
  17715. 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
  17716. 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
  17717. text track's type in the file's program map section, interpreted as an 8-bit unsigned integer.
  17718. Let <var>length</var> be the value of the "ES_info_length" field for the track in the
  17719. same part of the program map section, interpreted as an integer as defined by the MPEG-2
  17720. specification. Let <var>descriptor bytes</var> be the <var>length</var> bytes
  17721. 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
  17722. type</a> must be set to the concatenation of the <var>stream type</var> byte and
  17723. the zero or more <var>descriptor bytes</var> bytes, expressed in hexadecimal using
  17724. <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>
  17725. <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
  17726. first <code>stsd</code> box of the
  17727. first <code>stbl</code> box of the
  17728. first <code>minf</code> box of the
  17729. first <code>mdia</code> box of the
  17730. <a href=#text-track id=sourcing-in-band-text-tracks:text-track-7>text track</a>'s <code>trak</code> box in the
  17731. first <code>moov</code> box
  17732. of the file be the <i>stsd box</i>, if any.
  17733. 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
  17734. in-band metadata track dispatch type</a> must be set to the empty string.
  17735. 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
  17736. track in-band metadata track dispatch type</a> must be set to the concatenation of the
  17737. 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
  17738. box</i>, or the empty string if that field is absent in that box.
  17739. 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>
  17740. must be set to the concatenation of the string "<code>metx</code>", a U+0020 SPACE
  17741. 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
  17742. that box.
  17743. <a href=#refsMPEG4>[MPEG4]</a>
  17744. </dl>
  17745. <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
  17746. 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
  17747. 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
  17748. 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
  17749. mode consistent with the user's preferences and the requirements of the relevant specification
  17750. for the data.</p>
  17751. <p class=note>For instance, if there are no other active subtitles, and this is a forced
  17752. subtitle track (a subtitle track giving subtitles in the audio track's primary language, but
  17753. only for audio that is actually in another language), then those subtitles might be activated
  17754. here.</p>
  17755. <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
  17756. 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
  17757. 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>
  17758. 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
  17759. <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
  17760. <code id=sourcing-in-band-text-tracks:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</ol>
  17761. <h6 id=sourcing-out-of-band-text-tracks>4.8.14.12.3 Sourcing out-of-band text tracks</h6>
  17762. <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
  17763. track</a> (with its value set as defined below) and its corresponding new
  17764. <code id=sourcing-out-of-band-text-tracks:texttrack><a href=#texttrack>TextTrack</a></code> object.</p>
  17765. <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
  17766. 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
  17767. in the second column:</p>
  17768. <table><thead><tr><th>State
  17769. <th>String
  17770. <tbody><tr><td><a href=#attr-track-kind-subtitles id=sourcing-out-of-band-text-tracks:attr-track-kind-subtitles>Subtitles</a>
  17771. <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code>
  17772. <tr><td><a href=#attr-track-kind-captions id=sourcing-out-of-band-text-tracks:attr-track-kind-captions>Captions</a>
  17773. <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code>
  17774. <tr><td><a href=#attr-track-kind-descriptions id=sourcing-out-of-band-text-tracks:attr-track-kind-descriptions>Descriptions</a>
  17775. <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-descriptions><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>
  17776. <tr><td><a href=#attr-track-kind-chapters id=sourcing-out-of-band-text-tracks:attr-track-kind-chapters>Chapters</a>
  17777. <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code>
  17778. <tr><td><a href=#attr-track-kind-metadata id=sourcing-out-of-band-text-tracks:attr-track-kind-metadata>Metadata</a>
  17779. <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata><a href=#dom-texttrack-kind-metadata>metadata</a></code>
  17780. </table>
  17781. <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>
  17782. <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
  17783. the empty string otherwise.</p>
  17784. <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>,
  17785. 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
  17786. <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>
  17787. <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>
  17788. <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>
  17789. <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
  17790. 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
  17791. 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
  17792. for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  17793. <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
  17794. 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
  17795. <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
  17796. 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
  17797. 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>
  17798. 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
  17799. <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
  17800. <code id=sourcing-out-of-band-text-tracks:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</p>
  17801. <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
  17802. 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
  17803. <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>,
  17804. 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
  17805. 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
  17806. <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>
  17807. <hr>
  17808. <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
  17809. <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
  17810. 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>
  17811. <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
  17812. 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
  17813. element.</ol>
  17814. <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
  17815. 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>
  17816. <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
  17817. 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>
  17818. 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
  17819. 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
  17820. <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
  17821. true.</ol>
  17822. <p>When the steps above say to <dfn id=perform-automatic-text-track-selection>perform automatic text track selection</dfn> for one or more
  17823. <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>
  17824. <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>
  17825. 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,
  17826. 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>
  17827. <p>If the user has expressed an interest in having a track from <var>candidates</var>
  17828. 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
  17829. <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>
  17830. <p class=note>For example, the user could have set a browser preference to the effect of "I
  17831. want French captions whenever possible", or "If there is a subtitle track with 'Commentary' in
  17832. the title, enable it", or "If there are audio description tracks available, enable one, ideally
  17833. in Swiss German, but failing that in Standard Swiss German or Standard German".</p>
  17834. <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
  17835. 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
  17836. 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>
  17837. </ol>
  17838. <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
  17839. 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
  17840. 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:
  17841. <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
  17842. element</a>.</ul>
  17843. <p>When a user agent is to <dfn id=start-the-track-processing-model>start the <code>track</code> processing model</dfn> for a
  17844. <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.
  17845. 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
  17846. 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>
  17847. algorithm). The steps in that section are marked with ⌛.</p>
  17848. <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
  17849. 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
  17850. 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
  17851. 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
  17852. element</a> as a parent, abort these steps.<li><p>Run the remainder of these steps asynchronously, allowing whatever caused these steps to
  17853. 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>
  17854. 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
  17855. 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
  17856. <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
  17857. 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
  17858. asynchronously.<li>
  17859. <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
  17860. 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
  17861. <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
  17862. to <i>fail</i>.</p>
  17863. <p>The resource obtained in this fashion, if any, contains the text track data. If any data is
  17864. 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
  17865. suitably CORS-enabled do not get this far).</p>
  17866. <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
  17867. <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
  17868. process the data as it is being fetched must determine the type of the resource. If the
  17869. type of the resource is not a supported text track format, the load will fail, as
  17870. described below. Otherwise, the resource's data must be passed to the appropriate parser (e.g.
  17871. 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
  17872. that parser's output. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  17873. <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
  17874. 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
  17875. 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
  17876. cues</a>.</p>
  17877. <p class=critical>This specification does not currently say whether or how to check the MIME
  17878. types of text tracks, or whether or how to perform file type sniffing using the actual file
  17879. data. Implementors differ in their intentions on this matter and it is therefore unclear what
  17880. the right solution is. In the absence of any requirement here, the HTTP specification's strict
  17881. requirement to follow the Content-Type header prevails ("Content-Type specifies the media type
  17882. of the underlying data." ... "If and only if the media type is not given by a Content-Type
  17883. field, the recipient MAY attempt to guess the media type via inspection of its content
  17884. and/or the name extension(s) of the URI used to identify the resource.").</p>
  17885. <p>If the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-2>fetching algorithm</a> fails for any reason (network error,
  17886. 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
  17887. <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
  17888. 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>
  17889. <p>If the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-3>fetching algorithm</a> does not fail, but the
  17890. type of the resource is not a supported text track format, or the file was not successfully
  17891. processed (e.g. the format in question is an XML format and the file contained a well-formedness
  17892. error that the XML specification requires be detected and reported to the application), then the
  17893. <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
  17894. <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
  17895. <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
  17896. 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>
  17897. at the <code id=sourcing-out-of-band-text-tracks:the-track-element-20><a href=#the-track-element>track</a></code> element.</p>
  17898. <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
  17899. 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
  17900. 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>
  17901. <p>If, while the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-5>fetching algorithm</a> is active, either:</p>
  17902. <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>
  17903. 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
  17904. equal to <var>URL</var></ul>
  17905. <p>...then the user agent must abort the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-6>fetching algorithm</a>,
  17906. discarding any pending <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-6>tasks</a> generated by that algorithm (and
  17907. 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
  17908. 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
  17909. 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
  17910. 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>
  17911. <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
  17912. 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>
  17913. <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
  17914. 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
  17915. 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
  17916. adding cues from the resource being obtained using the previously given URL, if any.)</p>
  17917. <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>
  17918. <p>How a specific format's text track cues are to be interpreted for the purposes of processing by
  17919. an HTML user agent is defined by that format. In the absence of such a specification, this section
  17920. provides some constraints within which implementations can attempt to consistently expose such
  17921. formats.</p>
  17922. <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
  17923. <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
  17924. <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
  17925. 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
  17926. cue</a> as defined above, as well as with the following constraints:</p>
  17927. <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>
  17928. <dd>
  17929. <p>Should be set to the empty string if the format has no obvious analogue to a per-cue
  17930. identifier.</p>
  17931. <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>
  17932. <dd>
  17933. <p>Should be set to false.</p>
  17934. </dl>
  17935. <h6 id=text-track-api>4.8.14.12.5 Text track API</h6>
  17936. <pre class=idl>interface <dfn id=texttracklist>TextTrackList</dfn> : <a href=#eventtarget id=text-track-api:eventtarget>EventTarget</a> {
  17937. readonly attribute unsigned long <a href=#dom-texttracklist-length id=text-track-api:dom-texttracklist-length>length</a>;
  17938. getter <a href=#texttrack id=text-track-api:texttrack>TextTrack</a> (unsigned long index);
  17939. <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);
  17940. 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>;
  17941. 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>;
  17942. 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>;
  17943. };</pre>
  17944. <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>
  17945. <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>
  17946. <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>
  17947. <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>
  17948. <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>
  17949. <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>
  17950. </dl>
  17951. <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>
  17952. <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
  17953. 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>
  17954. 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
  17955. <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
  17956. accessed. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  17957. <p>The <dfn id=dom-texttracklist-length><code>length</code></dfn> attribute of a
  17958. <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
  17959. tracks</a> in the list represented by the <code id=text-track-api:texttracklist-4><a href=#texttracklist>TextTrackList</a></code> object.</p>
  17960. <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
  17961. 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
  17962. 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
  17963. <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
  17964. indices</a>.</p>
  17965. <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>
  17966. 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
  17967. <code id=text-track-api:texttracklist-8><a href=#texttracklist>TextTrackList</a></code> object.</p>
  17968. <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
  17969. <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
  17970. would return a value equal to the value of the <var>id</var> argument. When no tracks
  17971. match the given argument, the method must return null.</p>
  17972. <hr>
  17973. <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>" };
  17974. 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>" };
  17975. interface <dfn id=texttrack>TextTrack</dfn> : <a href=#eventtarget id=text-track-api:eventtarget-2>EventTarget</a> {
  17976. 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>;
  17977. readonly attribute DOMString <a href=#dom-texttrack-label id=text-track-api:dom-texttrack-label>label</a>;
  17978. readonly attribute DOMString <a href=#dom-texttrack-language id=text-track-api:dom-texttrack-language>language</a>;
  17979. readonly attribute DOMString <a href=#dom-texttrack-id id=text-track-api:dom-texttrack-id-2>id</a>;
  17980. readonly attribute DOMString <a href=#dom-texttrack-inbandmetadatatrackdispatchtype id=text-track-api:dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType</a>;
  17981. 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>;
  17982. 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>;
  17983. 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>;
  17984. 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);
  17985. 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);
  17986. 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>;
  17987. };</pre>
  17988. <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>
  17989. <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
  17990. <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>
  17991. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-kind-2><a href=#dom-texttrack-kind>kind</a></code><dd>
  17992. <p>Returns the <a href=#text-track-kind id=text-track-api:text-track-kind>text track kind</a> string.</p>
  17993. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-label-2><a href=#dom-texttrack-label>label</a></code><dd>
  17994. <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
  17995. (indicating that a custom label probably needs to be generated from the other attributes of the
  17996. object if the object is exposed to the user).</p>
  17997. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-language-2><a href=#dom-texttrack-language>language</a></code><dd>
  17998. <p>Returns the <a href=#text-track-language id=text-track-api:text-track-language>text track language</a> string.</p>
  17999. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-id-3><a href=#dom-texttrack-id>id</a></code><dd>
  18000. <p>Returns the ID of the given track.</p>
  18001. <p>For in-band tracks, this is the ID that can be used with a fragment identifier if the format
  18002. 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>
  18003. <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
  18004. ID of the <code id=text-track-api:the-track-element-3><a href=#the-track-element>track</a></code> element.</p>
  18005. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-inbandmetadatatrackdispatchtype-2><a href=#dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType</a></code><dd>
  18006. <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>
  18007. <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>
  18008. <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
  18009. list:</p>
  18010. <dl><dt>"<code id=text-track-api:dom-texttrack-disabled-2><a href=#dom-texttrack-disabled>disabled</a></code>"<dd>
  18011. <p>The <a href=#text-track-disabled id=text-track-api:text-track-disabled>text track disabled</a> mode.</p>
  18012. <dt>"<code id=text-track-api:dom-texttrack-hidden-2><a href=#dom-texttrack-hidden>hidden</a></code>"<dd>
  18013. <p>The <a href=#text-track-hidden id=text-track-api:text-track-hidden>text track hidden</a> mode.</p>
  18014. <dt>"<code id=text-track-api:dom-texttrack-showing-2><a href=#dom-texttrack-showing>showing</a></code>"<dd>
  18015. <p>The <a href=#text-track-showing id=text-track-api:text-track-showing>text track showing</a> mode.</p>
  18016. </dl>
  18017. <p>Can be set, to change the mode.</p>
  18018. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-cues-2><a href=#dom-texttrack-cues>cues</a></code><dd>
  18019. <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>
  18020. <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-activecues-2><a href=#dom-texttrack-activecues>activeCues</a></code><dd>
  18021. <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
  18022. 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
  18023. position</a> and end after it), as a <code id=text-track-api:texttrackcuelist-4><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
  18024. <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>
  18025. <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>
  18026. <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>
  18027. <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>
  18028. </dl>
  18029. <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>
  18030. <ol><li>
  18031. <p>Create a new <code id=text-track-api:texttrack-9><a href=#texttrack>TextTrack</a></code> object.</p>
  18032. <li>
  18033. <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
  18034. 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
  18035. <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
  18036. <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
  18037. track list of cues</a> to an empty list.</p>
  18038. <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
  18039. 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,
  18040. 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>
  18041. <li>
  18042. <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
  18043. tracks</a>.</p>
  18044. <li>
  18045. <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
  18046. 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
  18047. 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>
  18048. object.</p>
  18049. <li>
  18050. <p>Return the new <code id=text-track-api:texttrack-11><a href=#texttrack>TextTrack</a></code> object.</p>
  18051. </ol>
  18052. <hr>
  18053. <p>The <dfn id=dom-texttrack-kind><code>kind</code></dfn> attribute must return the
  18054. <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
  18055. represents.</p>
  18056. <p>The <dfn id=dom-texttrack-label><code>label</code></dfn> attribute must return the
  18057. <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>
  18058. object represents.</p>
  18059. <p>The <dfn id=dom-texttrack-language><code>language</code></dfn> attribute must return the
  18060. <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>
  18061. object represents.</p>
  18062. <p>The <dfn id=dom-texttrack-id><code>id</code></dfn> attribute returns the track's
  18063. identifier, if it has one, or the empty string otherwise. For tracks that correspond to
  18064. <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
  18065. 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
  18066. that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the identifier
  18067. returned for a particular track must be the same identifier that would enable the track if used as
  18068. the name of a track in the track dimension of such a fragment identifier. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
  18069. <p>The <dfn id=dom-texttrack-inbandmetadatatrackdispatchtype><code>inBandMetadataTrackDispatchType</code></dfn>
  18070. 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
  18071. <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>
  18072. <p>The <dfn id=dom-texttrack-mode><code>mode</code></dfn> attribute, on getting, must return
  18073. 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
  18074. the <code id=text-track-api:texttrack-16><a href=#texttrack>TextTrack</a></code> object represents, as defined by the following list:</p>
  18075. <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>
  18076. <p>On setting, if the new value isn't equal to what the attribute would currently return, the new
  18077. value must be processed as follows:</p>
  18078. <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>
  18079. <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
  18080. <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>
  18081. <dt>If the new value is "<code id=text-track-api:dom-texttrack-hidden-3><a href=#dom-texttrack-hidden>hidden</a></code>"<dd>
  18082. <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
  18083. <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>
  18084. <dt>If the new value is "<code id=text-track-api:dom-texttrack-showing-3><a href=#dom-texttrack-showing>showing</a></code>"<dd>
  18085. <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
  18086. <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>
  18087. </dl>
  18088. <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
  18089. <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
  18090. the <dfn id=dom-texttrack-cues><code>cues</code></dfn> attribute must return a
  18091. <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
  18092. <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
  18093. <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
  18094. 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
  18095. 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
  18096. object is returned, the same object must be returned each time.</p>
  18097. <p>The <dfn id=earliest-possible-position-when-the-script-started>earliest possible position when the script started</dfn> is whatever the
  18098. <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
  18099. 1.</p>
  18100. <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
  18101. <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
  18102. the <dfn id=dom-texttrack-activecues><code>activeCues</code></dfn> attribute must return a
  18103. <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
  18104. <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
  18105. <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
  18106. 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
  18107. object is returned, the same object must be returned each time.</p>
  18108. <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
  18109. <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
  18110. step 1.</p>
  18111. <hr>
  18112. <p>The <dfn id=dom-texttrack-addcue><code>addCue(<var>cue</var>)</code></dfn> method
  18113. of <code id=text-track-api:texttrack-24><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the following steps:</p>
  18114. <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
  18115. 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
  18116. 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>
  18117. <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
  18118. 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>
  18119. as appropriate for <var>cue</var>, then throw an <code id=text-track-api:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code>
  18120. exception and abort these steps.</p>
  18121. <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
  18122. 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
  18123. 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>
  18124. <p>The <dfn id=dom-texttrack-removecue><code>removeCue(<var>cue</var>)</code></dfn>
  18125. method of <code id=text-track-api:texttrack-26><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the following steps:</p>
  18126. <ol><li><p>If the given <var>cue</var> is not currently listed in the method's
  18127. <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>,
  18128. 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
  18129. <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>
  18130. <div class=example>
  18131. <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
  18132. sound file containing many sound effects. A cue is used to pause the audio, so that it ends
  18133. exactly at the end of the clip, even if the browser is busy running some script. If the page had
  18134. relied on script to pause the audio, then the start of the next clip might be heard if the
  18135. browser was not able to run the script at the exact time specified.</p>
  18136. <pre>var sfx = new Audio('sfx.wav');
  18137. var sounds = sfx.addTextTrack('metadata');
  18138. // add sounds we care about
  18139. function addFX(start, end, name) {
  18140. var cue = new VTTCue(start, end, '');
  18141. cue.id = name;
  18142. cue.pauseOnExit = true;
  18143. sounds.addCue(cue);
  18144. }
  18145. addFX(12.783, 13.612, 'dog bark');
  18146. addFX(13.612, 15.091, 'kitten mew'))
  18147. function playSound(id) {
  18148. sfx.currentTime = sounds.getCueById(id).startTime;
  18149. sfx.play();
  18150. }
  18151. // play a bark as soon as we can
  18152. sfx.oncanplaythrough = function () {
  18153. playSound('dog bark');
  18154. }
  18155. // meow when the user tries to leave
  18156. window.onbeforeunload = function () {
  18157. playSound('kitten mew');
  18158. return 'Are you sure you want to leave this awesome page?';
  18159. }</pre>
  18160. </div>
  18161. <hr>
  18162. <pre class=idl>interface <dfn id=texttrackcuelist>TextTrackCueList</dfn> {
  18163. readonly attribute unsigned long <a href=#dom-texttrackcuelist-length id=text-track-api:dom-texttrackcuelist-length>length</a>;
  18164. getter <a href=#texttrackcue id=text-track-api:texttrackcue-3>TextTrackCue</a> (unsigned long index);
  18165. <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);
  18166. };</pre>
  18167. <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>
  18168. <p>Returns the number of <a href=#text-track-cue id=text-track-api:text-track-cue-4>cues</a> in the list.</p>
  18169. <dt><var>cuelist</var>[<var>index</var>]<dd>
  18170. <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>
  18171. <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>
  18172. <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>
  18173. <p>Returns null if none of the cues have the given identifier or if the argument is the empty string.</p>
  18174. </dl>
  18175. <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>
  18176. <p>The <dfn id=dom-texttrackcuelist-length><code>length</code></dfn> attribute must return
  18177. the number of <a href=#text-track-cue id=text-track-api:text-track-cue-8>cues</a> in the list represented by the
  18178. <code id=text-track-api:texttrackcuelist-8><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
  18179. <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
  18180. 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
  18181. 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
  18182. <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
  18183. indices</a>.</p>
  18184. <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
  18185. cue</a> in the list represented by the <code id=text-track-api:texttrackcuelist-11><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
  18186. <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,
  18187. 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
  18188. <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
  18189. must return null.</p>
  18190. <hr>
  18191. <pre class=idl>interface <dfn id=texttrackcue>TextTrackCue</dfn> : <a href=#eventtarget id=text-track-api:eventtarget-3>EventTarget</a> {
  18192. 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>;
  18193. attribute DOMString <a href=#dom-texttrackcue-id id=text-track-api:dom-texttrackcue-id>id</a>;
  18194. attribute double <a href=#dom-texttrackcue-starttime id=text-track-api:dom-texttrackcue-starttime>startTime</a>;
  18195. attribute double <a href=#dom-texttrackcue-endtime id=text-track-api:dom-texttrackcue-endtime>endTime</a>;
  18196. attribute boolean <a href=#dom-texttrackcue-pauseonexit id=text-track-api:dom-texttrackcue-pauseonexit>pauseOnExit</a>;
  18197. 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>;
  18198. 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>;
  18199. };</pre>
  18200. <dl class=domintro><dt><var>cue</var> . <a href=#dom-texttrackcue-track id=text-track-api:dom-texttrackcue-track-2>track</a><dd>
  18201. <p>Returns the <code id=text-track-api:texttrack-30><a href=#texttrack>TextTrack</a></code> object to which this
  18202. <a href=#text-track-cue id=text-track-api:text-track-cue-13>text track cue</a> belongs, if any, or null
  18203. otherwise.</p>
  18204. <dt><var>cue</var> . <a href=#dom-texttrackcue-id id=text-track-api:dom-texttrackcue-id-2>id</a> [ = <var>value</var> ]<dd>
  18205. <p>Returns the <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier-3>text track cue identifier</a>.</p>
  18206. <p>Can be set.</p>
  18207. <dt><var>cue</var> . <a href=#dom-texttrackcue-starttime id=text-track-api:dom-texttrackcue-starttime-2>startTime</a> [ = <var>value</var> ]<dd>
  18208. <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>
  18209. <p>Can be set.</p>
  18210. <dt><var>cue</var> . <a href=#dom-texttrackcue-endtime id=text-track-api:dom-texttrackcue-endtime-2>endTime</a> [ = <var>value</var> ]<dd>
  18211. <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>
  18212. <p>Can be set.</p>
  18213. <dt><var>cue</var> . <a href=#dom-texttrackcue-pauseonexit id=text-track-api:dom-texttrackcue-pauseonexit-2>pauseOnExit</a> [ = <var>value</var> ]<dd>
  18214. <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>
  18215. <p>Can be set.</p>
  18216. </dl>
  18217. <p>The <dfn id=dom-texttrackcue-track><code>track</code></dfn> attribute, on getting, must
  18218. 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
  18219. <code id=text-track-api:texttrackcue-5><a href=#texttrackcue>TextTrackCue</a></code> object represents finds itself, if any; or null otherwise.</p>
  18220. <p>The <dfn id=dom-texttrackcue-id><code>id</code></dfn> attribute, on getting, must return
  18221. 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
  18222. <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
  18223. identifier</a> must be set to the new value.</p>
  18224. <p>The <dfn id=dom-texttrackcue-starttime><code>startTime</code></dfn> attribute, on
  18225. 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>
  18226. 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
  18227. cue start time</a> must be set to the new value, interpreted in seconds; then, if the
  18228. <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
  18229. <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
  18230. 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
  18231. 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>
  18232. <p>The <dfn id=dom-texttrackcue-endtime><code>endTime</code></dfn> attribute, on getting,
  18233. 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
  18234. <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
  18235. time</a> must be set to the new value, interpreted in seconds; then, if the
  18236. <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
  18237. <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
  18238. 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
  18239. 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>
  18240. <p>The <dfn id=dom-texttrackcue-pauseonexit><code>pauseOnExit</code></dfn> attribute, on
  18241. 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
  18242. 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.
  18243. 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
  18244. true, and must be unset otherwise.</p>
  18245. <h6 id=text-tracks-describing-chapters>4.8.14.12.6 Text tracks describing chapters</h6>
  18246. <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
  18247. nested, in the same way that sections in a document outline can have subsections.</p>
  18248. <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
  18249. 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
  18250. 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
  18251. 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>
  18252. <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
  18253. produce a potentially nested list of chapters, each of which have a start time, end time, title,
  18254. and a list of nested chapters. This algorithm discards cues that do not correctly nest within each
  18255. other, or that are out of order.</p>
  18256. <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
  18257. 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
  18258. 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
  18259. consisting of a start time, an end time, a title, and a (potentially empty) list of nested
  18260. 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
  18261. 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
  18262. <i>end</i>.<li><p>Let <var>current cue</var> be the first cue in <var>list</var>, and then
  18263. 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
  18264. the start time of <var>current chapter</var>, then return to the step labeled
  18265. <i>loop</i>.</p>
  18266. <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
  18267. than or equal to <var>current chapter</var>'s end time, let <var>current
  18268. 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
  18269. the end time of <var>current chapter</var>, then return to the step labeled
  18270. <i>loop</i>.</p>
  18271. <li>
  18272. <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
  18273. <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
  18274. empty.</p>
  18275. <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
  18276. <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>
  18277. <li><p>Append <var>new chapter</var> to <var>current chapter</var>'s list of
  18278. nested chapters, and let <var>current chapter</var> be <var>new chapter</var>'s
  18279. 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>
  18280. <div class=example>
  18281. <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
  18282. up. The file describes three 50-minute chapters, "Astrophysics", "Computational Physics", and
  18283. "General Relativity". The first has three subchapters, the second has four, and the third has
  18284. two. <a href=#refsWEBVTT>[WEBVTT]</a></p>
  18285. <pre>WEBVTT
  18286. 00:00:00.000 --> 00:50:00.000
  18287. Astrophysics
  18288. 00:00:00.000 --> 00:10:00.000
  18289. Introduction to Astrophysics
  18290. 00:10:00.000 --> 00:45:00.000
  18291. The Solar System
  18292. 00:00:00.000 --> 00:10:00.000
  18293. Coursework Description
  18294. 00:50:00.000 --> 01:40:00.000
  18295. Computational Physics
  18296. 00:50:00.000 --> 00:55:00.000
  18297. Introduction to Programming
  18298. 00:55:00.000 --> 01:30:00.000
  18299. Data Structures
  18300. 01:30:00.000 --> 01:35:00.000
  18301. Answers to Last Exam
  18302. 01:35:00.000 --> 01:40:00.000
  18303. Coursework Description
  18304. 01:40:00.000 --> 02:30:00.000
  18305. General Relativity
  18306. 01:40:00.000 --> 02:00:00.000
  18307. Tensor Algebra
  18308. 02:00:00.000 --> 02:30:00.000
  18309. The General Relativistic Field Equations</pre>
  18310. </div>
  18311. <h6 id=cue-events>4.8.14.12.7 Event handlers for objects of the text track APIs</h6>
  18312. <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
  18313. attributes</a>, by all objects implementing the <code id=cue-events:texttracklist><a href=#texttracklist>TextTrackList</a></code> interface:</p>
  18314. <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>
  18315. <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>
  18316. <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>
  18317. <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>
  18318. </table>
  18319. <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
  18320. attributes</a>, by all objects implementing the <code id=cue-events:texttrack><a href=#texttrack>TextTrack</a></code> interface:</p>
  18321. <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>
  18322. <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>
  18323. </table>
  18324. <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
  18325. attributes</a>, by all objects implementing the <code id=cue-events:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> interface:</p>
  18326. <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>
  18327. <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>
  18328. <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>
  18329. </table>
  18330. <h6 id=best-practices-for-metadata-text-tracks>4.8.14.12.8 Best practices for metadata text tracks</h6>
  18331. <p><i>This section is non-normative.</i></p>
  18332. <p>Text tracks can be used for storing data relating to the media data, for interactive or
  18333. augmented views.</p>
  18334. <p>For example, a page showing a sports broadcast could include information about the current
  18335. score. Suppose a robotics competition was being streamed live. The image could be overlayed with
  18336. the scores, as follows:</p>
  18337. <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&quot;http%3A%2F%2Fwww.whatwg.org%2Fspecs%2Fweb-apps%2Fcurrent-work%2Fimages%2Frobots.jpeg&quot;>%0A%20<p%20class%3D&quot;score%20left&quot;><span>Red%20Alliance<%2Fspan>%20<span>78<%2Fspan><%2Fp>%0A%20<p%20class%3D&quot;score%20right&quot;><span>Blue%20Alliance<%2Fspan>%20<span>66<%2Fspan><%2Fp>%0A%20<p%20class%3D&quot;score%20middle&quot;><span>Qual%20Match%2037<%2Fspan>%20<span>Friday%2014%3A21<%2Fspan>%0A<%2Fdiv>" width=600 height=400></iframe>
  18338. <p>In order to make the score display render correctly whenever the user seeks to an arbitrary
  18339. point in the video, the metadata text track cues need to be as long as is appropriate for the
  18340. score. For example, in the frame above, there would be maybe one cue that lasts the length of the
  18341. match that gives the match number, one cue that lasts until the blue alliance's score changes, and
  18342. one cue that lasts until the red alliance's score changes. If the video is just a stream of the
  18343. live event, the time in the bottom right would presumably be automatically derived from the
  18344. current video time, rather than based on a cue. However, if the video was just the highlights,
  18345. then that might be given in cues also.</p>
  18346. <p>The following shows what fragments of this could look like in a WebVTT file:</p>
  18347. <pre>WEBVTT
  18348. ...
  18349. 05:10:00.000 --> 05:12:15.000
  18350. matchtype:qual
  18351. matchnumber:37
  18352. ...
  18353. 05:11:02.251 --> 05:11:17.198
  18354. red:78
  18355. 05:11:03.672 --> 05:11:54.198
  18356. blue:66
  18357. 05:11:17.198 --> 05:11:25.912
  18358. red:80
  18359. 05:11:25.912 --> 05:11:26.522
  18360. red:83
  18361. 05:11:26.522 --> 05:11:26.982
  18362. red:86
  18363. 05:11:26.982 --> 05:11:27.499
  18364. red:89
  18365. ...</pre>
  18366. <p>The key here is to notice that the information is given in cues that span the length of time to
  18367. which the relevant event applies. If, instead, the scores were given as zero-length (or very
  18368. brief, nearly zero-length) cues when the score changes, for example saying "red+2" at
  18369. 05:11:17.198, "red+3" at 05:11:25.912, etc, problems arise: primarily, seeking is much harder to
  18370. implement, as the script has to walk the entire list of cues to make sure that no notifications
  18371. have been missed; but also, if the cues are short it's possible the script will never see that
  18372. they are active unless it listens to them specifically.</p>
  18373. <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
  18374. 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
  18375. appropriate as it would require doing work even when the cues haven't changed, and, more
  18376. importantly, would introduce a higher latency between when the metatata cues become active and
  18377. 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
  18378. are rate-limited.)</p>
  18379. <h5 id=user-interface>4.8.14.13 User interface</h5>
  18380. <p>The <dfn id=attr-media-controls><code>controls</code></dfn> attribute is a <a href=#boolean-attribute id=user-interface:boolean-attribute>boolean
  18381. attribute</a>. If present, it indicates that the author has not provided a scripted controller
  18382. and would like the user agent to provide its own set of controls.</p>
  18383. <p>If the attribute is present, or if <a href=#concept-n-noscript id=user-interface:concept-n-noscript>scripting is
  18384. 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
  18385. interface to the user</dfn>. This user interface should include features to begin playback, pause
  18386. playback, seek to an arbitrary position in the content (if the content supports arbitrary
  18387. seeking), change the volume, change the display of closed captions or embedded sign-language
  18388. tracks, select different audio tracks or turn on audio descriptions, and show the media content in
  18389. manners more suitable to the user (e.g. full-screen video or in an independent resizable window).
  18390. Other controls may also be made available.</p>
  18391. <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
  18392. agent should expose audio tracks from all the <a href=#slaved-media-elements id=user-interface:slaved-media-elements>slaved media elements</a> (although
  18393. avoiding duplicates if the same <a href=#media-resource id=user-interface:media-resource>media resource</a> is being used several times). If a
  18394. <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
  18395. 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
  18396. 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
  18397. name) of that track.</p>
  18398. <p>Even when the attribute is absent, however, user agents may provide controls to affect playback
  18399. of the media resource (e.g. play, pause, seeking, and volume controls), but such features should
  18400. not interfere with the page's normal rendering. For example, such features could be exposed in the
  18401. <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
  18402. described above (as if the <code id=user-interface:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute was
  18403. present).</p>
  18404. <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
  18405. 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
  18406. should suppress any user interaction events while the user agent is interacting with this
  18407. 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
  18408. elements on the page.)</p>
  18409. <p>Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for
  18410. seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing,
  18411. enabling, and disabling text tracks, and for muting or changing the volume of the audio), user
  18412. interface features exposed by the user agent must be implemented in terms of the DOM API described
  18413. above, so that, e.g., all the same events fire.</p>
  18414. <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
  18415. user interface for pausing and unpausing playback, for seeking, for changing the rate of playback,
  18416. for fast-forwarding or rewinding, and for muting or changing the volume of audio of the entire
  18417. group must be implemented in terms of the <code id=user-interface:mediacontroller><a href=#mediacontroller>MediaController</a></code> API exposed on that
  18418. <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
  18419. controller</a>, and all the <a href=#slaved-media-elements id=user-interface:slaved-media-elements-2>slaved media elements</a> of that
  18420. <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
  18421. media elements</a> when the user invokes a user agent interface control for beginning
  18422. playback.</p>
  18423. <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>
  18424. 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
  18425. attributes and method with those names on that <code id=user-interface:mediacontroller-3><a href=#mediacontroller>MediaController</a></code> object must be used.
  18426. Otherwise, the attributes and method with those names on the <a href=#media-element id=user-interface:media-element-9>media element</a> itself
  18427. must be used. </p>
  18428. <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>
  18429. 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>,
  18430. the attributes with those names on that <code id=user-interface:mediacontroller-4><a href=#mediacontroller>MediaController</a></code> object must be used;
  18431. 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>
  18432. <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
  18433. implemented in terms of the <code id=user-interface:dom-mediacontroller-currenttime><a href=#dom-mediacontroller-currenttime>currentTime</a></code>
  18434. attribute on that <code id=user-interface:mediacontroller-5><a href=#mediacontroller>MediaController</a></code> object. Otherwise, the user agent must directly
  18435. <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
  18436. element</a>'s <a href=#media-timeline id=user-interface:media-timeline>media timeline</a>. For media resources where seeking to an arbitrary
  18437. position would be slow, user agents are encouraged to use the <i>approximate-for-speed</i> flag
  18438. when seeking in response to the user manipulating an approximate position interface such as a seek
  18439. bar.</p>
  18440. <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
  18441. additionally provide the user with controls that directly manipulate an individual <a href=#media-element id=user-interface:media-element-15>media
  18442. element</a> without affecting the <code id=user-interface:mediacontroller-6><a href=#mediacontroller>MediaController</a></code>, but such features are
  18443. considered relatively advanced and unlikely to be useful to most users.</p>
  18444. <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
  18445. to run the following steps:</p>
  18446. <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
  18447. <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
  18448. the <code id=user-interface:dom-mediacontroller-play><a href=#dom-mediacontroller-play>play()</a></code> method of the
  18449. <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>,
  18450. 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
  18451. invoke the <code id=user-interface:dom-mediacontroller-unpause><a href=#dom-mediacontroller-unpause>unpause()</a></code> method of the
  18452. <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>,
  18453. 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>;
  18454. invoke the <code id=user-interface:dom-mediacontroller-pause><a href=#dom-mediacontroller-pause>pause()</a></code> method of the
  18455. <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
  18456. 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,
  18457. 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
  18458. 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>,
  18459. 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
  18460. 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
  18461. element</a>.</ol>
  18462. <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>
  18463. 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
  18464. <code id=user-interface:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code> should be used. Such tracks must be
  18465. 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
  18466. track</a>. When seeking in response to a user maniplating a chapter selection interface, user
  18467. agents should not use the <i>approximate-for-speed</i> flag.</p>
  18468. <p>The <dfn id=dom-media-controls><code>controls</code></dfn> IDL attribute must
  18469. <a href=#reflect id=user-interface:reflect>reflect</a> the content attribute of the same name.</p>
  18470. <hr>
  18471. <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>
  18472. <p>Returns the current playback volume, as a number in the range 0.0 to 1.0, where 0.0 is the
  18473. quietest and 1.0 the loudest.</p>
  18474. <p>Can be set, to change the volume.</p>
  18475. <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>
  18476. <dt><var>media</var> . <code id=user-interface:dom-media-muted><a href=#dom-media-muted>muted</a></code> [ = <var>value</var> ]<dd>
  18477. <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>
  18478. attribute, and false if the <code id=user-interface:dom-media-volume-3><a href=#dom-media-volume>volume</a></code> attribute is being
  18479. honored.</p>
  18480. <p>Can be set, to change whether the audio is muted or not.</p>
  18481. </dl>
  18482. <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).
  18483. Initially, the volume should be 1.0, but user agents may remember the last set value across
  18484. sessions, on a per-site basis or otherwise, so the volume may start at other values.</p>
  18485. <p>The <dfn id=dom-media-volume><code>volume</code></dfn> IDL attribute must return the
  18486. <a href=#concept-media-volume id=user-interface:concept-media-volume>playback volume</a> of any audio portions of the
  18487. <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
  18488. <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
  18489. set to the new value. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
  18490. setting, an <code id=user-interface:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>
  18491. <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
  18492. 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
  18493. playback</a> is backwards, the element is muted.)</p>
  18494. <p>The <dfn id=dom-media-muted><code>muted</code></dfn> IDL attribute must return the value
  18495. 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
  18496. agents may set the value to the user's preferred value (e.g. remembering the last set value across
  18497. 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>
  18498. 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>
  18499. <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
  18500. 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
  18501. 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
  18502. element</a>.</p>
  18503. <p>An element's <dfn id=effective-media-volume>effective media volume</dfn> is determined as follows:</p>
  18504. <ol><li><p>If the user has indicated that the user agent is to override the volume of the element,
  18505. 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
  18506. 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
  18507. 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
  18508. <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
  18509. 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
  18510. 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
  18511. 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
  18512. 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
  18513. 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>,
  18514. interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest
  18515. setting, values in between increasing in loudness. The range need not be linear. The loudest
  18516. setting may be lower than the system's loudest possible setting; for example the user could have
  18517. set a maximum volume.</ol>
  18518. <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
  18519. default state of the audio output of the <a href=#media-resource id=user-interface:media-resource-4>media resource</a>, potentially overriding user
  18520. preferences.</p>
  18521. <p>The <dfn id=dom-media-defaultmuted><code>defaultMuted</code></dfn> IDL attribute must
  18522. <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>
  18523. <p class=note>This attribute has no dynamic effect (it only controls the default state of the
  18524. element).</p>
  18525. <div class=example>
  18526. <p>This video (an advertisement) autoplays, but to avoid annoying users, it does so without
  18527. sound, and allows the user to turn the sound on.</p>
  18528. <pre>&lt;video src="adverts.cgi?kind=video" controls autoplay loop muted>&lt;/video></pre>
  18529. </div>
  18530. <h5 id=time-ranges>4.8.14.14 Time ranges</h5>
  18531. <p>Objects implementing the <code id=time-ranges:timeranges><a href=#timeranges>TimeRanges</a></code> interface
  18532. represent a list of ranges (periods) of time.</p>
  18533. <pre class=idl>interface <dfn id=timeranges>TimeRanges</dfn> {
  18534. readonly attribute unsigned long <a href=#dom-timeranges-length id=time-ranges:dom-timeranges-length>length</a>;
  18535. double <a href=#dom-timeranges-start id=time-ranges:dom-timeranges-start>start</a>(unsigned long index);
  18536. double <a href=#dom-timeranges-end id=time-ranges:dom-timeranges-end>end</a>(unsigned long index);
  18537. };</pre>
  18538. <dl class=domintro><dt><var>media</var> . <code id=time-ranges:dom-timeranges-length-2><a href=#dom-timeranges-length>length</a></code><dd>
  18539. <p>Returns the number of ranges in the object.</p>
  18540. <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>
  18541. <p>Returns the time for the start of the range with the given index.</p>
  18542. <p>Throws an <code id=time-ranges:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>
  18543. <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>
  18544. <p>Returns the time for the end of the range with the given index.</p>
  18545. <p>Throws an <code id=time-ranges:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>
  18546. </dl>
  18547. <p>The <dfn id=dom-timeranges-length><code>length</code></dfn> IDL attribute must return the
  18548. number of ranges represented by the object.</p>
  18549. <p>The <dfn id=dom-timeranges-start><code>start(<var>index</var>)</code></dfn>
  18550. method must return the position of the start of the <var>index</var>th range represented
  18551. by the object, in seconds measured from the start of the timeline that the object covers.</p>
  18552. <p>The <dfn id=dom-timeranges-end><code>end(<var>index</var>)</code></dfn> method
  18553. must return the position of the end of the <var>index</var>th range represented by the
  18554. object, in seconds measured from the start of the timeline that the object covers.</p>
  18555. <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
  18556. object.</p>
  18557. <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>
  18558. object</dfn>, the ranges it represents must obey the following criteria:</p>
  18559. <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>
  18560. <p>In other words, the ranges in such an object are ordered, don't overlap, aren't empty, and
  18561. don't touch (adjacent ranges are folded into one bigger range).</p>
  18562. <p>Ranges in a <code id=time-ranges:timeranges-3><a href=#timeranges>TimeRanges</a></code> object must be inclusive.</p>
  18563. <p class=example>Thus, the end of a range would be equal to the start of a following adjacent
  18564. (touching but not overlapping) range. Similarly, a range covering a whole timeline anchored at
  18565. zero would have a start equal to zero and an end equal to the duration of the timeline.</p>
  18566. <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
  18567. <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
  18568. elements</a> must be that element's <a href=#media-timeline id=time-ranges:media-timeline>media timeline</a>.</p>
  18569. <h5 id=the-trackevent-interface>4.8.14.15 The <code id=the-trackevent-interface:trackevent><a href=#trackevent>TrackEvent</a></code> interface</h5>
  18570. <pre class=idl>[Constructor(DOMString type, optional <a href=#trackeventinit id=the-trackevent-interface:trackeventinit>TrackEventInit</a> eventInitDict)]
  18571. interface <dfn id=trackevent>TrackEvent</dfn> : <a href=#event id=the-trackevent-interface:event>Event</a> {
  18572. 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>;
  18573. };
  18574. dictionary <dfn id=trackeventinit>TrackEventInit</dfn> : <a href=#eventinit id=the-trackevent-interface:eventinit>EventInit</a> {
  18575. (<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;
  18576. };</pre>
  18577. <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>
  18578. <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
  18579. <code id=the-trackevent-interface:videotrack-3><a href=#videotrack>VideoTrack</a></code>) to which the event relates.</p>
  18580. </dl>
  18581. <p>The <dfn id=dom-trackevent-track><code>track</code></dfn> attribute must return the value
  18582. it was initialised to. When the object is created, this attribute must be initialised to null. It
  18583. represents the context information for the event.</p>
  18584. <h5 id=mediaevents>4.8.14.16 Event summary</h5>
  18585. <p><i>This section is non-normative.</i></p>
  18586. <p>The following events fire on <a href=#media-element id=mediaevents:media-element>media elements</a> as part of the
  18587. processing model described above:</p>
  18588. <table><thead><tr><th>Event name
  18589. <th>Interface
  18590. <th>Fired when...
  18591. <th>Preconditions
  18592. <tbody><tr><td><dfn id=event-media-loadstart><code>loadstart</code></dfn>
  18593. <td><code id=mediaevents:event><a href=#event>Event</a></code>
  18594. <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>.
  18595. <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>
  18596. <tr><td><dfn id=event-media-progress><code>progress</code></dfn>
  18597. <td><code id=mediaevents:event-2><a href=#event>Event</a></code>
  18598. <td>The user agent is fetching <a href=#media-data id=mediaevents:media-data-2>media data</a>.
  18599. <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>
  18600. <tr><td><dfn id=event-media-suspend><code>suspend</code></dfn>
  18601. <td><code id=mediaevents:event-3><a href=#event>Event</a></code>
  18602. <td>The user agent is intentionally not currently fetching <a href=#media-data id=mediaevents:media-data-3>media data</a>.
  18603. <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>
  18604. <tr><td><dfn id=event-media-abort><code>abort</code></dfn>
  18605. <td><code id=mediaevents:event-4><a href=#event>Event</a></code>
  18606. <td>The user agent stops fetching the <a href=#media-data id=mediaevents:media-data-4>media data</a> before it is completely
  18607. downloaded, but not due to an error.
  18608. <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.
  18609. <tr><td><dfn id=event-media-error><code>error</code></dfn>
  18610. <td><code id=mediaevents:event-5><a href=#event>Event</a></code>
  18611. <td>An error occurs while fetching the <a href=#media-data id=mediaevents:media-data-5>media data</a>.
  18612. <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.
  18613. <tr><td><dfn id=event-media-emptied><code>emptied</code></dfn>
  18614. <td><code id=mediaevents:event-6><a href=#event>Event</a></code>
  18615. <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>
  18616. 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
  18617. just switched to that state (either because of a fatal error during load that's about to be
  18618. reported, or because the <code id=mediaevents:dom-media-load><a href=#dom-media-load>load()</a></code> method was invoked while
  18619. the <a href=#concept-media-load-algorithm id=mediaevents:concept-media-load-algorithm-2>resource selection algorithm</a> was already
  18620. running).
  18621. <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
  18622. initial states.
  18623. <tr><td><dfn id=event-media-stalled><code>stalled</code></dfn>
  18624. <td><code id=mediaevents:event-7><a href=#event>Event</a></code>
  18625. <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
  18626. forthcoming.
  18627. <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>.
  18628. <tbody><tr><td><dfn id=event-media-loadedmetadata><code>loadedmetadata</code></dfn>
  18629. <td><code id=mediaevents:event-8><a href=#event>Event</a></code>
  18630. <td>The user agent has just determined the duration and dimensions of the <a href=#media-resource id=mediaevents:media-resource>media
  18631. resource</a> and <a href=#the-text-tracks-are-ready id=mediaevents:the-text-tracks-are-ready>the text tracks are ready</a>.
  18632. <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.
  18633. <tr><td><dfn id=event-media-loadeddata><code>loadeddata</code></dfn>
  18634. <td><code id=mediaevents:event-9><a href=#event>Event</a></code>
  18635. <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
  18636. position</a> for the first time.
  18637. <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.
  18638. <tr><td><dfn id=event-media-canplay><code>canplay</code></dfn>
  18639. <td><code id=mediaevents:event-10><a href=#event>Event</a></code>
  18640. <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
  18641. 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
  18642. current playback rate up to its end without having to stop for further buffering of content.
  18643. <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.
  18644. <tr><td><dfn id=event-media-canplaythrough><code>canplaythrough</code></dfn>
  18645. <td><code id=mediaevents:event-11><a href=#event>Event</a></code>
  18646. <td>The user agent estimates that if playback were to be started now, the <a href=#media-resource id=mediaevents:media-resource-3>media
  18647. resource</a> could be rendered at the current playback rate all the way to its end without
  18648. having to stop for further buffering.
  18649. <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>.
  18650. <tr><td><dfn id=event-media-playing><code>playing</code></dfn>
  18651. <td><code id=mediaevents:event-12><a href=#event>Event</a></code>
  18652. <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
  18653. data</a>.
  18654. <td><code id=mediaevents:dom-media-readystate-5><a href=#dom-media-readystate>readyState</a></code> is newly equal to or greater than
  18655. <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
  18656. element might still not be <a href=#potentially-playing id=mediaevents:potentially-playing>potentially playing</a>, e.g. if the element is
  18657. <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
  18658. controller</a> is paused, or another <a href=#slaved-media-elements id=mediaevents:slaved-media-elements>slaved media
  18659. element</a> is stalled somehow, or because the <a href=#media-resource id=mediaevents:media-resource-4>media resource</a> has no data
  18660. 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
  18661. 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>.
  18662. <tr><td><dfn id=event-media-waiting><code>waiting</code></dfn>
  18663. <td><code id=mediaevents:event-13><a href=#event>Event</a></code>
  18664. <td>Playback has stopped because the next frame is not available, but the user agent expects
  18665. that frame to become available in due course.
  18666. <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>
  18667. is not contained in any of the ranges in <code id=mediaevents:dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>. It
  18668. 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
  18669. (and when those situations resolve, a separate <code id=mediaevents:event-media-playing><a href=#event-media-playing>playing</a></code>
  18670. 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
  18671. controller</a>, or <a href=#ended-playback id=mediaevents:ended-playback>playback ended</a>, or playback
  18672. <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>
  18673. or <a href=#paused-for-in-band-content id=mediaevents:paused-for-in-band-content-2>paused for in-band content</a>.
  18674. <tbody><tr><td><dfn id=event-media-seeking><code>seeking</code></dfn>
  18675. <td><code id=mediaevents:event-14><a href=#event>Event</a></code>
  18676. <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.
  18677. <td>
  18678. <tr><td><dfn id=event-media-seeked><code>seeked</code></dfn>
  18679. <td><code id=mediaevents:event-15><a href=#event>Event</a></code>
  18680. <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.
  18681. <td>
  18682. <tr><td><dfn id=event-media-ended><code>ended</code></dfn>
  18683. <td><code id=mediaevents:event-16><a href=#event>Event</a></code>
  18684. <td>Playback has stopped because the end of the <a href=#media-resource id=mediaevents:media-resource-5>media resource</a> was reached.
  18685. <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
  18686. resource</a>; <code id=mediaevents:dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.
  18687. <tbody><tr><td><dfn id=event-media-durationchange><code>durationchange</code></dfn>
  18688. <td><code id=mediaevents:event-17><a href=#event>Event</a></code>
  18689. <td>The <code id=mediaevents:dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
  18690. <td>
  18691. <tr><td><dfn id=event-media-timeupdate><code>timeupdate</code></dfn>
  18692. <td><code id=mediaevents:event-18><a href=#event>Event</a></code>
  18693. <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.
  18694. <td>
  18695. <tr><td><dfn id=event-media-play><code>play</code></dfn>
  18696. <td><code id=mediaevents:event-19><a href=#event>Event</a></code>
  18697. <td>The element is no longer paused. Fired after the <code id=mediaevents:dom-media-play><a href=#dom-media-play>play()</a></code>
  18698. method has returned, or when the <code id=mediaevents:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute
  18699. has caused playback to begin.
  18700. <td><code id=mediaevents:dom-media-paused-5><a href=#dom-media-paused>paused</a></code> is newly false.
  18701. <tr><td><dfn id=event-media-pause><code>pause</code></dfn>
  18702. <td><code id=mediaevents:event-20><a href=#event>Event</a></code>
  18703. <td>The element has been paused. Fired after the <code id=mediaevents:dom-media-pause><a href=#dom-media-pause>pause()</a></code>
  18704. method has returned.
  18705. <td><code id=mediaevents:dom-media-paused-6><a href=#dom-media-paused>paused</a></code> is newly true.
  18706. <tr><td><dfn id=event-media-ratechange><code>ratechange</code></dfn>
  18707. <td><code id=mediaevents:event-21><a href=#event>Event</a></code>
  18708. <td>Either the <code id=mediaevents:dom-media-defaultplaybackrate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or the
  18709. <code id=mediaevents:dom-media-playbackrate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute has just been updated.
  18710. <td>
  18711. <tbody><tr><td><dfn id=event-media-resize><code>resize</code></dfn>
  18712. <td><code id=mediaevents:event-22><a href=#event>Event</a></code>
  18713. <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.
  18714. <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>
  18715. <tr><td><dfn id=event-media-volumechange><code>volumechange</code></dfn>
  18716. <td><code id=mediaevents:event-23><a href=#event>Event</a></code>
  18717. <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
  18718. attribute's setter has returned.
  18719. <td>
  18720. </table>
  18721. <p>The following events fire on <code id=mediaevents:mediacontroller><a href=#mediacontroller>MediaController</a></code> objects:</p>
  18722. <table><thead><tr><th>Event name
  18723. <th>Interface
  18724. <th>Fired when...
  18725. <tbody><tr><td><dfn id=event-mediacontroller-emptied><code>emptied</code></dfn>
  18726. <td><code id=mediaevents:event-24><a href=#event>Event</a></code>
  18727. <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
  18728. <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-3>slaved media elements</a>.
  18729. <tr><td><dfn id=event-mediacontroller-loadedmetadata><code>loadedmetadata</code></dfn>
  18730. <td><code id=mediaevents:event-25><a href=#event>Event</a></code>
  18731. <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.
  18732. <tr><td><dfn id=event-mediacontroller-loadeddata><code>loadeddata</code></dfn>
  18733. <td><code id=mediaevents:event-26><a href=#event>Event</a></code>
  18734. <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.
  18735. <tr><td><dfn id=event-mediacontroller-canplay><code>canplay</code></dfn>
  18736. <td><code id=mediaevents:event-27><a href=#event>Event</a></code>
  18737. <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.
  18738. <tr><td><dfn id=event-mediacontroller-canplaythrough><code>canplaythrough</code></dfn>
  18739. <td><code id=mediaevents:event-28><a href=#event>Event</a></code>
  18740. <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>.
  18741. <tr><td><dfn id=event-mediacontroller-playing><code>playing</code></dfn>
  18742. <td><code id=mediaevents:event-29><a href=#event>Event</a></code>
  18743. <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>.
  18744. <tr><td><dfn id=event-mediacontroller-waiting><code>waiting</code></dfn>
  18745. <td><code id=mediaevents:event-30><a href=#event>Event</a></code>
  18746. <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>.
  18747. <tr><td><dfn id=event-mediacontroller-ended><code>ended</code></dfn>
  18748. <td><code id=mediaevents:event-31><a href=#event>Event</a></code>
  18749. <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
  18750. <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>.
  18751. <tbody><tr><td><dfn id=event-mediacontroller-durationchange><code>durationchange</code></dfn>
  18752. <td><code id=mediaevents:event-32><a href=#event>Event</a></code>
  18753. <td>The <code id=mediaevents:dom-mediacontroller-duration><a href=#dom-mediacontroller-duration>duration</a></code> attribute has just been
  18754. updated.
  18755. <tr><td><dfn id=event-mediacontroller-timeupdate><code>timeupdate</code></dfn>
  18756. <td><code id=mediaevents:event-33><a href=#event>Event</a></code>
  18757. <td>The <a href=#media-controller-position id=mediaevents:media-controller-position-2>media controller position</a> changed.
  18758. <tr><td><dfn id=event-mediacontroller-play><code>play</code></dfn>
  18759. <td><code id=mediaevents:event-34><a href=#event>Event</a></code>
  18760. <td>The <code id=mediaevents:dom-mediacontroller-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly false.
  18761. <tr><td><dfn id=event-mediacontroller-pause><code>pause</code></dfn>
  18762. <td><code id=mediaevents:event-35><a href=#event>Event</a></code>
  18763. <td>The <code id=mediaevents:dom-mediacontroller-paused-2><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly true.
  18764. <tr><td><dfn id=event-mediacontroller-ratechange><code>ratechange</code></dfn>
  18765. <td><code id=mediaevents:event-36><a href=#event>Event</a></code>
  18766. <td>Either the <code id=mediaevents:dom-mediacontroller-defaultplaybackrate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code>
  18767. attribute or the <code id=mediaevents:dom-mediacontroller-playbackrate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> attribute
  18768. has just been updated.
  18769. <tr><td><dfn id=event-mediacontroller-volumechange><code>volumechange</code></dfn>
  18770. <td><code id=mediaevents:event-37><a href=#event>Event</a></code>
  18771. <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.
  18772. </table>
  18773. <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
  18774. <code id=mediaevents:texttracklist><a href=#texttracklist>TextTrackList</a></code> objects:</p>
  18775. <table><thead><tr><th>Event name
  18776. <th>Interface
  18777. <th>Fired when...
  18778. <tbody><tr><td><dfn id=event-media-change><code>change</code></dfn>
  18779. <td><code id=mediaevents:event-38><a href=#event>Event</a></code>
  18780. <td>One or more tracks in the track list have been enabled or disabled.
  18781. <tr><td><dfn id=event-media-addtrack><code>addtrack</code></dfn>
  18782. <td><code id=mediaevents:trackevent><a href=#trackevent>TrackEvent</a></code>
  18783. <td>A track has been added to the track list.
  18784. <tr><td><dfn id=event-media-removetrack><code>removetrack</code></dfn>
  18785. <td><code id=mediaevents:trackevent-2><a href=#trackevent>TrackEvent</a></code>
  18786. <td>A track has been removed from the track list.
  18787. </table>
  18788. <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>
  18789. <table><thead><tr><th>Event name
  18790. <th>Interface
  18791. <th>Fired when...
  18792. <tbody><tr><td><dfn id=event-media-cuechange><code>cuechange</code></dfn>
  18793. <td><code id=mediaevents:event-39><a href=#event>Event</a></code>
  18794. <td>One or more cues in the track have become active or stopped being active.
  18795. </table>
  18796. <p>The following events fire on <code id=mediaevents:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> objects:</p>
  18797. <table><thead><tr><th>Event name
  18798. <th>Interface
  18799. <th>Fired when...
  18800. <tbody><tr><td><dfn id=event-media-enter><code>enter</code></dfn>
  18801. <td><code id=mediaevents:event-40><a href=#event>Event</a></code>
  18802. <td>The cue has become active.
  18803. <tr><td><dfn id=event-media-exit><code>exit</code></dfn>
  18804. <td><code id=mediaevents:event-41><a href=#event>Event</a></code>
  18805. <td>The cue has stopped being active.
  18806. </table>
  18807. <h5 id=security-and-privacy-considerations>4.8.14.17 Security and privacy considerations</h5>
  18808. <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>
  18809. elements come from the ability to embed media cross-origin. There are two directions that threats
  18810. can flow: from hostile content to a victim page, and from a hostile page to victim content.</p>
  18811. <hr>
  18812. <p>If a victim page embeds hostile content, the threat is that the content might contain scripted
  18813. 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
  18814. this, user agents must ensure that there is no access from the content to the embedding page. In
  18815. the case of media content that uses DOM concepts, the embedded content must be treated as if it
  18816. 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>
  18817. <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,
  18818. the user agent would not give it access to the DOM of the outer page. From the perspective of
  18819. scripts in the SVG resource, the SVG file would appear to be in a lone top-level browsing context
  18820. with no parent.</p>
  18821. <hr>
  18822. <p>If a hostile page embeds victim content, the threat is that the embedding page could obtain
  18823. information from the content that it would not otherwise have access to. The API does expose some
  18824. information: the existence of the media, its type, its duration, its size, and the performance
  18825. characteristics of its host. Such information is already potentially problematic, but in practice
  18826. 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
  18827. has been deemed acceptable.</p>
  18828. <p>However, significantly more sensitive information could be obtained if the user agent further
  18829. exposes metadata within the content such as subtitles or chapter titles. Such information is
  18830. 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>.
  18831. The <code id=security-and-privacy-considerations:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> attribute allows authors to control
  18832. how this check is performed. <a href=#refsFETCH>[FETCH]</a></p>
  18833. <p class=example>Without this restriction, an attacker could trick a user running within a
  18834. corporate network into visiting a site that attempts to load a video from a previously leaked
  18835. location on the corporation's intranet. If such a video included confidential plans for a new
  18836. product, then being able to read the subtitles would present a serious confidentiality breach.</p>
  18837. <h5 id=best-practices-for-authors-using-media-elements>4.8.14.18 Best practices for authors using media elements</h5>
  18838. <p><i>This section is non-normative.</i></p>
  18839. <p>Playing audio and video resources on small devices such as set-top boxes or mobile phones is
  18840. often constrained by limited hardware resources in the device. For example, a device might only
  18841. support three simultaneous videos. For this reason, it is a good practice to release resources
  18842. 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
  18843. being very careful about removing all references to the element and allowing it to be garbage
  18844. 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>
  18845. 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>
  18846. <p>Similarly, when the playback rate is not exactly 1.0, hardware, software, or format limitations
  18847. can cause video frames to be dropped and audio to be choppy or muted.</p>
  18848. <h5 id=best-practices-for-implementors-of-media-elements>4.8.14.19 Best practices for implementors of media elements</h5>
  18849. <p><i>This section is non-normative.</i></p>
  18850. <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
  18851. considered a quality-of-implementation issue.</p>
  18852. <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,
  18853. how precise an implementation reports the ranges that have been buffered depends on how carefully
  18854. the user agent inspects the data. Since the API reports ranges as times, but the data is obtained
  18855. in byte streams, a user agent receiving a variable-bit-rate stream might only be able to determine
  18856. precise times by actually decoding all of the data. User agents aren't required to do this,
  18857. however; they can instead return estimates (e.g. based on the average bit rate seen so far) which
  18858. get revised as more information becomes available.</p>
  18859. <p>As a general rule, user agents are urged to be conservative rather than optimistic. For
  18860. example, it would be bad to report that everything had been buffered when it had not.</p>
  18861. <p>Another quality-of-implementation issue would be playing a video backwards when the codec is
  18862. designed only for forward playback (e.g. there aren't many key frames, and they are far apart, and
  18863. the intervening frames only have deltas from the previous frame). User agents could do a poor job,
  18864. e.g. only showing key frames; however, better implementations would do more work and thus do a
  18865. better job, e.g. actually decoding parts of the video forwards, storing the complete frames, and
  18866. then playing the frames backwards.</p>
  18867. <p>Similarly, while implementations are allowed to drop buffered data at any time (there is no
  18868. requirement that a user agent keep all the media data obtained for the lifetime of the media
  18869. element), it is again a quality of implementation issue: user agents with sufficient resources to
  18870. keep all the data around are encouraged to do so, as this allows for a better user experience. For
  18871. example, if the user is watching a live stream, a user agent could allow the user only to view the
  18872. live video; however, a better user agent would buffer everything and allow the user to seek
  18873. through the earlier material, pause it, play it forwards and backwards, etc.</p>
  18874. <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
  18875. 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
  18876. <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
  18877. plays back in such situations is another quality-of-implementation issue.</p>
  18878. <hr>
  18879. <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
  18880. loop</a> reaches step 1, implementations that are resource constrained are encouraged to take
  18881. that opportunity to release all hardware resources (like video planes, networking resources, and
  18882. 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
  18883. playback position and so forth, though, in case playback is later restarted.)</p>
  18884. <h4 id=the-map-element>4.8.15 The <dfn><code>map</code></dfn> element</h4>
  18885. <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>
  18886. <pre class=idl>interface <dfn id=htmlmapelement>HTMLMapElement</dfn> : <a href=#htmlelement id=the-map-element:htmlelement>HTMLElement</a> {
  18887. attribute DOMString <a href=#dom-map-name id=the-map-element:dom-map-name>name</a>;
  18888. 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>;
  18889. 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>;
  18890. };</pre>
  18891. </dl>
  18892. <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
  18893. <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
  18894. <a href=#represents id=the-map-element:represents>represents</a> its children.</p>
  18895. <p>The <dfn id=attr-map-name><code>name</code></dfn> attribute gives the map a name so that
  18896. 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
  18897. 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
  18898. have the same value.</p>
  18899. <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>
  18900. <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
  18901. <code id=the-map-element:the-map-element-3><a href=#the-map-element>map</a></code>.</p>
  18902. <dt><var>map</var> . <code id=the-map-element:dom-map-images-2><a href=#dom-map-images>images</a></code><dd>
  18903. <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>
  18904. elements that use the <code id=the-map-element:the-map-element-4><a href=#the-map-element>map</a></code>.</p>
  18905. </dl>
  18906. <p>The <dfn id=dom-map-areas><code>areas</code></dfn> attribute must return an
  18907. <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
  18908. <code id=the-map-element:the-area-element-3><a href=#the-area-element>area</a></code> elements.</p>
  18909. <p>The <dfn id=dom-map-images><code>images</code></dfn> attribute must return an
  18910. <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
  18911. <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>
  18912. element according to the <a href=#image-map id=the-map-element:image-map-3>image map</a> processing model.</p>
  18913. <p>The IDL attribute <dfn id=dom-map-name><code>name</code></dfn> must <a href=#reflect id=the-map-element:reflect>reflect</a>
  18914. the content attribute of the same name.</p>
  18915. <div class=example>
  18916. <p>Image maps can be defined in conjunction with other content on the page, to ease maintenance.
  18917. This example is of a page with an image map at the top of the page and a corresponding set of
  18918. text links at the bottom.</p>
  18919. <pre>&lt;!DOCTYPE HTML>
  18920. &lt;TITLE>Babies™: Toys&lt;/TITLE>
  18921. &lt;HEADER>
  18922. &lt;H1>Toys&lt;/H1>
  18923. &lt;IMG SRC="/images/menu.gif"
  18924. ALT="Babies™ navigation menu. Select a department to go to its page."
  18925. USEMAP="#NAV">
  18926. &lt;/HEADER>
  18927. ...
  18928. &lt;FOOTER>
  18929. &lt;MAP NAME="NAV">
  18930. &lt;P>
  18931. &lt;A HREF="/clothes/">Clothes&lt;/A>
  18932. &lt;AREA ALT="Clothes" COORDS="0,0,100,50" HREF="/clothes/"> |
  18933. &lt;A HREF="/toys/">Toys&lt;/A>
  18934. &lt;AREA ALT="Toys" COORDS="100,0,200,50" HREF="/toys/"> |
  18935. &lt;A HREF="/food/">Food&lt;/A>
  18936. &lt;AREA ALT="Food" COORDS="200,0,300,50" HREF="/food/"> |
  18937. &lt;A HREF="/books/">Books&lt;/A>
  18938. &lt;AREA ALT="Books" COORDS="300,0,400,50" HREF="/books/">
  18939. &lt;/MAP>
  18940. &lt;/FOOTER></pre>
  18941. </div>
  18942. <h4 id=the-area-element>4.8.16 The <dfn><code>area</code></dfn> element</h4>
  18943. <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>
  18944. <pre class=idl>interface <dfn id=htmlareaelement>HTMLAreaElement</dfn> : <a href=#htmlelement id=the-area-element:htmlelement>HTMLElement</a> {
  18945. attribute DOMString <a href=#dom-area-alt id=the-area-element:dom-area-alt>alt</a>;
  18946. attribute DOMString <a href=#dom-area-coords id=the-area-element:dom-area-coords>coords</a>;
  18947. attribute DOMString <a href=#dom-area-shape id=the-area-element:dom-area-shape>shape</a>;
  18948. attribute DOMString <a href=#dom-area-target id=the-area-element:dom-area-target>target</a>;
  18949. attribute DOMString <a href=#dom-area-download id=the-area-element:dom-area-download>download</a>;
  18950. [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>;
  18951. attribute DOMString <a href=#dom-area-rel id=the-area-element:dom-area-rel>rel</a>;
  18952. 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>;
  18953. attribute DOMString <a href=#dom-area-hreflang id=the-area-element:dom-area-hreflang>hreflang</a>;
  18954. attribute DOMString <a href=#dom-area-type id=the-area-element:dom-area-type>type</a>;
  18955. // <a href="#HTMLAreaElement-partial">also has obsolete members</a>
  18956. };
  18957. <a href=#htmlareaelement id=the-area-element:htmlareaelement>HTMLAreaElement</a> implements <a href=#urlutils id=the-area-element:urlutils>URLUtils</a>;</pre>
  18958. </dl>
  18959. <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
  18960. 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>
  18961. <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
  18962. or a <code id=the-area-element:the-template-element-2><a href=#the-template-element>template</a></code> element ancestor.</p>
  18963. <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>
  18964. 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,
  18965. the <dfn id=attr-area-alt><code>alt</code></dfn> attribute must be present. It specifies the
  18966. text of the hyperlink. Its value must be text that, when presented with the texts specified for
  18967. 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,
  18968. but without the image itself, provides the user with the same kind of choice as the hyperlink
  18969. 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>
  18970. 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
  18971. <code id=the-area-element:attr-area-alt-3><a href=#attr-area-alt>alt</a></code> attribute.</p>
  18972. <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>
  18973. 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>
  18974. <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>
  18975. <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
  18976. attribute</a>. The following table lists the keywords defined for this attribute. The states
  18977. given in the first cell of the rows with keywords give the states to which those keywords map.
  18978. Some of the keywords are non-conforming, as noted in the last
  18979. column.</p>
  18980. <table><thead><tr><th>State
  18981. <th>Keywords
  18982. <th>Notes
  18983. <tbody><tr><td rowspan=2><a href=#attr-area-shape-circle id=the-area-element:attr-area-shape-circle>Circle state</a>
  18984. <td><dfn id=attr-area-shape-keyword-circle><code>circle</code></dfn>
  18985. <td>
  18986. <tr><td><dfn id=attr-area-shape-keyword-circ><code>circ</code></dfn>
  18987. <td>Non-conforming
  18988. <tr><td><a href=#attr-area-shape-default id=the-area-element:attr-area-shape-default>Default state</a>
  18989. <td><dfn id=attr-area-shape-keyword-default><code>default</code></dfn>
  18990. <td>
  18991. <tr><td rowspan=2><a href=#attr-area-shape-poly id=the-area-element:attr-area-shape-poly>Polygon state</a>
  18992. <td><dfn id=attr-area-shape-keyword-poly><code>poly</code></dfn>
  18993. <td>
  18994. <tr><td><dfn id=attr-area-shape-keyword-polygon><code>polygon</code></dfn>
  18995. <td>Non-conforming
  18996. <tr><td rowspan=2><a href=#attr-area-shape-rect id=the-area-element:attr-area-shape-rect>Rectangle state</a>
  18997. <td><dfn id=attr-area-shape-keyword-rect><code>rect</code></dfn>
  18998. <td>
  18999. <tr><td><dfn id=attr-area-shape-keyword-rectangle><code>rectangle</code></dfn>
  19000. <td>Non-conforming
  19001. </table>
  19002. <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>
  19003. <p>The <dfn id=attr-area-coords><code>coords</code></dfn> attribute must, if specified,
  19004. 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
  19005. described by the <code id=the-area-element:attr-area-shape-3><a href=#attr-area-shape>shape</a></code> attribute. The
  19006. 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
  19007. model.</p>
  19008. <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
  19009. 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
  19010. last of which must be non-negative. The first integer must be the distance in CSS pixels from the
  19011. left edge of the image to the center of the circle, the second integer must be the distance in CSS
  19012. pixels from the top edge of the image to the center of the circle, and the third integer must be
  19013. the radius of the circle, again in CSS pixels.</p>
  19014. <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>
  19015. 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
  19016. whole image.)</p>
  19017. <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
  19018. 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
  19019. number of integers must be even. Each pair of integers must represent a coordinate given as the
  19020. distances from the left and the top of the image in CSS pixels respectively, and all the
  19021. coordinates together must represent the points of the polygon, in order.</p>
  19022. <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
  19023. 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
  19024. first of which must be less than the third, and the second of which must be less than the fourth.
  19025. The four points must represent, respectively, the distance from the left edge of the image to the
  19026. left side of the rectangle, the distance from the top edge to the top side, the distance from the
  19027. left edge to the right side, and the distance from the top edge to the bottom side, all in CSS
  19028. pixels.</p>
  19029. <p>When user agents allow users to <a href=#following-hyperlinks-2 id=the-area-element:following-hyperlinks-2>follow hyperlinks</a> or
  19030. <a href=#downloading-hyperlinks id=the-area-element:downloading-hyperlinks>download hyperlinks</a> created using the
  19031. <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>
  19032. 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>
  19033. attributes may be used to indicate to the user the likely nature of the target resource before the
  19034. user follows the link.</p>
  19035. <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>,
  19036. <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>
  19037. 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
  19038. present.</p>
  19039. <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
  19040. <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
  19041. also be specified.</p>
  19042. <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
  19043. steps:</p>
  19044. <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>,
  19045. then abort these steps.<li>
  19046. <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>
  19047. 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
  19048. for choosing a browsing context given a browsing context name</a>, using the value of the
  19049. <code id=the-area-element:attr-hyperlink-target-5><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name, would
  19050. result in there not being a chosen browsing context, then run these substeps:</p>
  19051. <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
  19052. <code id=the-area-element:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.<li><p>Abort these steps without following the hyperlink.</ol>
  19053. <li><p>Otherwise, the user agent must <a href=#following-hyperlinks-2 id=the-area-element:following-hyperlinks-2-2>follow the
  19054. hyperlink</a> or <a href=#downloading-hyperlinks id=the-area-element:downloading-hyperlinks-2>download the hyperlink</a> created
  19055. 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
  19056. preference.</ol>
  19057. <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>,
  19058. <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
  19059. content attributes of the same name.</p>
  19060. <p>The IDL attribute <dfn id=dom-area-shape><code>shape</code></dfn> must
  19061. <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>
  19062. <p>The IDL attribute <dfn id=dom-area-rellist><code>relList</code></dfn> must
  19063. <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>
  19064. <hr>
  19065. <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>
  19066. <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
  19067. 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,
  19068. as the given value.</p>
  19069. <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
  19070. 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>
  19071. <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
  19072. encoding</a> is the <a href="#document's-character-encoding" id="the-area-element:document's-character-encoding">document's character encoding</a>.</p>
  19073. <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
  19074. 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
  19075. the string <var>value</var>.</p>
  19076. <h4 id=image-maps>4.8.17 Image maps</h4>
  19077. <h5 id=authoring>4.8.17.1 Authoring</h5>
  19078. <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>
  19079. <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
  19080. 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>
  19081. element) by specifying a <dfn id=attr-hyperlink-usemap><code>usemap</code></dfn> attribute on
  19082. 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
  19083. hash-name reference</a> to a <code id=authoring:the-map-element-2><a href=#the-map-element>map</a></code> element.</p>
  19084. <div class=example>
  19085. <p>Consider an image that looks as follows:</p>
  19086. <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>
  19087. <p>If we wanted just the coloured areas to be clickable, we could do it as follows:</p>
  19088. <pre>&lt;p>
  19089. Please select a shape:
  19090. &lt;img src="shapes.png" usemap="#shapes"
  19091. alt="Four shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star.">
  19092. &lt;map name="shapes">
  19093. &lt;area shape=rect coords="50,50,100,100"> &lt;!-- the hole in the red box -->
  19094. &lt;area shape=rect coords="25,25,125,125" href="red.html" alt="Red box.">
  19095. &lt;area shape=circle coords="200,75,50" href="green.html" alt="Green circle.">
  19096. &lt;area shape=poly coords="325,25,262,125,388,125" href="blue.html" alt="Blue triangle.">
  19097. &lt;area shape=poly coords="450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60"
  19098. href="yellow.html" alt="Yellow star.">
  19099. &lt;/map>
  19100. &lt;/p></pre>
  19101. </div>
  19102. <h5 id=processing-model-2>4.8.17.2 Processing model</h5>
  19103. <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
  19104. <code id=processing-model-2:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute specified, user agents must process it
  19105. as follows:</p>
  19106. <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.
  19107. This will return either an element (the <var>map</var>) or
  19108. null.<li><p>If that returned null, then abort these steps. The image is not associated with an image
  19109. 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
  19110. descendants of the <var>map</var>. Let those be the <var>areas</var>.</ol>
  19111. <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>
  19112. <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
  19113. it must use the following steps.</p>
  19114. <p class=note>In user agents that do not support images, or that have images disabled,
  19115. <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
  19116. <a href=#fallback-content id=processing-model-2:fallback-content>fallback content</a> is shown instead). The following steps therefore only apply to
  19117. <code id=processing-model-2:the-img-element-3><a href=#the-img-element>img</a></code> elements.</p>
  19118. <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>
  19119. 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
  19120. <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
  19121. <a href=#hyperlink id=processing-model-2:hyperlink>hyperlink</a>. Those hyperlinks should all be made available to the user in a manner
  19122. associated with the text of the <code id=processing-model-2:the-img-element-4><a href=#the-img-element>img</a></code>.</p>
  19123. <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
  19124. with no specified <code>alt</code> attributes, or whose <code>alt</code>
  19125. attributes are the empty string or some other non-visible text, in a user-agent-defined fashion
  19126. intended to indicate the lack of suitable author-provided text.</ol>
  19127. <p>If the user agent intends to show the image and allow interaction with the image to select
  19128. hyperlinks, then the image must be associated with a set of layered shapes, taken from the
  19129. <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
  19130. 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
  19131. 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>
  19132. <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
  19133. obtain a shape to layer onto the image:</p>
  19134. <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
  19135. 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
  19136. <var>coords</var> list. If the attribute is absent, let the <var>coords</var>
  19137. list be the empty list.<li>
  19138. <p>If the number of items in the <var>coords</var> list is less than the minimum number
  19139. 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
  19140. shape is empty; abort these steps.</p>
  19141. <table><thead><tr><th>State
  19142. <th>Minimum number of items
  19143. <tbody><tr><td><a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle>Circle state</a>
  19144. <td>3
  19145. <tr><td><a href=#attr-area-shape-default id=processing-model-2:attr-area-shape-default>Default state</a>
  19146. <td>0
  19147. <tr><td><a href=#attr-area-shape-poly id=processing-model-2:attr-area-shape-poly>Polygon state</a>
  19148. <td>6
  19149. <tr><td><a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect>Rectangle state</a>
  19150. <td>4
  19151. </table>
  19152. <li>
  19153. <p>Check for excess items in the <var>coords</var> list as per the entry in the
  19154. following list corresponding to the <code id=processing-model-2:attr-area-shape-2><a href=#attr-area-shape>shape</a></code> attribute's
  19155. state:</p>
  19156. <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>
  19157. <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
  19158. 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
  19159. 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
  19160. 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
  19161. 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>
  19162. <dl class=switch><dt><a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle-4>Circle state</a><dd>
  19163. <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>
  19164. <p>The shape is a circle whose center is <var>x</var> CSS pixels from the left edge
  19165. of the image and <var>y</var> CSS pixels from the top edge of the image, and whose
  19166. radius is <var>r</var> pixels.</p>
  19167. <dt><a href=#attr-area-shape-default id=processing-model-2:attr-area-shape-default-3>Default state</a><dd>
  19168. <p>The shape is a rectangle that exactly covers the entire image.</p>
  19169. <dt><a href=#attr-area-shape-poly id=processing-model-2:attr-area-shape-poly-3>Polygon state</a><dd>
  19170. <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>
  19171. <p>Let <var>the coordinates</var> be (<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>),
  19172. interpreted in CSS pixels measured from the top left of the image, for all integer values of
  19173. <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>
  19174. <p>The shape is a polygon whose vertices are given by <var>the coordinates</var>, and
  19175. whose interior is established using the even-odd rule. <a href=#refsGRAPHICS>[GRAPHICS]</a></p>
  19176. <dt><a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect-5>Rectangle state</a><dd>
  19177. <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>
  19178. <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
  19179. bottom right corner is given by the coordinate (<var>x<sub>2</sub></var>,
  19180. <var>y<sub>2</sub></var>), those coordinates being interpreted as CSS pixels
  19181. from the top left corner of the image.</p>
  19182. </dl>
  19183. <p>For historical reasons, the coordinates must be interpreted relative to the
  19184. <em>displayed</em> image after any stretching caused by the CSS 'width' and 'height' properties
  19185. (or, for non-CSS browsers, the image element's <code>width</code> and <code>height</code> attributes — CSS browsers map those attributes to the
  19186. aforementioned CSS properties).</p>
  19187. <p class=note>Browser zoom features and transforms applied using CSS or SVG do not affect the
  19188. coordinates.</p>
  19189. </ol>
  19190. <p>Pointing device interaction with an image associated with a set of layered shapes per the above
  19191. algorithm must result in the relevant user interaction events being first fired to the top-most
  19192. shape covering the point that the pointing device indicated, if any, or to the image element
  19193. itself, if there is no shape covering that point. User agents may also allow individual
  19194. <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
  19195. and activated (e.g. using a keyboard).</p>
  19196. <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
  19197. 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
  19198. <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>
  19199. of the document.</p>
  19200. <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
  19201. had rerun the algorithms for image maps.</p>
  19202. <h4 id=mathml>4.8.18 MathML</h4>
  19203. <p>The <dfn id=math><code>math</code></dfn> element from the <a href=#mathml-namespace id=mathml:mathml-namespace>MathML namespace</a>
  19204. 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
  19205. content</a> categories for the purposes of the content models in this specification.</p>
  19206. <p>This specification refers to several specific MathML elements, in particular:
  19207. <dfn id=math:annotation-xml><code>annotation-xml</code></dfn>,
  19208. <dfn id=math:merror><code>merror</code></dfn>,
  19209. <dfn id=math:mi><code>mi</code></dfn>,
  19210. <dfn id=math:mn><code>mn</code></dfn>,
  19211. <dfn id=math:mo><code>mo</code></dfn>,
  19212. <dfn id=math:ms><code>ms</code></dfn>, and
  19213. <dfn id=math:mtext><code>mtext</code></dfn>.
  19214. </p>
  19215. <p>When the MathML <code id=mathml:math:annotation-xml><a href=#math:annotation-xml>annotation-xml</a></code> element contains
  19216. 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
  19217. content</a>. <a href=#refsMATHML>[MATHML]</a></p>
  19218. <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>,
  19219. and <code id=mathml:math:mtext><a href=#math:mtext>mtext</a></code>) are descendants of HTML elements, they may contain
  19220. <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>
  19221. <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
  19222. elements whose content models do not allow straight text by pretending for the purposes of MathML
  19223. 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,
  19224. however, conforming.)</p>
  19225. <p>User agents must act as if any MathML element whose contents does not match the element's
  19226. 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
  19227. appropriate error message.</p>
  19228. <p>To enable authors to use MathML tools that only accept MathML in its XML form, interactive HTML
  19229. user agents are encouraged to provide a way to export any MathML fragment as an XML
  19230. namespace-well-formed XML fragment.</p>
  19231. <p>The semantics of MathML elements are defined by the MathML specification and <a href=#other-applicable-specifications id=mathml:other-applicable-specifications>other
  19232. applicable specifications</a>. <a href=#refsMATHML>[MATHML]</a></p>
  19233. <div class=example>
  19234. <p>Here is an example of the use of MathML in an HTML document:</p>
  19235. <pre>&lt;!DOCTYPE html>
  19236. &lt;html>
  19237. &lt;head>
  19238. &lt;title>The quadratic formula&lt;/title>
  19239. &lt;/head>
  19240. &lt;body>
  19241. &lt;h1>The quadratic formula&lt;/h1>
  19242. &lt;p>
  19243. &lt;math>
  19244. &lt;mi>x&lt;/mi>
  19245. &lt;mo>=&lt;/mo>
  19246. &lt;mfrac>
  19247. &lt;mrow>
  19248. &lt;mo form="prefix">−&lt;/mo> &lt;mi>b&lt;/mi>
  19249. &lt;mo>±&lt;/mo>
  19250. &lt;msqrt>
  19251. &lt;msup> &lt;mi>b&lt;/mi> &lt;mn>2&lt;/mn> &lt;/msup>
  19252. &lt;mo>−&lt;/mo>
  19253. &lt;mn>4&lt;/mn> &lt;mo>⁢&lt;/mo> &lt;mi>a&lt;/mi> &lt;mo>⁢&lt;/mo> &lt;mi>c&lt;/mi>
  19254. &lt;/msqrt>
  19255. &lt;/mrow>
  19256. &lt;mrow>
  19257. &lt;mn>2&lt;/mn> &lt;mo>⁢&lt;/mo> &lt;mi>a&lt;/mi>
  19258. &lt;/mrow>
  19259. &lt;/mfrac>
  19260. &lt;/math>
  19261. &lt;/p>
  19262. &lt;/body>
  19263. &lt;/html></pre>
  19264. </div>
  19265. <h4 id=svg>4.8.19 SVG</h4>
  19266. <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
  19267. <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>
  19268. categories for the purposes of the content models in this specification.</p>
  19269. <p>To enable authors to use SVG tools that only accept SVG in its XML form, interactive HTML user
  19270. agents are encouraged to provide a way to export any SVG fragment as an XML namespace-well-formed
  19271. XML fragment.</p>
  19272. <p>When the SVG <code>foreignObject</code> element contains elements from the <a href=#html-namespace-2 id=svg:html-namespace-2>HTML
  19273. 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>
  19274. <p>The content model for <code>title</code> elements in the <a href=#svg-namespace id=svg:svg-namespace-2>SVG namespace</a>
  19275. 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
  19276. requirements given in the SVG specification.)</p>
  19277. <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
  19278. specifications</a>. <a href=#refsSVG>[SVG]</a></p>
  19279. <h4 id=dimension-attributes>4.8.20 <dfn>Dimension attributes</dfn></h4>
  19280. <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>,
  19281. <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
  19282. specified to give the dimensions of the visual content of the element (the width and height
  19283. respectively, relative to the nominal direction of the output medium), in CSS pixels. The
  19284. 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>
  19285. <p>The specified dimensions given may differ from the dimensions specified in the resource itself,
  19286. since the resource may have a resolution that differs from the CSS pixel resolution. (On screens,
  19287. CSS pixels have a resolution of 96ppi, but in general the CSS pixel resolution depends on the
  19288. reading distance.) If both attributes are specified, then one of the following statements must be
  19289. true:</p>
  19290. <ul><li><span><var>specified width</var> - 0.5 ≤
  19291. <var>specified height</var> * <var>target ratio</var> ≤
  19292. <var>specified width</var> + 0.5</span><li><span><var>specified height</var> - 0.5 ≤
  19293. <var>specified width</var> / <var>target ratio</var> ≤
  19294. <var>specified height</var> + 0.5</span><li><span><var>specified height</var> = <var>specified width</var> = 0</span></ul>
  19295. <p>The <var>target ratio</var> is the ratio of the intrinsic width to the intrinsic
  19296. height in the resource. The <var>specified width</var> and <var>specified
  19297. 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>
  19298. <p>The two attributes must be omitted if the resource in question does not have both an intrinsic
  19299. width and an intrinsic height.</p>
  19300. <p>If the two attributes are both zero, it indicates that the element is not intended for the user
  19301. (e.g. it might be a part of a service to count page views).</p>
  19302. <p class=note>The dimension attributes are not intended to be used to stretch the image.</p>
  19303. <p><strong>User agent requirements</strong>: User agents are expected to use these attributes <a href=#dimRendering>as hints for the rendering</a>.</p>
  19304. <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>,
  19305. <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>
  19306. the respective content attributes of the same name.</p>
  19307. <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
  19308. 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>
  19309. <p class=note>The corresponding IDL attributes for <code id=dimension-attributes:dom-img-height><a href=#dom-img-height>img</a></code> and
  19310. <code id=dimension-attributes:dom-input-height><a href=#dom-input-height>input</a></code> elements are defined in those respective elements'
  19311. sections, as they are slightly more specific to those elements' other behaviors.</p>
  19312. <h3 id=tables>4.9 Tabular data</h3>
  19313. <h4 id=the-table-element>4.9.1 The <dfn><code>table</code></dfn> element</h4>
  19314. <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,
  19315. followed by zero or more <code id=the-table-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> elements, followed
  19316. optionally by a <code id=the-table-element:the-thead-element><a href=#the-thead-element>thead</a></code> element, followed optionally by
  19317. a <code id=the-table-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element, followed by either zero or more
  19318. <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>
  19319. elements, followed optionally by a <code id=the-table-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element (but
  19320. 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
  19321. 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>
  19322. <pre class=idl>interface <dfn id=htmltableelement>HTMLTableElement</dfn> : <a href=#htmlelement id=the-table-element:htmlelement>HTMLElement</a> {
  19323. 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>;
  19324. <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>();
  19325. void <a href=#dom-table-deletecaption id=the-table-element:dom-table-deletecaption>deleteCaption</a>();
  19326. 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>;
  19327. <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>();
  19328. void <a href=#dom-table-deletethead id=the-table-element:dom-table-deletethead>deleteTHead</a>();
  19329. 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>;
  19330. <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>();
  19331. void <a href=#dom-table-deletetfoot id=the-table-element:dom-table-deletetfoot>deleteTFoot</a>();
  19332. 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>;
  19333. <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>();
  19334. 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>;
  19335. <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);
  19336. void <a href=#dom-table-deleterow id=the-table-element:dom-table-deleterow>deleteRow</a>(long index);
  19337. attribute boolean <a href=#dom-table-sortable id=the-table-element:dom-table-sortable>sortable</a>;
  19338. void <a href=#dom-table-stopsorting id=the-table-element:dom-table-stopsorting>stopSorting</a>();
  19339. // <a href="#HTMLTableElement-partial">also has obsolete members</a>
  19340. };</pre>
  19341. </dl>
  19342. <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
  19343. the form of a <a href=#concept-table id=the-table-element:concept-table>table</a>.</p>
  19344. <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
  19345. model</a>. Tables have rows, columns, and cells given by their descendants. The rows and
  19346. columns form a grid; a table's cells must completely cover that grid without overlap.</p>
  19347. <p class=note>Precise rules for determining whether this conformance requirement is met are
  19348. described in the description of the <a href=#table-model id=the-table-element:table-model-2>table model</a>.</p>
  19349. <p>Authors are encouraged to provide information describing how to interpret complex tables.
  19350. Guidance on how to <a href=#table-descriptions-techniques>provide such information</a> is given
  19351. below.</p>
  19352. <p>Tables must not be used as layout aids. Historically, some Web authors have misused tables in
  19353. HTML as a way to control their page layout. This usage is non-conforming, because tools attempting
  19354. to extract tabular data from such documents would obtain very confusing results. In particular,
  19355. users of accessibility tools like screen readers are likely to find it very difficult to navigate
  19356. pages with tables used for layout.</p>
  19357. <p class=note>There are a variety of alternatives to using HTML tables for layout, primarily
  19358. using CSS positioning and the CSS table model. <a href=#refsCSS>[CSS]</a></p>
  19359. <hr>
  19360. <p>Tables can be complicated to understand and navigate. To help users with this, user agents
  19361. should clearly delineate cells in a table from each other, unless the user agent has classified
  19362. the table as a (non-conforming) layout table.</p>
  19363. <p class=note>Authors and implementors are encouraged to consider
  19364. using some of the <a href=#table-layout-techniques>table design techniques</a> described below
  19365. to make tables easier to navigate for users.</p>
  19366. <p>User agents, especially those that do table analysis on arbitrary content, are encouraged to
  19367. find heuristics to determine which tables actually contain data and which are merely being used
  19368. for layout. This specification does not define a precise heuristic, but the following are
  19369. suggested as possible indicators:</p>
  19370. <table><thead><tr><th>Feature
  19371. <th>Indication
  19372. <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>
  19373. <td>Probably a layout table
  19374. <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
  19375. <td>Probably a layout table
  19376. <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
  19377. <code id=the-table-element:attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> attributes with the value 0
  19378. <td>Probably a layout table
  19379. <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
  19380. <td>Probably a non-layout table
  19381. <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
  19382. <td>Probably a non-layout table
  19383. <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
  19384. <td>Probably a non-layout table
  19385. <tr><td>Explicit visible borders set using CSS
  19386. <td>Probably a non-layout table
  19387. <tbody><tr><td>The use of the <code id=the-table-element:attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute
  19388. <td>Not a good indicator (both layout and non-layout tables have historically been given this attribute)
  19389. </table>
  19390. <p class=note>It is quite possible that the above suggestions are wrong. Implementors are urged
  19391. to provide feedback elaborating on their experiences with trying to create a layout table
  19392. detection heuristic.</p>
  19393. <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
  19394. table as a layout table, the user agent may report the contents of that attribute to the user.</p>
  19395. <hr>
  19396. <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
  19397. sorting model</a>.</p>
  19398. <hr>
  19399. <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>
  19400. <p>Returns the table's <code id=the-table-element:the-caption-element-3><a href=#the-caption-element>caption</a></code> element.</p>
  19401. <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>
  19402. <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>
  19403. <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>
  19404. <dt><var>table</var> . <code id=the-table-element:dom-table-deletecaption-2><a href=#dom-table-deletecaption>deleteCaption</a></code>()<dd>
  19405. <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>
  19406. <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>
  19407. <p>Returns the table's <code id=the-table-element:the-thead-element-3><a href=#the-thead-element>thead</a></code> element.</p>
  19408. <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
  19409. <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>
  19410. <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>
  19411. <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>
  19412. <dt><var>table</var> . <code id=the-table-element:dom-table-deletethead-2><a href=#dom-table-deletethead>deleteTHead</a></code>()<dd>
  19413. <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>
  19414. <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>
  19415. <p>Returns the table's <code id=the-table-element:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> element.</p>
  19416. <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
  19417. <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>
  19418. <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>
  19419. <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>
  19420. <dt><var>table</var> . <code id=the-table-element:dom-table-deletetfoot-2><a href=#dom-table-deletetfoot>deleteTFoot</a></code>()<dd>
  19421. <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>
  19422. <dt><var>table</var> . <code id=the-table-element:dom-table-tbodies-2><a href=#dom-table-tbodies>tBodies</a></code><dd>
  19423. <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>
  19424. <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>
  19425. <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>
  19426. <dt><var>table</var> . <code id=the-table-element:dom-table-rows-2><a href=#dom-table-rows>rows</a></code><dd>
  19427. <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>
  19428. <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>
  19429. <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
  19430. 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>
  19431. <p>The position is relative to the rows in the table. The index −1, which is the default
  19432. if the argument is omitted, is equivalent to inserting at the end of the table.</p>
  19433. <p>If the given position is less than −1 or greater than the number of rows, throws an
  19434. <code id=the-table-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19435. <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>
  19436. <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>
  19437. <p>The position is relative to the rows in the table. The index −1 is equivalent to
  19438. deleting the last row of the table.</p>
  19439. <p>If the given position is less than −1 or greater than the index of the last row, or if
  19440. there are no rows, throws an <code id=the-table-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19441. </dl>
  19442. <p>The <dfn id=dom-table-caption><code>caption</code></dfn> IDL attribute must return, on
  19443. 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,
  19444. 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
  19445. <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
  19446. 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>
  19447. <p>The <dfn id=dom-table-createcaption><code>createCaption()</code></dfn> method must return
  19448. 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
  19449. 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
  19450. <code id=the-table-element:the-table-element-8><a href=#the-table-element>table</a></code> element, and then returned.</p>
  19451. <p>The <dfn id=dom-table-deletecaption><code>deleteCaption()</code></dfn> method must remove
  19452. 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>
  19453. <p>The <dfn id=dom-table-thead><code>tHead</code></dfn> IDL attribute must return, on
  19454. 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
  19455. 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
  19456. <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
  19457. the new value, if not null, must be inserted immediately before the first element in the
  19458. <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
  19459. <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.
  19460. 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
  19461. <code id=the-table-element:hierarchyrequesterror-3><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown instead.</p>
  19462. <p>The <dfn id=dom-table-createthead><code>createTHead()</code></dfn> method must return the
  19463. 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
  19464. <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
  19465. 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
  19466. <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,
  19467. and then that new element must be returned.</p>
  19468. <p>The <dfn id=dom-table-deletethead><code>deleteTHead()</code></dfn> method must remove the
  19469. 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>
  19470. <p>The <dfn id=dom-table-tfoot><code>tFoot</code></dfn> IDL attribute must return, on
  19471. 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
  19472. 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
  19473. <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
  19474. the new value, if not null, must be inserted immediately before the first element in the
  19475. <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>
  19476. 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
  19477. 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
  19478. <code id=the-table-element:hierarchyrequesterror-4><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown instead.</p>
  19479. <p>The <dfn id=dom-table-createtfoot><code>createTFoot()</code></dfn> method must return the
  19480. 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
  19481. <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
  19482. 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
  19483. <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
  19484. table if there are no such elements, and then that new element must be returned.</p>
  19485. <p>The <dfn id=dom-table-deletetfoot><code>deleteTFoot()</code></dfn> method must remove the
  19486. 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>
  19487. <p>The <dfn id=dom-table-tbodies><code>tBodies</code></dfn> attribute must return an
  19488. <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
  19489. <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>
  19490. <p>The <dfn id=dom-table-createtbody><code>createTBody()</code></dfn> method must create a
  19491. 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
  19492. 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
  19493. 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
  19494. the new <code id=the-table-element:the-tbody-element-9><a href=#the-tbody-element>tbody</a></code> element.</p>
  19495. <p>The <dfn id=dom-table-rows><code>rows</code></dfn> attribute must return an
  19496. <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
  19497. <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
  19498. 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
  19499. 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
  19500. 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>,
  19501. 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>
  19502. 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
  19503. <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>
  19504. <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,
  19505. the method must act as required by the first item in the following list of conditions that
  19506. describes the state of the table and the <var>index</var> argument:</p>
  19507. <dl class=switch><dt>If <var>index</var> is less than −1 or greater than the number of elements
  19508. 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
  19509. <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,
  19510. 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
  19511. <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
  19512. <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>
  19513. 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
  19514. <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
  19515. 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>
  19516. 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>
  19517. element.</dl>
  19518. <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
  19519. steps:</p>
  19520. <ol><li><p>If <var>index</var> is equal to −1, then <var>index</var> must be
  19521. 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
  19522. one.<li><p>Now, if <var>index</var> is less than zero, or greater than or equal to the
  19523. 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
  19524. 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>
  19525. </ol>
  19526. <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
  19527. sorting model</a>.</p>
  19528. <p>The IDL attribute <dfn id=dom-table-sortable><code>sortable</code></dfn> must
  19529. <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>
  19530. <div class=example>
  19531. <p>Here is an example of a table being used to mark up a Sudoku puzzle. Observe the lack of
  19532. headers, which are not necessary in such a table.</p>
  19533. <pre>&lt;section>
  19534. &lt;style scoped>
  19535. table { border-collapse: collapse; border: solid thick; }
  19536. colgroup, tbody { border: solid medium; }
  19537. td { border: solid thin; height: 1.4em; width: 1.4em; text-align: center; padding: 0; }
  19538. &lt;/style>
  19539. &lt;h1>Today's Sudoku&lt;/h1>
  19540. &lt;table>
  19541. &lt;colgroup>&lt;col>&lt;col>&lt;col>
  19542. &lt;colgroup>&lt;col>&lt;col>&lt;col>
  19543. &lt;colgroup>&lt;col>&lt;col>&lt;col>
  19544. &lt;tbody>
  19545. &lt;tr> &lt;td> 1 &lt;td> &lt;td> 3 &lt;td> 6 &lt;td> &lt;td> 4 &lt;td> 7 &lt;td> &lt;td> 9
  19546. &lt;tr> &lt;td> &lt;td> 2 &lt;td> &lt;td> &lt;td> 9 &lt;td> &lt;td> &lt;td> 1 &lt;td>
  19547. &lt;tr> &lt;td> 7 &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> 6
  19548. &lt;tbody>
  19549. &lt;tr> &lt;td> 2 &lt;td> &lt;td> 4 &lt;td> &lt;td> 3 &lt;td> &lt;td> 9 &lt;td> &lt;td> 8
  19550. &lt;tr> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td>
  19551. &lt;tr> &lt;td> 5 &lt;td> &lt;td> &lt;td> 9 &lt;td> &lt;td> 7 &lt;td> &lt;td> &lt;td> 1
  19552. &lt;tbody>
  19553. &lt;tr> &lt;td> 6 &lt;td> &lt;td> &lt;td> &lt;td> 5 &lt;td> &lt;td> &lt;td> &lt;td> 2
  19554. &lt;tr> &lt;td> &lt;td> &lt;td> &lt;td> &lt;td> 7 &lt;td> &lt;td> &lt;td> &lt;td>
  19555. &lt;tr> &lt;td> 9 &lt;td> &lt;td> &lt;td> 8 &lt;td> &lt;td> 2 &lt;td> &lt;td> &lt;td> 5
  19556. &lt;/table>
  19557. &lt;/section></pre>
  19558. </div>
  19559. <h5 id=table-descriptions-techniques>4.9.1.1 Techniques for describing tables</h5>
  19560. <p id=table-descriptions>For tables that consist of more than just a grid of cells with headers
  19561. in the first row and headers in the first column, and for any table in general where the reader
  19562. might have difficulty understanding the content, authors should include explanatory information
  19563. introducing the table. This information is useful for all users, but is especially useful for
  19564. users who cannot see the table, e.g. users of screen readers.</p>
  19565. <p>Such explanatory information should introduce the purpose of the table, outline its basic cell
  19566. structure, highlight any trends or patterns, and generally teach the user how to use the
  19567. table.</p>
  19568. <p>For instance, the following table:</p>
  19569. <table><caption>Characteristics with positive and negative sides</caption><thead><tr><th id=n> Negative
  19570. <th> Characteristic
  19571. <th> Positive
  19572. <tbody><tr><td headers="n r1"> Sad
  19573. <th id=r1> Mood
  19574. <td> Happy
  19575. <tr><td headers="n r2"> Failing
  19576. <th id=r2> Grade
  19577. <td> Passing
  19578. </table>
  19579. <p>...might benefit from a description explaining the way the table is laid out, something like
  19580. "Characteristics are given in the second column, with the negative side in the left column and the
  19581. positive side in the right column".</p>
  19582. <p>There are a variety of ways to include this information, such as:</p>
  19583. <dl><dt>In prose, surrounding the table<dd>
  19584. <div class=example><pre>&lt;p>In the following table, characteristics are given in the second
  19585. column, with the negative side in the left column and the positive
  19586. side in the right column.&lt;/p>
  19587. &lt;table>
  19588. &lt;caption>Characteristics with positive and negative sides&lt;/caption>
  19589. &lt;thead>
  19590. &lt;tr>
  19591. &lt;th id="n"> Negative
  19592. &lt;th> Characteristic
  19593. &lt;th> Positive
  19594. &lt;tbody>
  19595. &lt;tr>
  19596. &lt;td headers="n r1"> Sad
  19597. &lt;th id="r1"> Mood
  19598. &lt;td> Happy
  19599. &lt;tr>
  19600. &lt;td headers="n r2"> Failing
  19601. &lt;th id="r2"> Grade
  19602. &lt;td> Passing
  19603. &lt;/table></pre></div>
  19604. <dt>In the table's <code id=table-descriptions-techniques:the-caption-element><a href=#the-caption-element>caption</a></code><dd>
  19605. <div class=example><pre>&lt;table>
  19606. &lt;caption>
  19607. &lt;strong>Characteristics with positive and negative sides.&lt;/strong>
  19608. &lt;p>Characteristics are given in the second column, with the
  19609. negative side in the left column and the positive side in the right
  19610. column.&lt;/p>
  19611. &lt;/caption>
  19612. &lt;thead>
  19613. &lt;tr>
  19614. &lt;th id="n"> Negative
  19615. &lt;th> Characteristic
  19616. &lt;th> Positive
  19617. &lt;tbody>
  19618. &lt;tr>
  19619. &lt;td headers="n r1"> Sad
  19620. &lt;th id="r1"> Mood
  19621. &lt;td> Happy
  19622. &lt;tr>
  19623. &lt;td headers="n r2"> Failing
  19624. &lt;th id="r2"> Grade
  19625. &lt;td> Passing
  19626. &lt;/table></pre></div>
  19627. <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>
  19628. <div class=example><pre>&lt;table>
  19629. &lt;caption>
  19630. &lt;strong>Characteristics with positive and negative sides.&lt;/strong>
  19631. &lt;details>
  19632. &lt;summary>Help&lt;/summary>
  19633. &lt;p>Characteristics are given in the second column, with the
  19634. negative side in the left column and the positive side in the right
  19635. column.&lt;/p>
  19636. &lt;/details>
  19637. &lt;/caption>
  19638. &lt;thead>
  19639. &lt;tr>
  19640. &lt;th id="n"> Negative
  19641. &lt;th> Characteristic
  19642. &lt;th> Positive
  19643. &lt;tbody>
  19644. &lt;tr>
  19645. &lt;td headers="n r1"> Sad
  19646. &lt;th id="r1"> Mood
  19647. &lt;td> Happy
  19648. &lt;tr>
  19649. &lt;td headers="n r2"> Failing
  19650. &lt;th id="r2"> Grade
  19651. &lt;td> Passing
  19652. &lt;/table></pre></div>
  19653. <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>
  19654. <div class=example><pre>&lt;figure>
  19655. &lt;figcaption>Characteristics with positive and negative sides&lt;/figcaption>
  19656. &lt;p>Characteristics are given in the second column, with the
  19657. negative side in the left column and the positive side in the right
  19658. column.&lt;/p>
  19659. &lt;table>
  19660. &lt;thead>
  19661. &lt;tr>
  19662. &lt;th id="n"> Negative
  19663. &lt;th> Characteristic
  19664. &lt;th> Positive
  19665. &lt;tbody>
  19666. &lt;tr>
  19667. &lt;td headers="n r1"> Sad
  19668. &lt;th id="r1"> Mood
  19669. &lt;td> Happy
  19670. &lt;tr>
  19671. &lt;td headers="n r2"> Failing
  19672. &lt;th id="r2"> Grade
  19673. &lt;td> Passing
  19674. &lt;/table>
  19675. &lt;/figure></pre></div>
  19676. <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>
  19677. <div class=example><pre>&lt;figure>
  19678. &lt;figcaption>
  19679. &lt;strong>Characteristics with positive and negative sides&lt;/strong>
  19680. &lt;p>Characteristics are given in the second column, with the
  19681. negative side in the left column and the positive side in the right
  19682. column.&lt;/p>
  19683. &lt;/figcaption>
  19684. &lt;table>
  19685. &lt;thead>
  19686. &lt;tr>
  19687. &lt;th id="n"> Negative
  19688. &lt;th> Characteristic
  19689. &lt;th> Positive
  19690. &lt;tbody>
  19691. &lt;tr>
  19692. &lt;td headers="n r1"> Sad
  19693. &lt;th id="r1"> Mood
  19694. &lt;td> Happy
  19695. &lt;tr>
  19696. &lt;td headers="n r2"> Failing
  19697. &lt;th id="r2"> Grade
  19698. &lt;td> Passing
  19699. &lt;/table>
  19700. &lt;/figure></pre></div>
  19701. </dl>
  19702. <p>Authors may also use other techniques, or combinations of the above techniques, as
  19703. appropriate.</p>
  19704. <p>The best option, of course, rather than writing a description explaining the way the table is
  19705. laid out, is to adjust the table such that no explanation is needed.</p>
  19706. <div class=example>
  19707. <p>In the case of the table used in the examples above, a simple rearrangement of the table so
  19708. that the headers are on the top and left sides removes the need for an explanation as well as
  19709. 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>
  19710. <pre>&lt;table>
  19711. &lt;caption>Characteristics with positive and negative sides&lt;/caption>
  19712. &lt;thead>
  19713. &lt;tr>
  19714. &lt;th> Characteristic
  19715. &lt;th> Negative
  19716. &lt;th> Positive
  19717. &lt;tbody>
  19718. &lt;tr>
  19719. &lt;th> Mood
  19720. &lt;td> Sad
  19721. &lt;td> Happy
  19722. &lt;tr>
  19723. &lt;th> Grade
  19724. &lt;td> Failing
  19725. &lt;td> Passing
  19726. &lt;/table></pre>
  19727. </div>
  19728. <h5 id=table-layout-techniques>4.9.1.2 Techniques for table design</h5>
  19729. <p>Good table design is key to making tables more readable and usable.</p>
  19730. <p>In visual media, providing column and row borders and alternating row backgrounds can be very
  19731. effective to make complicated tables more readable.</p>
  19732. <p>For tables with large volumes of numeric content, using monospaced fonts can help users see
  19733. patterns, especially in situations where a user agent does not render the borders. (Unfortunately,
  19734. for historical reasons, not rendering borders on tables is a common default.)</p>
  19735. <p>In speech media, table cells can be distinguished by reporting the corresponding headers before
  19736. reading the cell's contents, and by allowing users to navigate the table in a grid fashion, rather
  19737. than serialising the entire contents of the table in source order.</p>
  19738. <p>Authors are encouraged to use CSS to achieve these effects.</p>
  19739. <p>User agents are encouraged to render tables using these techniques whenever the page does not
  19740. use CSS and the table is not classified as a layout table.</p>
  19741. <h4 id=the-caption-element>4.9.2 The <dfn><code>caption</code></dfn> element</h4>
  19742. <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
  19743. 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
  19744. 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>
  19745. <pre class=idl>interface <dfn id=htmltablecaptionelement>HTMLTableCaptionElement</dfn> : <a href=#htmlelement id=the-caption-element:htmlelement>HTMLElement</a> {
  19746. // <a href="#HTMLTableCaptionElement-partial">also has obsolete members</a>
  19747. };</pre>
  19748. </dl>
  19749. <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>
  19750. 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>
  19751. <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>
  19752. <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
  19753. 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
  19754. the <code id=the-caption-element:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code>.</p>
  19755. <p>A caption can introduce context for a table, making it significantly easier to understand.</p>
  19756. <div class=example>
  19757. <p>Consider, for instance, the following table:</p>
  19758. <table class=dice-example><tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
  19759. <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
  19760. <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
  19761. <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
  19762. <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
  19763. <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
  19764. <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
  19765. </table>
  19766. <p>In the abstract, this table is not clear. However, with a caption giving the table's number
  19767. (for reference in the main prose) and explaining its use, it makes more sense:</p>
  19768. <pre>&lt;caption>
  19769. &lt;p>Table 1.
  19770. &lt;p>This table shows the total score obtained from rolling two
  19771. six-sided dice. The first row represents the value of the first die,
  19772. the first column the value of the second die. The total is given in
  19773. the cell that corresponds to the values of the two dice.
  19774. &lt;/caption></pre>
  19775. <p>This provides the user with more context:</p>
  19776. <table class=dice-example><caption>
  19777. <p>Table 1.
  19778. <p>This table shows the total score obtained from rolling two
  19779. six-sided dice. The first row represents the value of the first
  19780. die, the first column the value of the second die. The total is
  19781. given in the cell that corresponds to the values of the two dice.
  19782. </caption><tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
  19783. <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
  19784. <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
  19785. <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
  19786. <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
  19787. <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
  19788. <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
  19789. </table>
  19790. </div>
  19791. <h4 id=the-colgroup-element>4.9.3 The <dfn><code>colgroup</code></dfn> element</h4>
  19792. <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
  19793. <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>,
  19794. <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>
  19795. 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
  19796. 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,
  19797. 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
  19798. <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
  19799. 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
  19800. 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
  19801. 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>
  19802. <pre class=idl>interface <dfn id=htmltablecolelement>HTMLTableColElement</dfn> : <a href=#htmlelement id=the-colgroup-element:htmlelement>HTMLElement</a> {
  19803. attribute unsigned long <a href=#dom-colgroup-span id=the-colgroup-element:dom-colgroup-span>span</a>;
  19804. // <a href="#HTMLTableColElement-partial">also has obsolete members</a>
  19805. };</pre>
  19806. </dl>
  19807. <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
  19808. parent and that is a <code id=the-colgroup-element:the-table-element-3><a href=#the-table-element>table</a></code> element.</p>
  19809. <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
  19810. may have a <dfn id=attr-colgroup-span><code>span</code></dfn> content attribute specified,
  19811. 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>
  19812. <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>
  19813. attribute take part in the <a href=#table-model id=the-colgroup-element:table-model>table model</a>.</p>
  19814. <p>The <dfn id=dom-colgroup-span><code>span</code></dfn> IDL attribute must
  19815. <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
  19816. only non-negative numbers greater than zero</a>.</p>
  19817. <h4 id=the-col-element>4.9.4 The <dfn><code>col</code></dfn> element</h4>
  19818. <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
  19819. 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>
  19820. <p><code id=the-col-element:htmltablecolelement><a href=#htmltablecolelement>HTMLTableColElement</a></code>, same as for
  19821. <code id=the-col-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> elements. This interface defines one member,
  19822. <code id=the-col-element:dom-col-span><a href=#dom-col-span>span</a></code>.</p>
  19823. </dl>
  19824. <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
  19825. 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
  19826. <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>
  19827. <p>The element may have a <dfn id=attr-col-span><code>span</code></dfn> content attribute
  19828. 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>
  19829. <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
  19830. part in the <a href=#table-model id=the-col-element:table-model>table model</a>.</p>
  19831. <p>The <dfn id=dom-col-span><code>span</code></dfn> IDL attribute must <a href=#reflect id=the-col-element:reflect>reflect</a>
  19832. 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
  19833. numbers greater than zero</a>.</p>
  19834. <h4 id=the-tbody-element>4.9.5 The <dfn><code>tbody</code></dfn> element</h4>
  19835. <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
  19836. <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
  19837. <code id=the-tbody-element:the-thead-element><a href=#the-thead-element>thead</a></code> elements, but only if there are no
  19838. <code id=the-tbody-element:the-tr-element><a href=#the-tr-element>tr</a></code> elements that are children of the
  19839. <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
  19840. 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
  19841. 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
  19842. <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
  19843. 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
  19844. 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
  19845. <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>
  19846. <pre class=idl>interface <dfn id=htmltablesectionelement>HTMLTableSectionElement</dfn> : <a href=#htmlelement id=the-tbody-element:htmlelement>HTMLElement</a> {
  19847. 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>;
  19848. <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);
  19849. void <a href=#dom-tbody-deleterow id=the-tbody-element:dom-tbody-deleterow>deleteRow</a>(long index);
  19850. // <a href="#HTMLTableSectionElement-partial">also has obsolete members</a>
  19851. };</pre>
  19852. <p>The <code id=the-tbody-element:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> interface is also
  19853. 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>
  19854. </dl>
  19855. <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
  19856. 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
  19857. parent and it is a <code id=the-tbody-element:the-table-element-4><a href=#the-table-element>table</a></code>.</p>
  19858. <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>
  19859. <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>
  19860. <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
  19861. section.</p>
  19862. <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>
  19863. <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
  19864. the argument, and returns the <code id=the-tbody-element:the-tr-element-6><a href=#the-tr-element>tr</a></code>.</p>
  19865. <p>The position is relative to the rows in the table section. The index −1, which is the
  19866. default if the argument is omitted, is equivalent to inserting at the end of the table
  19867. section.</p>
  19868. <p>If the given position is less than −1 or greater than the number of rows, throws an
  19869. <code id=the-tbody-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19870. <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>
  19871. <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>
  19872. <p>The position is relative to the rows in the table section. The index −1 is equivalent
  19873. to deleting the last row of the table section.</p>
  19874. <p>If the given position is less than −1 or greater than the index of the last row, or if
  19875. there are no rows, throws an <code id=the-tbody-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19876. </dl>
  19877. <p>The <dfn id=dom-tbody-rows><code>rows</code></dfn> attribute must return an
  19878. <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>
  19879. elements that are children of the element.</p>
  19880. <p>The <dfn id=dom-tbody-insertrow><code>insertRow(<var>index</var>)</code></dfn>
  19881. method must, when invoked on an element <var>table section</var>, act as follows:</p>
  19882. <p>If <var>index</var> is less than −1 or greater than the number of elements in
  19883. the <code id=the-tbody-element:dom-tbody-rows-3><a href=#dom-tbody-rows>rows</a></code> collection, the method must throw an
  19884. <code id=the-tbody-element:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19885. <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,
  19886. append it to the element <var>table section</var>, and return the newly created
  19887. <code id=the-tbody-element:the-tr-element-10><a href=#the-tr-element>tr</a></code> element.</p>
  19888. <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
  19889. <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
  19890. must return the newly created <code id=the-tbody-element:the-tr-element-13><a href=#the-tr-element>tr</a></code> element.</p>
  19891. <p>The <dfn id=dom-tbody-deleterow><code>deleteRow(<var>index</var>)</code></dfn>
  19892. 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
  19893. 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
  19894. <code id=the-tbody-element:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19895. <h4 id=the-thead-element>4.9.6 The <dfn><code>thead</code></dfn> element</h4>
  19896. <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
  19897. <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>
  19898. 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
  19899. <code id=the-thead-element:the-tr-element><a href=#the-tr-element>tr</a></code> elements, but only if there are no other
  19900. <code id=the-thead-element:the-thead-element><a href=#the-thead-element>thead</a></code> elements that are children of the
  19901. <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
  19902. 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
  19903. <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
  19904. <code id=the-thead-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> elements.</dl>
  19905. <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
  19906. 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>
  19907. 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>
  19908. <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>
  19909. <div class=example>
  19910. <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
  19911. <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
  19912. the headers, and the second row is an explanation of how to fill in the table.</p>
  19913. <pre>&lt;table>
  19914. &lt;caption> School auction sign-up sheet &lt;/caption>
  19915. <strong> &lt;thead>
  19916. &lt;tr>
  19917. &lt;th>&lt;label for=e1>Name&lt;/label>
  19918. &lt;th>&lt;label for=e2>Product&lt;/label>
  19919. &lt;th>&lt;label for=e3>Picture&lt;/label>
  19920. &lt;th>&lt;label for=e4>Price&lt;/label>
  19921. &lt;tr>
  19922. &lt;td>Your name here
  19923. &lt;td>What are you selling?
  19924. &lt;td>Link to a picture
  19925. &lt;td>Your reserve price
  19926. </strong> &lt;tbody>
  19927. &lt;tr>
  19928. &lt;td>Ms Danus
  19929. &lt;td>Doughnuts
  19930. &lt;td>&lt;img src="http://example.com/mydoughnuts.png" title="Doughnuts from Ms Danus">
  19931. &lt;td>$45
  19932. &lt;tr>
  19933. &lt;td>&lt;input id=e1 type=text name=who required form=f>
  19934. &lt;td>&lt;input id=e2 type=text name=what required form=f>
  19935. &lt;td>&lt;input id=e3 type=url name=pic form=f>
  19936. &lt;td>&lt;input id=e4 type=number step=0.01 min=0 value=0 required form=f>
  19937. &lt;/table>
  19938. &lt;form id=f action="/auction.cgi">
  19939. &lt;input type=button name=add value="Submit">
  19940. &lt;/form></pre>
  19941. </div>
  19942. <h4 id=the-tfoot-element>4.9.7 The <dfn><code>tfoot</code></dfn> element</h4>
  19943. <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
  19944. <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>
  19945. 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>
  19946. elements, but only if there are no other <code id=the-tfoot-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>
  19947. 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
  19948. <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>,
  19949. <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
  19950. 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
  19951. <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
  19952. 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
  19953. 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
  19954. <code id=the-tfoot-element:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code> elements.</dl>
  19955. <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
  19956. 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
  19957. <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>
  19958. <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
  19959. model</a>.</p>
  19960. <h4 id=the-tr-element>4.9.8 The <dfn><code>tr</code></dfn> element</h4>
  19961. <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
  19962. <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>
  19963. 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
  19964. 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
  19965. <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
  19966. 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>
  19967. <pre class=idl>interface <dfn id=htmltablerowelement>HTMLTableRowElement</dfn> : <a href=#htmlelement id=the-tr-element:htmlelement>HTMLElement</a> {
  19968. readonly attribute long <a href=#dom-tr-rowindex id=the-tr-element:dom-tr-rowindex>rowIndex</a>;
  19969. readonly attribute long <a href=#dom-tr-sectionrowindex id=the-tr-element:dom-tr-sectionrowindex>sectionRowIndex</a>;
  19970. 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>;
  19971. <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);
  19972. void <a href=#dom-tr-deletecell id=the-tr-element:dom-tr-deletecell>deleteCell</a>(long index);
  19973. // <a href="#HTMLTableRowElement-partial">also has obsolete members</a>
  19974. };</pre>
  19975. </dl>
  19976. <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
  19977. <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>
  19978. <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>
  19979. <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>
  19980. <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>
  19981. list.</p>
  19982. <p>Returns −1 if the element isn't in a table.</p>
  19983. <dt><var>tr</var> . <code id=the-tr-element:dom-tr-sectionrowindex-2><a href=#dom-tr-sectionrowindex>sectionRowIndex</a></code><dd>
  19984. <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>
  19985. <p>Returns −1 if the element isn't in a table section.</p>
  19986. <dt><var>tr</var> . <code id=the-tr-element:dom-tr-cells-2><a href=#dom-tr-cells>cells</a></code><dd>
  19987. <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
  19988. the row.</p>
  19989. <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>
  19990. <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
  19991. argument, and returns the <code id=the-tr-element:the-td-element-4><a href=#the-td-element>td</a></code>.</p>
  19992. <p>The position is relative to the cells in the row. The index −1, which is the default
  19993. if the argument is omitted, is equivalent to inserting at the end of the row.</p>
  19994. <p>If the given position is less than −1 or greater than the number of cells, throws an
  19995. <code id=the-tr-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  19996. <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>
  19997. <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
  19998. row.</p>
  19999. <p>The position is relative to the cells in the row. The index −1 is equivalent to
  20000. deleting the last cell of the row.</p>
  20001. <p>If the given position is less than −1 or greater than the index of the last cell, or
  20002. if there are no cells, throws an <code id=the-tr-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  20003. </dl>
  20004. <p>The <dfn id=dom-tr-rowindex><code>rowIndex</code></dfn> attribute must, if the element has
  20005. 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
  20006. <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
  20007. 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,
  20008. then the attribute must return −1.</p>
  20009. <p>The <dfn id=dom-tr-sectionrowindex><code>sectionRowIndex</code></dfn> attribute must, if
  20010. 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
  20011. <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
  20012. 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
  20013. <code id=the-tr-element:dom-tbody-rows-2><a href=#dom-tbody-rows>HTMLTableRowElement.rows</a></code> collection). If there is no such
  20014. parent element, then the attribute must return −1.</p>
  20015. <p>The <dfn id=dom-tr-cells><code>cells</code></dfn> attribute must return an
  20016. <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
  20017. <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>
  20018. <p>The <dfn id=dom-tr-insertcell><code>insertCell(<var>index</var>)</code></dfn>
  20019. method must act as follows:</p>
  20020. <p>If <var>index</var> is less than −1 or greater than the number of elements in
  20021. the <code id=the-tr-element:dom-tr-cells-3><a href=#dom-tr-cells>cells</a></code> collection, the method must throw an
  20022. <code id=the-tr-element:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  20023. <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,
  20024. 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>
  20025. element.</p>
  20026. <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
  20027. <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
  20028. <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
  20029. must return the newly created <code id=the-tr-element:the-td-element-11><a href=#the-td-element>td</a></code> element.</p>
  20030. <p>The <dfn id=dom-tr-deletecell><code>deleteCell(<var>index</var>)</code></dfn>
  20031. 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
  20032. 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
  20033. <code id=the-tr-element:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  20034. <h4 id=the-td-element>4.9.9 The <dfn><code>td</code></dfn> element</h4>
  20035. <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
  20036. <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,
  20037. 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>
  20038. <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement id=the-td-element:htmltablecellelement>HTMLTableCellElement</a> {
  20039. // <a href="#HTMLTableDataCellElement-partial">also has obsolete members</a>
  20040. };</pre>
  20041. </dl>
  20042. <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>
  20043. <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>
  20044. attributes take part in the <a href=#table-model id=the-td-element:table-model>table model</a>.</p>
  20045. <p>User agents, especially in non-visual environments or where displaying the table as a 2D grid
  20046. is impractical, may give the user context for the cell when rendering the contents of a cell; for
  20047. 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
  20048. (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
  20049. 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>
  20050. attributes on those header cells, if any, instead of the contents of the header cells
  20051. themselves.</p>
  20052. <h4 id=the-th-element>4.9.10 The <dfn><code>th</code></dfn> element</h4>
  20053. <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
  20054. <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,
  20055. 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>
  20056. <pre class=idl>interface <dfn id=htmltableheadercellelement>HTMLTableHeaderCellElement</dfn> : <a href=#htmltablecellelement id=the-th-element:htmltablecellelement>HTMLTableCellElement</a> {
  20057. attribute DOMString <a href=#dom-th-scope id=the-th-element:dom-th-scope>scope</a>;
  20058. attribute DOMString <a href=#dom-th-abbr id=the-th-element:dom-th-abbr>abbr</a>;
  20059. attribute DOMString <a href=#dom-th-sorted id=the-th-element:dom-th-sorted>sorted</a>;
  20060. void <a href=#dom-th-sort id=the-th-element:dom-th-sort>sort</a>();
  20061. };</pre>
  20062. </dl>
  20063. <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>
  20064. <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>
  20065. content attribute specified. The <code id=the-th-element:attr-th-scope-2><a href=#attr-th-scope>scope</a></code> attribute is an
  20066. <a href=#enumerated-attribute id=the-th-element:enumerated-attribute>enumerated attribute</a> with five states, four of which have explicit keywords:</p>
  20067. <dl><dt>The <dfn id=attr-th-scope-row><code>row</code></dfn> keyword, which maps to the
  20068. <i>row</i> state<dd>The <i>row</i> state means the header cell applies to some of the subsequent cells in the
  20069. same row(s).<dt>The <dfn id=attr-th-scope-col><code>col</code></dfn> keyword, which maps to the
  20070. <i>column</i> state<dd>The <i>column</i> state means the header cell applies to some of the subsequent cells in the
  20071. same column(s).<dt>The <dfn id=attr-th-scope-rowgroup><code>rowgroup</code></dfn> keyword, which maps to
  20072. 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
  20073. 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
  20074. 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
  20075. 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
  20076. 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
  20077. 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
  20078. 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
  20079. 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
  20080. context.</dl>
  20081. <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
  20082. <i>auto</i> state.</p>
  20083. <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>
  20084. content attribute specified. Its value must be an alternative label for the header cell, to be
  20085. used when referencing the cell in other contexts (e.g. when describing the header cells that apply
  20086. to a data cell). It is typically an abbreviated form of the full header cell, but can also be an
  20087. expansion, or merely a different phrasing.</p>
  20088. <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
  20089. sorting model</a>.</p>
  20090. <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
  20091. <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>
  20092. <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
  20093. model</a>.</p>
  20094. <p>The <dfn id=dom-th-scope><code>scope</code></dfn> IDL attribute must <a href=#reflect id=the-th-element:reflect>reflect</a>
  20095. 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>
  20096. <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
  20097. content attributes of the same name.</p>
  20098. <div class=example>
  20099. <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
  20100. applies to.</p>
  20101. <p>Here is a markup fragment showing a table:</p>
  20102. <pre>&lt;table>
  20103. &lt;thead>
  20104. &lt;tr> &lt;th> ID &lt;th> Measurement &lt;th> Average &lt;th> Maximum
  20105. &lt;tbody>
  20106. &lt;tr> &lt;td> &lt;th scope=rowgroup> Cats &lt;td> &lt;td>
  20107. &lt;tr> &lt;td> 93 &lt;th scope=row> Legs &lt;td> 3.5 &lt;td> 4
  20108. &lt;tr> &lt;td> 10 &lt;th scope=row> Tails &lt;td> 1 &lt;td> 1
  20109. &lt;tbody>
  20110. &lt;tr> &lt;td> &lt;th scope=rowgroup> English speakers &lt;td> &lt;td>
  20111. &lt;tr> &lt;td> 32 &lt;th scope=row> Legs &lt;td> 2.67 &lt;td> 4
  20112. &lt;tr> &lt;td> 35 &lt;th scope=row> Tails &lt;td> 0.33 &lt;td> 1
  20113. &lt;/table></pre>
  20114. <p>This would result in the following table:</p>
  20115. <table><thead><tr><th> ID <th> Measurement <th> Average <th> Maximum
  20116. <tbody><tr><td> <th scope=rowgroup> Cats <td> <td>
  20117. <tr><td> 93 <th scope=row> Legs <td> 3.5 <td> 4
  20118. <tr><td> 10 <th scope=row> Tails <td> 1 <td> 1
  20119. <tbody><tr><td> <th scope=rowgroup> English speakers <td> <td>
  20120. <tr><td> 32 <th scope=row> Legs <td> 2.67 <td> 4
  20121. <tr><td> 35 <th scope=row> Tails <td> 0.33 <td> 1
  20122. </table>
  20123. <p>The headers in the first row all apply directly down to the rows in their column.</p>
  20124. <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
  20125. the cells in their row group other than the cells in the first column.</p>
  20126. <p>The remaining headers apply just to the cells to the right of them.</p>
  20127. <img src=http://images.whatwg.org/table-scope-diagram.png width=459 alt="" height=256>
  20128. </div>
  20129. <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>
  20130. <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
  20131. 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>
  20132. <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
  20133. 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
  20134. cell is to span all the remaining rows in the row group.</p>
  20135. <p>These attributes give the number of columns and rows respectively that the cell is to span.
  20136. These attributes must not be used to overlap cells, as described in the
  20137. description of the <a href=#table-model id=attributes-common-to-td-and-th-elements:table-model>table model</a>.</p>
  20138. <hr>
  20139. <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
  20140. 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
  20141. <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>
  20142. <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
  20143. 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
  20144. 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
  20145. 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
  20146. <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
  20147. <i>targeted</i> by the element <var>B</var> and <var>A</var> is <i>directly
  20148. targeted</i> by <var>C</var>.</p>
  20149. <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>
  20150. <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>
  20151. attributes take part in the <a href=#table-model id=attributes-common-to-td-and-th-elements:table-model-3>table model</a>.</p>
  20152. <hr>
  20153. <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
  20154. <code id=attributes-common-to-td-and-th-elements:htmltablecellelement><a href=#htmltablecellelement>HTMLTableCellElement</a></code> interface:</p>
  20155. <pre class=idl>interface <dfn id=htmltablecellelement>HTMLTableCellElement</dfn> : <a href=#htmlelement id=attributes-common-to-td-and-th-elements:htmlelement>HTMLElement</a> {
  20156. attribute unsigned long <a href=#dom-tdth-colspan id=attributes-common-to-td-and-th-elements:dom-tdth-colspan>colSpan</a>;
  20157. attribute unsigned long <a href=#dom-tdth-rowspan id=attributes-common-to-td-and-th-elements:dom-tdth-rowspan>rowSpan</a>;
  20158. [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>;
  20159. readonly attribute long <a href=#dom-tdth-cellindex id=attributes-common-to-td-and-th-elements:dom-tdth-cellindex>cellIndex</a>;
  20160. // <a href="#HTMLTableCellElement-partial">also has obsolete members</a>
  20161. };</pre>
  20162. <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>
  20163. <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.
  20164. This does not necessarily correspond to the <var>x</var>-position of the cell in the
  20165. table, since earlier cells might cover multiple rows or columns.</p>
  20166. <p>Returns −1 if the element isn't in a row.</p>
  20167. </dl>
  20168. <p>The <dfn id=dom-tdth-colspan><code>colSpan</code></dfn> IDL attribute must
  20169. <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
  20170. default value is 1.</p>
  20171. <p>The <dfn id=dom-tdth-rowspan><code>rowSpan</code></dfn> IDL attribute must
  20172. <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
  20173. default value is 1.</p>
  20174. <p>The <dfn id=dom-tdth-headers><code>headers</code></dfn> IDL attribute must
  20175. <a href=#reflect id=attributes-common-to-td-and-th-elements:reflect-3>reflect</a> the content attribute of the same name.</p>
  20176. <p>The <dfn id=dom-tdth-cellindex><code>cellIndex</code></dfn> IDL attribute must, if the
  20177. 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
  20178. 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,
  20179. then the attribute must return −1.</p>
  20180. <h4 id=processing-model-3>4.9.12 Processing model</h4>
  20181. <p>The various table elements and their content attributes together define the <dfn id=table-model>table
  20182. model</dfn>.</p>
  20183. <p>A <dfn id=concept-table>table</dfn> consists of cells aligned on a two-dimensional grid of
  20184. <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
  20185. has one or more slots, then the <var>x</var> coordinates are always in the range <span>0 ≤ <var>x</var> &lt; <var>x<sub>width</sub></var></span>, and the <var>y</var> coordinates are always in the
  20186. range <span>0 ≤ <var>y</var> &lt; <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
  20187. 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>
  20188. <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
  20189. a particular <var>width</var> and <var>height</var> such that the cell covers
  20190. all the slots with coordinates (<var>x</var>, <var>y</var>) where <span><var>cell<sub>x</sub></var> ≤ <var>x</var> &lt; <var>cell<sub>x</sub></var>+<var>width</var></span> and <span><var>cell<sub>y</sub></var> ≤ <var>y</var> &lt; <var>cell<sub>y</sub></var>+<var>height</var></span>. Cells can either be <em>data cells</em>
  20191. 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
  20192. 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
  20193. header cells.</p>
  20194. <p>It is possible, in certain error cases, for two cells to occupy the same slot.</p>
  20195. <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
  20196. 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>
  20197. can have some implied <a href=#concept-row id=processing-model-3:concept-row>rows</a> at the end in some cases involving
  20198. <a href=#concept-cell id=processing-model-3:concept-cell>cells</a> spanning multiple rows.</p>
  20199. <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
  20200. 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
  20201. implied.</p>
  20202. <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
  20203. covers all the slots with coordinates (<var>x</var>, <var>y</var>) where <span>0 ≤ <var>x</var> &lt; <var>x<sub>width</sub></var></span> and <span><var>group<sub>y</sub></var> ≤ <var>y</var> &lt; <var>group<sub>y</sub></var>+<var>height</var></span>. Row groups correspond to
  20204. <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
  20205. necessarily in a row group.</p>
  20206. <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
  20207. covers all the slots with coordinates (<var>x</var>, <var>y</var>) where <span><var>group<sub>x</sub></var> ≤ <var>x</var> &lt; <var>group<sub>x</sub></var>+<var>width</var></span> and <span>0 ≤ <var>y</var> &lt; <var>y<sub>height</sub></var></span>. Column
  20208. 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
  20209. group.</p>
  20210. <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>
  20211. <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
  20212. <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
  20213. 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>
  20214. <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
  20215. 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
  20216. associated with them. This gives the table a heading, or legend.</p>
  20217. <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>
  20218. elements and their descendants. Documents must not have table model errors.</p>
  20219. <h5 id=forming-a-table>4.9.12.1 Forming a table</h5>
  20220. <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
  20221. 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>
  20222. <ol><li>
  20223. <p>Let <var>x<sub>width</sub></var> be zero.</p>
  20224. <li>
  20225. <p>Let <var>y<sub>height</sub></var> be zero.</p>
  20226. <li>
  20227. <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>
  20228. elements, initially empty.</p>
  20229. <li>
  20230. <p>Let <var>the table</var> be the <a href=#concept-table id=forming-a-table:concept-table-2>table</a> represented
  20231. 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
  20232. dimensions. <var>The table</var> is initially empty.</p>
  20233. <li>
  20234. <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
  20235. table</var> (which will be empty), and abort these steps.</p>
  20236. <li>
  20237. <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
  20238. <var>the table</var>. If there are no such children, then it has no associated
  20239. <code id=forming-a-table:the-caption-element-2><a href=#the-caption-element>caption</a></code> element.</p>
  20240. <li>
  20241. <p>Let the <var>current element</var> be the first element child of the
  20242. <code id=forming-a-table:the-table-element-5><a href=#the-table-element>table</a></code> element.</p>
  20243. <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
  20244. there is no such next child, then the user agent must jump to the step labeled <i>end</i>, near
  20245. the end of this algorithm.</p>
  20246. <li>
  20247. <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
  20248. child of the <code id=forming-a-table:the-table-element-6><a href=#the-table-element>table</a></code>:</p>
  20249. <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>
  20250. <li>
  20251. <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
  20252. substeps:</p>
  20253. <ol><li>
  20254. <p><i>Column groups</i>: Process the <var>current element</var> according to the
  20255. appropriate case below:</p>
  20256. <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>
  20257. <p>Follow these steps:</p>
  20258. <ol><li>
  20259. <p>Let <var>x<sub>start</sub></var> have the value of <span><var>x<sub>width</sub></var></span>.</p>
  20260. <li>
  20261. <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
  20262. of the <code id=forming-a-table:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element.</p>
  20263. <li>
  20264. <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
  20265. a <code id=forming-a-table:attr-col-span><a href=#attr-col-span>span</a></code> attribute, then parse its value using the
  20266. <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>
  20267. <p>If the result of parsing the value is not an error or zero, then let <var>span</var> be that value.</p>
  20268. <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
  20269. resulted in an error or zero, then let <var>span</var> be 1.</p>
  20270. <li>
  20271. <p>Increase <var>x<sub>width</sub></var> by <var>span</var>.</p>
  20272. <li>
  20273. <p>Let the last <var>span</var> <a href=#concept-column id=forming-a-table:concept-column>columns</a> in
  20274. <var>the table</var> correspond to the <var>current column</var>
  20275. <code id=forming-a-table:the-col-element-5><a href=#the-col-element>col</a></code> element.</p>
  20276. <li>
  20277. <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
  20278. 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
  20279. 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
  20280. the step labeled <i>columns</i>.</p>
  20281. <li>
  20282. <p>Let all the last <a href=#concept-column id=forming-a-table:concept-column-2>columns</a> in <var>the
  20283. table</var> from <span>x=<var>x<sub>start</sub></var></span> to
  20284. <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>
  20285. </ol>
  20286. <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>
  20287. <ol><li>
  20288. <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>
  20289. 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
  20290. integers</a>.</p>
  20291. <p>If the result of parsing the value is not an error or zero, then let <var>span</var> be that value.</p>
  20292. <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
  20293. value resulted in an error or zero, then let <var>span</var> be 1.</p>
  20294. <li>
  20295. <p>Increase <var>x<sub>width</sub></var> by <var>span</var>.</p>
  20296. <li>
  20297. <p>Let the last <var>span</var> <a href=#concept-column id=forming-a-table:concept-column-3>columns</a> in
  20298. <var>the table</var> form a new <a href=#concept-column-group id=forming-a-table:concept-column-group-2>column
  20299. 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>
  20300. </ol>
  20301. </dl>
  20302. <li>
  20303. <p><a href=#concept-table-advance id=forming-a-table:concept-table-advance-2>Advance</a> the <var>current element</var>
  20304. to the next child of the <code id=forming-a-table:the-table-element-7><a href=#the-table-element>table</a></code>.</p>
  20305. <li>
  20306. <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
  20307. next child of the <code id=forming-a-table:the-table-element-8><a href=#the-table-element>table</a></code>:</p>
  20308. <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>
  20309. <li>
  20310. <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
  20311. step labeled <i>column groups</i> above.</p>
  20312. </ol>
  20313. <li>
  20314. <p>Let <var>y<sub>current</sub></var> be zero.</p>
  20315. <li>
  20316. <p>Let the <var>list of downward-growing cells</var> be an empty list.</p>
  20317. <li>
  20318. <p><i>Rows</i>: While the <var>current element</var> is not one of the following
  20319. elements, <a href=#concept-table-advance id=forming-a-table:concept-table-advance-4>advance</a> the <var>current
  20320. 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>
  20321. <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>
  20322. <li>
  20323. <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
  20324. 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
  20325. step labeled <i>rows</i>.</p>
  20326. <li>
  20327. <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>
  20328. <li>
  20329. <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
  20330. 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
  20331. 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>
  20332. <li>
  20333. <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
  20334. <code id=forming-a-table:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>.</p>
  20335. <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>
  20336. <li>
  20337. <p><a href=#concept-table-advance id=forming-a-table:concept-table-advance-7>Advance</a> the <var>current element</var> to
  20338. the next child of the <code id=forming-a-table:the-table-element-12><a href=#the-table-element>table</a></code>.</p>
  20339. <li>
  20340. <p>Return to the step labeled <i>rows</i>.</p>
  20341. <li>
  20342. <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
  20343. <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
  20344. groups</a>.</p>
  20345. <li>
  20346. <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>
  20347. 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>
  20348. <li>
  20349. <p>Return <var>the table</var>.</p>
  20350. </ol>
  20351. <p>The <dfn id=algorithm-for-processing-row-groups>algorithm for processing row groups</dfn>, which is invoked by the set of steps above
  20352. 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>
  20353. <ol><li>
  20354. <p>Let <var>y<sub>start</sub></var> have the value of <var>y<sub>height</sub></var>.</p>
  20355. <li>
  20356. <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
  20357. order, run the <a href=#algorithm-for-processing-rows id=forming-a-table:algorithm-for-processing-rows-2>algorithm for processing rows</a>.</p>
  20358. <li>
  20359. <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
  20360. 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
  20361. to the element being processed.</p>
  20362. <li>
  20363. <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>
  20364. </ol>
  20365. <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
  20366. when starting and ending a block of rows, is:</p>
  20367. <ol><li>
  20368. <p>While <var>y<sub>current</sub></var> is less than <var>y<sub>height</sub></var>, follow these steps:</p>
  20369. <ol><li>
  20370. <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>
  20371. <li>
  20372. <p>Increase <var>y<sub>current</sub></var> by 1.</p>
  20373. </ol>
  20374. <li>
  20375. <p>Empty the <var>list of downward-growing cells</var>.</p>
  20376. </ol>
  20377. <p>The <dfn id=algorithm-for-processing-rows>algorithm for processing rows</dfn>, which is invoked by the set of steps above for
  20378. processing <code id=forming-a-table:the-tr-element-6><a href=#the-tr-element>tr</a></code> elements, is:</p>
  20379. <ol><li>
  20380. <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
  20381. 1. (<var>y<sub>current</sub></var> is never <em>greater</em> than <var>y<sub>height</sub></var>.)</p>
  20382. <li>
  20383. <p>Let <var>x<sub>current</sub></var> be 0.</p>
  20384. <li>
  20385. <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>
  20386. <li>
  20387. <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>
  20388. element children, then increase <var>y<sub>current</sub></var> by 1, abort
  20389. this set of steps, and return to the algorithm above.</p>
  20390. <li>
  20391. <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
  20392. in the <code id=forming-a-table:the-tr-element-8><a href=#the-tr-element>tr</a></code> element being processed.</p>
  20393. <li>
  20394. <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
  20395. cell assigned to it, increase <var>x<sub>current</sub></var> by 1.</p>
  20396. <li>
  20397. <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>
  20398. <li>
  20399. <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>
  20400. 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
  20401. value</a>, and let <var>colspan</var> be the result.</p>
  20402. <p>If parsing that value failed, or returned zero, or if the attribute is absent, then let <var>colspan</var> be 1, instead.</p>
  20403. <li>
  20404. <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>
  20405. 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
  20406. value</a>, and let <var>rowspan</var> be the result.</p>
  20407. <p>If parsing that value failed or if the attribute is absent, then let <var>rowspan</var> be 1, instead.</p>
  20408. <li>
  20409. <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
  20410. <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
  20411. downward</var> be true, and set <var>rowspan</var> to 1. Otherwise, let <var>cell grows downward</var> be false.</p>
  20412. <li>
  20413. <p>If <span><var>x<sub>width</sub></var> &lt; <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>
  20414. <li>
  20415. <p>If <span><var>y<sub>height</sub></var> &lt; <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>
  20416. <li>
  20417. <p>Let the slots with coordinates (<var>x</var>, <var>y</var>) such that <span><var>x<sub>current</sub></var> ≤ <var>x</var> &lt; <var>x<sub>current</sub></var>+<var>colspan</var></span> and <span><var>y<sub>current</sub></var> ≤ <var>y</var> &lt; <var>y<sub>current</sub></var>+<var>rowspan</var></span> be covered by a
  20418. 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>),
  20419. which has width <var>colspan</var> and height <var>rowspan</var>,
  20420. corresponding to the <var>current cell</var> element.</p>
  20421. <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
  20422. cell <var>c</var> be a header cell; otherwise, let it be a data cell.</p>
  20423. <p>To establish which header cells apply to the <var>current cell</var> element, use
  20424. 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>
  20425. <p>If any of the slots involved already had a <a href=#concept-cell id=forming-a-table:concept-cell-3>cell</a> covering
  20426. 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
  20427. overlapping.</p>
  20428. <li>
  20429. <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>}
  20430. to the <var>list of downward-growing cells</var>.</p>
  20431. <li>
  20432. <p>Increase <var>x<sub>current</sub></var> by <var>colspan</var>.</p>
  20433. <li>
  20434. <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
  20435. 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
  20436. above.</p>
  20437. <li>
  20438. <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
  20439. in the <code id=forming-a-table:the-tr-element-10><a href=#the-tr-element>tr</a></code> element being processed.</p>
  20440. <li>
  20441. <p>Return to the step labeled <i>cells</i>.</p>
  20442. </ol>
  20443. <p>When the algorithms above require the user agent to run the <dfn id=algorithm-for-growing-downward-growing-cells>algorithm for growing
  20444. 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
  20445. coordinates (<var>x</var>, <var>y<sub>current</sub></var>), where <span><var>cell<sub>x</sub></var> ≤ <var>x</var> &lt; <var>cell<sub>x</sub></var>+<var>width</var></span>.</p>
  20446. <h5 id=header-and-data-cell-semantics>4.9.12.2 Forming relationships between data cells and header cells</h5>
  20447. <p>Each cell can be assigned zero or more header cells. The <dfn id=algorithm-for-assigning-header-cells>algorithm for assigning header
  20448. cells</dfn> to a cell <var>principal cell</var> is as follows.</p>
  20449. <ol><li>
  20450. <p>Let <var>header list</var> be an empty list of cells.</p>
  20451. <li>
  20452. <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
  20453. cell</var> is anchored.</p>
  20454. <li>
  20455. <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>
  20456. <ol><li>
  20457. <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
  20458. obtained.</p>
  20459. <li>
  20460. <p>For each token in the <var>id list</var>, if the
  20461. 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
  20462. 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
  20463. <var>principal cell</var>, then add that cell to <var>header list</var>.</p>
  20464. </ol>
  20465. <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>
  20466. <ol><li>
  20467. <p>Let <var>principal<sub>width</sub></var> be the width of the <var>principal cell</var>.</p>
  20468. <li>
  20469. <p>Let <var>principal<sub>height</sub></var> be the height of the <var>principal cell</var>.</p>
  20470. <li>
  20471. <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
  20472. 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
  20473. (<var>principal<sub>x</sub></var>,<var>y</var>), and the
  20474. increments <span>Δ<var>x</var>=−1</span> and <span>Δ<var>y</var>=0</span>.</p>
  20475. <li>
  20476. <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
  20477. 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
  20478. (<var>x</var>,<var>principal<sub>y</sub></var>), and the
  20479. increments <span>Δ<var>x</var>=0</span> and <span>Δ<var>y</var>=−1</span>.</p>
  20480. <li>
  20481. <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
  20482. 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
  20483. equal to <span><var>principal<sub>y</sub></var>+<var>principal<sub>height</sub></var>-1</span> to <var>header
  20484. list</var>.</p>
  20485. <li>
  20486. <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
  20487. 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
  20488. equal to <span><var>principal<sub>y</sub></var>+<var>principal<sub>height</sub></var>-1</span> to <var>header
  20489. list</var>.</p>
  20490. </ol>
  20491. </dl>
  20492. <li>
  20493. <p>Remove all the <a href=#empty-cell id=header-and-data-cell-semantics:empty-cell>empty cells</a> from the <var>header
  20494. list</var>.</p>
  20495. <li>
  20496. <p>Remove any duplicates from the <var>header list</var>.</p>
  20497. <li>
  20498. <p>Remove <var>principal cell</var> from the <var>header list</var> if it is
  20499. there.</p>
  20500. <li>
  20501. <p>Assign the headers in the <var>header list</var> to the <var>principal
  20502. cell</var>.</p>
  20503. </ol>
  20504. <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>),
  20505. and Δ<var>x</var> and Δ<var>y</var> increments, is as follows:</p>
  20506. <ol><li>
  20507. <p>Let <var>x</var> equal <var>initial<sub>x</sub></var>.</p>
  20508. <li>
  20509. <p>Let <var>y</var> equal <var>initial<sub>y</sub></var>.</p>
  20510. <li>
  20511. <p>Let <var>opaque headers</var> be an empty list of cells.</p>
  20512. <li>
  20513. <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
  20514. current header block</var> be a list of cells containing just the <var>principal
  20515. cell</var>.<dt>Otherwise<dd><p>Let <var>in header block</var> be false and let <var>headers from
  20516. current header block</var> be an empty list of cells.</p>
  20517. </dl>
  20518. <li>
  20519. <p><i>Loop</i>: Increment <var>x</var> by Δ<var>x</var>; increment <var>y</var> by Δ<var>y</var>.</p>
  20520. <p class=note>For each invocation of this algorithm, one of Δ<var>x</var> and
  20521. Δ<var>y</var> will be −1, and the other will be 0.</p>
  20522. <li>
  20523. <p>If either <var>x</var> or <var>y</var> is less than 0, then abort this
  20524. internal algorithm.</p>
  20525. <li>
  20526. <p>If there is no cell covering slot (<var>x</var>, <var>y</var>), or if there
  20527. is more than one cell covering slot (<var>x</var>, <var>y</var>), return to
  20528. the substep labeled <i>loop</i>.</p>
  20529. <li>
  20530. <p>Let <var>current cell</var> be the cell covering slot (<var>x</var>, <var>y</var>).</p>
  20531. <li>
  20532. <dl class=switch><dt>If <var>current cell</var> is a header cell<dd>
  20533. <ol><li><p>Set <var>in header block</var> to true.<li><p>Add <var>current cell</var> to <var>headers from current header
  20534. block</var>.<li><p>Let <var>blocked</var> be false.<li>
  20535. <dl class=switch><dt>If Δ<var>x</var> is 0<dd>
  20536. <p>If there are any cells in the <var>opaque headers</var> list anchored with the
  20537. same <var>x</var>-coordinate as the <var>current cell</var>, and with
  20538. the same width as <var>current cell</var>, then let <var>blocked</var>
  20539. be true.</p>
  20540. <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
  20541. <var>blocked</var> be true.</p>
  20542. <dt>If Δ<var>y</var> is 0<dd>
  20543. <p>If there are any cells in the <var>opaque headers</var> list anchored with the
  20544. same <var>y</var>-coordinate as the <var>current cell</var>, and with
  20545. the same height as <var>current cell</var>, then let <var>blocked</var>
  20546. be true.</p>
  20547. <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>
  20548. </dl>
  20549. <li><p>If <var>blocked</var> is false, then add the <var>current cell</var>
  20550. to the <var>headers list</var>.</ol>
  20551. <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>
  20552. list, and empty the <var>headers from current header block</var> list.</p>
  20553. </dl>
  20554. <li>
  20555. <p>Return to the step labeled <i>loop</i>.</p>
  20556. </ol>
  20557. <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
  20558. said to be a <dfn id=column-header>column header</dfn> if any of the following conditions are true:</p>
  20559. <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
  20560. covering slots with <var>y</var>-coordinates <var>y</var> .. <span><var>y</var>+<var>height</var>-1</span>.</ul>
  20561. <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
  20562. said to be a <dfn id=row-header>row header</dfn> if any of the following conditions are true:</p>
  20563. <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
  20564. there are no data cells in any of the cells covering slots with <var>x</var>-coordinates
  20565. <var>x</var> .. <span><var>x</var>+<var>width</var>-1</span>.</ul>
  20566. <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
  20567. group</a> state.</p>
  20568. <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
  20569. group</a> state.</p>
  20570. <p>A cell is said to be an <dfn id=empty-cell>empty cell</dfn> if it contains no elements and its text content,
  20571. if any, consists only of <a href=#white_space id=header-and-data-cell-semantics:white_space>White_Space</a> characters.</p>
  20572. <h4 id=table-sorting-model>4.9.13 <dfn>Table sorting model</dfn></h4>
  20573. <p>The <dfn id=attr-table-sortable><code>sortable</code></dfn> attribute on
  20574. <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
  20575. 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>
  20576. <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
  20577. 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
  20578. 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>
  20579. <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
  20580. 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
  20581. 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
  20582. <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>
  20583. <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>
  20584. element's <dfn id=attr-th-sorted><code>sorted</code></dfn> attribute. This attribute can also
  20585. be set manually, to indicate that the table should be automatically sorted, even when scripts
  20586. modify the page on when the page is loaded.</p>
  20587. <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
  20588. 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
  20589. <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
  20590. 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>
  20591. <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
  20592. "<code>1 reversed</code>", where "1" is any number equal to or greater than 1.</p>
  20593. <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
  20594. sorted. The value of the attribute controls how the column is used in determining the sort order.
  20595. 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
  20596. direction</dfn> is <i>reversed</i>, rather than <i>normal</i>, which is the default if the keyword
  20597. is omitted. The number, if present, indicates the <dfn id=column-key-ordinality>column key ordinality</dfn>; if the number
  20598. is omitted, the column is the primary key, as if the value 1 had been specified.</p>
  20599. <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>
  20600. <hr>
  20601. <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
  20602. all the following conditions simultaneously:</p>
  20603. <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.
  20604. (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
  20605. <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>
  20606. <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
  20607. 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>
  20608. 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
  20609. 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>
  20610. <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
  20611. 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>
  20612. of the <a href=#concept-table id=table-sorting-model:concept-table-3>table</a>.</p>
  20613. </ul>
  20614. <p class=note>In other words, each <a href=#concept-column id=table-sorting-model:concept-column-2>column</a> can have one
  20615. <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
  20616. 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
  20617. <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
  20618. columns.</p>
  20619. <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
  20620. <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>
  20621. <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
  20622. <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>
  20623. elements of the <code>table</code> element</a> <var>table</var>.</p>
  20624. <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
  20625. <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>
  20626. <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
  20627. <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>
  20628. <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
  20629. <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>
  20630. elements of the <code>table</code> element</a> <var>table</var>, and at least one of
  20631. 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>
  20632. <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
  20633. 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
  20634. a <code id=table-sorting-model:attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> attribute specified.</p>
  20635. <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
  20636. <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
  20637. sorting interface</a>.</p>
  20638. <hr>
  20639. <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
  20640. be false.</p>
  20641. <hr>
  20642. <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
  20643. <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
  20644. <code>th</code> elements</a>. The <code id=table-sorting-model:attr-table-sortable-2><a href=#attr-table-sortable>sortable</a></code> attribute
  20645. 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>
  20646. <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
  20647. <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
  20648. the following algorithm:</p>
  20649. <ol><li><p>Let <var>direction</var> be <i>normal</i>.</p>
  20650. <li><p>Let <var>have explicit direction</var> be false.</p>
  20651. <li><p>Let <var>ordinality</var> be 1.</p>
  20652. <li><p>Let <var>have explicit ordinality</var> be false.</p>
  20653. <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>
  20654. <p>For each token <var>token</var> in <var>tokens</var>, run the appropriate
  20655. steps from the following list:</p>
  20656. <dl class=switch><dt>If <var>have explicit direction</var> is false and <var>token</var> is an
  20657. <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>
  20658. <p>Let <var>direction</var> be <i>reversed</i> and <var>have explicit
  20659. direction</var> be true.</p>
  20660. <dt>If <var>have explicit ordinality</var> is false<dd>
  20661. <p><a href=#rules-for-parsing-integers id=table-sorting-model:rules-for-parsing-integers>Parse <var>token</var> as an
  20662. integer</a>. If this resulted in an error or the value zero, then ignore the token.
  20663. Otherwise, set <var>ordinality</var> to the parsed value, and set <var>have
  20664. explicit ordinality</var> to true.</p>
  20665. <dt>Otherwise<dd><p>Ignore the token.</dl>
  20666. <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
  20667. 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>
  20668. <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
  20669. ordinality</a>.</p>
  20670. <hr>
  20671. <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
  20672. follows:</p>
  20673. <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
  20674. 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
  20675. cancelable at <var>table</var>.<li><p>If the event fired in the previous step was canceled, then jump to the step labeled
  20676. <i>end</i> below.<li>
  20677. <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>
  20678. element</a>, then jump to the step labeled <i>end</i> below.</p>
  20679. <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>
  20680. element</a> when the algorithm was invoked, the DOM might have been entirely changed by the
  20681. 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
  20682. this stage, not earlier.</p>
  20683. <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>
  20684. 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
  20685. ordinality</a> of their <code id=table-sorting-model:attr-th-sorted-9><a href=#attr-th-sorted>sorted</a></code> attributes, with those
  20686. 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>
  20687. <li>
  20688. <p>Let <var>row collection cursor</var> be a pointer to an element, initially pointing
  20689. at the first child of <var>table</var> that is after <var>table</var>'s first
  20690. <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>
  20691. element, assuming there is one. If there is no such child, then jump to the step labeled
  20692. <i>end</i> below.</p>
  20693. <li><p>If <var>table</var> has no <a href=#concept-row-group id=table-sorting-model:concept-row-group-4>row group</a>
  20694. 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
  20695. 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>
  20696. elements.<li>
  20697. <p>Run the appropriate steps from the following list:</p>
  20698. <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
  20699. <dd>
  20700. <ol><li><p><i>Collect</i>: Append the element pointed to by <var>row collection
  20701. 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
  20702. 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
  20703. 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
  20704. 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>
  20705. <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
  20706. <dd>
  20707. <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
  20708. order</a>.<li><p>If <var>rows</var> is empty, jump to the step labeled <i>increment loop</i>
  20709. below.</ol>
  20710. </dl>
  20711. <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>
  20712. 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
  20713. 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
  20714. 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
  20715. cursor</var>, then let <var>tallest height</var> be the number of rows covered by the
  20716. 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
  20717. group</var> then set <var>pending rows in group</var> to <var>tallest
  20718. 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
  20719. 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>
  20720. 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
  20721. 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
  20722. 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
  20723. 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
  20724. groups</i>).<li><p>Let <var>insertion point</var> be a placeholder in a DOM tree, which can be used
  20725. to reinsert nodes at a specific point in the DOM. Insert <var>insertion point</var> into
  20726. 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>,
  20727. immediately before that <code id=table-sorting-model:the-tr-element-17><a href=#the-tr-element>tr</a></code> element.<li>
  20728. <p>Sort the groups in <var>groups</var>, using the following algorithm to decide the
  20729. relative order of any two groups <var>a</var> and <var>b</var> (the algorithm
  20730. either returns that <var>a</var> comes before <var>b</var>, or that <var>b</var> comes before <var>a</var>):</p>
  20731. <ol><li><p>Let <var>key index</var> be an index into <var>key heading
  20732. 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
  20733. other possible value is <i>descending</i>. When <var>direction</var> is
  20734. <i>toggled</i>, that means that if its value is <i>ascending</i>, it must be changed to
  20735. <i>descending</i>, and when its value is <i>descending</i>, it must be changed to
  20736. <i>ascending</i>.<li><p><i>Column loop</i>: Let <var>th</var> be the <var>key index</var>th
  20737. <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
  20738. <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
  20739. using the <code>th</code> element</a> <var>th</var>, with <var>a</var> and
  20740. <var>b</var> as the rows.<li><p>If <var>tentative order</var> is not "equal", then jump to the step labeled
  20741. <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
  20742. 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
  20743. <a href=#tree-order id=table-sorting-model:tree-order-3>tree order</a>, then let <var>tentative order</var> be "a before b".
  20744. 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
  20745. list:</p>
  20746. <dl class=switch><dt>If <var>direction</var> is <i>ascending</i> and <var>tentative
  20747. 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
  20748. 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
  20749. 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
  20750. order</var> is "b before a"<dd>Return that <var>a</var> comes before <var>b</var>.</dl>
  20751. </ol>
  20752. <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>,
  20753. with <var>a</var> and <var>b</var> being the two row groups respectively, the
  20754. user agent must run the following steps:</p>
  20755. <ol><li><p>Let <var>x</var> be the <var>x</var>-coordinate of the slots that
  20756. <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>
  20757. <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
  20758. <var>a</var> that covers the slot in that <a href=#concept-row id=table-sorting-model:concept-row-5>row</a> whose
  20759. <var>x</var>-coordinate is <var>x</var>.</p>
  20760. <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
  20761. <var>b</var> that covers the slot in that <a href=#concept-row id=table-sorting-model:concept-row-7>row</a> whose
  20762. <var>x</var>-coordinate is <var>x</var>.</p>
  20763. <p>In either case, if there's no <a href=#concept-cell id=table-sorting-model:concept-cell-15>cell</a> that actually covers
  20764. the slot, then use the value <i>null</i> instead.</p>
  20765. <li>
  20766. <p>Let <var>type<sub>a</sub></var> and <var>value<sub>a</sub></var> be
  20767. 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
  20768. below.</p>
  20769. <p>Let <var>type<sub>b</sub></var> and <var>value<sub>b</sub></var> be
  20770. 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
  20771. below.</p>
  20772. <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>
  20773. <ol><li><p>If <var>cell</var> is <i>null</i>, then the type is "string" and the value is
  20774. 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
  20775. <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
  20776. 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
  20777. <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
  20778. one, or the empty string otherwise; the type is "string".</p>
  20779. <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
  20780. <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
  20781. 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
  20782. <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
  20783. there is one, or the empty string otherwise; the type is "string".</p>
  20784. <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
  20785. <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
  20786. 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
  20787. <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
  20788. one, or the empty string otherwise; the type is "string".</p>
  20789. <li>
  20790. <p>If, ignoring <a href=#inter-element-whitespace id=table-sorting-model:inter-element-whitespace-4>inter-element whitespace</a> and nodes other than
  20791. <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
  20792. 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
  20793. <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
  20794. the kind of value that is thus obtained
  20795. (a <a href=#concept-month id=table-sorting-model:concept-month>month</a>,
  20796. a <a href=#concept-date id=table-sorting-model:concept-date>date</a>,
  20797. a <a href=#concept-yearless-date id=table-sorting-model:concept-yearless-date>yearless date</a>,
  20798. a <a href=#concept-time id=table-sorting-model:concept-time>time</a>,
  20799. a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local>local date and time</a>,
  20800. a <a href=#concept-timezone id=table-sorting-model:concept-timezone>time-zone offset</a>,
  20801. a <a href=#concept-datetime id=table-sorting-model:concept-datetime>global date and time</a>,
  20802. a <a href=#concept-week id=table-sorting-model:concept-week>week</a>,
  20803. a year, or
  20804. a <a href=#concept-duration id=table-sorting-model:concept-duration>duration</a>);
  20805. abort these steps after completing this one.</p>
  20806. <p>If there is no machine-readable equivalent, then the type is "string" and the value is
  20807. the empty string.</p>
  20808. <p>If the type is
  20809. a <a href=#concept-month id=table-sorting-model:concept-month-2>month</a>,
  20810. a <a href=#concept-date id=table-sorting-model:concept-date-2>date</a>,
  20811. a <a href=#concept-week id=table-sorting-model:concept-week-2>week</a>, or
  20812. a year,
  20813. then change the value to be the instant in time (with no time zone) that describes the
  20814. earliest moment that the value represents, and change the type to be
  20815. a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-2>local date and time</a>.</p>
  20816. <p class=example>For example, if the cell was <code>&lt;td>&lt;time>2011-11&lt;/time></code> then for sorting purposes the value is
  20817. 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>
  20818. <p class=example>Similarly, if the cell was <code>&lt;td>&lt;time
  20819. datetime="2014">MMXIV&lt;/time></code> then for sorting purposes the value is interpreted as
  20820. "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>
  20821. <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>
  20822. <li>
  20823. <p>If <var>type<sub>a</sub></var> and <var>type<sub>b</sub></var> are not
  20824. equal, then: return "a before b" if <var>type<sub>a</sub></var> is earlier in the
  20825. following list than <var>type<sub>b</sub></var>, otherwise, return "b before a";
  20826. then, abort these steps.</p>
  20827. <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>
  20828. <li><p>If <var>value<sub>a</sub></var> and <var>value<sub>b</sub></var> are
  20829. equal, then return "equal" and abort these steps.<li>
  20830. <p>If <var>type<sub>a</sub></var> and <var>type<sub>b</sub></var> are not
  20831. "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,
  20832. return "b before a" and abort these steps.</p>
  20833. <p>Values sort in their natural order, with the following additional constraints:</p>
  20834. <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
  20835. 23:59:59.999 is the latest value.</p>
  20836. <p>For <a href=#concept-yearless-date id=table-sorting-model:concept-yearless-date-3>yearless date</a> values, 01-01 is the earliest
  20837. value and 12-31 is the latest value; 02-28 is earlier than 02-29 which is earlier than
  20838. 03-01.</p>
  20839. <p>Values that are <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-6>local date and time</a> compare as
  20840. if they were in the same time zone.</p>
  20841. <p>For <a href=#concept-timezone id=table-sorting-model:concept-timezone-3>time-zone offset</a> values, -23:59 is the earliest
  20842. value and +23:59 is the latest value.</p>
  20843. <li>
  20844. <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
  20845. key</a> <var>value<sub>a</sub></var>.</p>
  20846. <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
  20847. key</a> <var>value<sub>b</sub></var>.</p>
  20848. <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>
  20849. <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
  20850. strings</i>, for any non-negative integer value of <var>n</var> (zero or more).</p>
  20851. <li>
  20852. <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
  20853. comparison</a> of <var>components<sub>a</sub></var>'s first <i>non-numeric
  20854. string</i> and <var>components<sub>b</sub></var>'s first <i>non-numeric string</i>,
  20855. in the context of <var>th</var>.</p>
  20856. <p>If <var>order</var> is not "equal" then return <var>order</var> and abort
  20857. these steps.</p>
  20858. <li>
  20859. <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
  20860. substeps:</p>
  20861. <ol><li>
  20862. <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>
  20863. <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>
  20864. <li>
  20865. <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
  20866. comparison</a> of <var>components<sub>a</sub></var>'s second <i>non-numeric
  20867. string</i> and <var>components<sub>b</sub></var>'s second <i>non-numeric
  20868. string</i>, in the context of <var>th</var>.</p>
  20869. <p>If <var>order</var> is not "equal" then return <var>order</var> and
  20870. abort these steps.</p>
  20871. <li>
  20872. <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
  20873. comparison</a> of <var>components<sub>a</sub></var>'s <i>number string</i> and
  20874. <var>components<sub>b</sub></var>'s <i>number string</i>, in the context of <var>th</var>.</p>
  20875. <p>If <var>order</var> is not "equal" then return <var>order</var> and
  20876. abort these steps.</p>
  20877. </ol>
  20878. <p>Otherwise, run these substeps:</p>
  20879. <ol><li>
  20880. <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
  20881. b".</p>
  20882. <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
  20883. a".</p>
  20884. <li>
  20885. <p>If <var>components<sub>a</sub></var> has one <i>number</i>, return "a before
  20886. b".</p>
  20887. <p>If <var>components<sub>b</sub></var> has one <i>number</i>, return "b before
  20888. a".</p>
  20889. <li>
  20890. <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>
  20891. <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
  20892. 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
  20893. these steps; otherwise, if <var>components<sub>b</sub></var>'s <i>number</i> is
  20894. less than <var>components<sub>a</sub></var>'s <i>number</i>, return "b before a"
  20895. and abort these steps.<li>
  20896. <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>
  20897. <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>
  20898. <li><p>Let <var>index</var> be zero.<li>
  20899. <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
  20900. 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>,
  20901. in the context of <var>th</var>.</p>
  20902. <p>If <var>order</var> is not "equal" then return <var>order</var> and
  20903. abort these steps.</p>
  20904. <li>
  20905. <p>Increment <var>index</var>.</p>
  20906. <li>
  20907. <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
  20908. 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
  20909. string</i>, in the context of <var>th</var>.</p>
  20910. <p>If <var>order</var> is not "equal" then return <var>order</var> and
  20911. abort these steps.</p>
  20912. <li>
  20913. <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
  20914. to the step labeled <i>string loop</i>.</p>
  20915. </ol>
  20916. </ol>
  20917. <li>
  20918. <p>Let <var>index</var> be zero.</p>
  20919. <li>
  20920. <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
  20921. comparison</a> of <var>components<sub>a</sub></var>'s <var>n</var>th
  20922. <i>raw string</i> and <var>components<sub>b</sub></var>'s <var>n</var>th
  20923. <i>raw string</i>.</p>
  20924. <p>If <var>order</var> is not "equal" then return <var>order</var> and abort
  20925. these steps.</p>
  20926. <li>
  20927. <p>Increment <var>index</var>.</p>
  20928. <li>
  20929. <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
  20930. to the step labeled <i>final loop</i>.</p>
  20931. <li>
  20932. <p>Return "equal".</p>
  20933. </ol>
  20934. <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
  20935. <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
  20936. 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
  20937. <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
  20938. 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
  20939. 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
  20940. <var>table</var> that are later siblings of the element pointed to by <var>row
  20941. 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
  20942. <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
  20943. 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
  20944. false.</ol>
  20945. <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
  20946. of <var>n</var> <i>numbers</i>, a list of <var>n</var> <i>number strings</i>, a
  20947. list of <var>n</var>+1 <i>non-numeric strings</i>, and a list of 2<var>n</var>+1
  20948. <i>raw strings</i>, respectively, for any non-negative integer value of <var>n</var> (zero or
  20949. more).</p>
  20950. <ol><li>
  20951. <p>Let <var>raw strings</var> be a list of strings initially containing just one entry, an empty string.</p>
  20952. <li>
  20953. <p>Let <var>negatives prejudiced</var> be false.</p>
  20954. <p>Let <var>decimals prejudiced</var> be false.</p>
  20955. <p>Let <var>exponents prejudiced</var> be false.</p>
  20956. <li>
  20957. <p>Let <var>buffer</var> be the empty string.</p>
  20958. <p>Let <var>index</var> be zero.</p>
  20959. <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>
  20960. <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>
  20961. <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>
  20962. <li>
  20963. <p>Let <var>checkpoint buffer</var> be the empty string.</p>
  20964. <p>Let <var>checkpoint index</var> be zero.</p>
  20965. <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>
  20966. <ol><li><p>Set the <var>checkpoint buffer</var> to the value of <var>buffer</var>.</p>
  20967. <li><p>Set the <var>checkpoint index</var> to the value of <var>index</var>.</p>
  20968. </ol>
  20969. <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>
  20970. <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>
  20971. <li>
  20972. <p>Run through the following steps repeatedly until the condition in the last step is met.</p>
  20973. <ol><li>
  20974. <p><i>Top of loop</i>: If <var>index</var> is equal to or greater than the number of
  20975. 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>
  20976. <li>
  20977. <p>Run the appropriate steps from the following list:</p>
  20978. <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>
  20979. <p>Run the appropriate substeps from the following list:</p>
  20980. <dl class=switch><dt>If <var>c</var> is a <a href=#space-character id=table-sorting-model:space-character>space character</a><dd>
  20981. <p>Set <var>negatives prejudiced</var> to false.</p>
  20982. <p>Set <var>decimals prejudiced</var> to false.</p>
  20983. <p>Set <var>exponents prejudiced</var> to false.</p>
  20984. <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
  20985. <dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-) and <var>negatives prejudiced</var> is false<dd>
  20986. <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
  20987. <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>
  20988. <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
  20989. <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
  20990. <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>
  20991. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits>ASCII digit</a><dd>
  20992. <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
  20993. <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>
  20994. <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>
  20995. <p>Set <var>exponents prejudiced</var> to true.</p>
  20996. <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
  20997. <dt>If <var>c</var> is EOF<dd>
  20998. <p>Do nothing.</p>
  20999. <dt>Otherwise<dd>
  21000. <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
  21001. </dl>
  21002. <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>
  21003. <p>Run the appropriate substeps from the following list:</p>
  21004. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21005. <p>Set <var>negatives prejudiced</var> to true.</p>
  21006. <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
  21007. <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
  21008. <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>
  21009. <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
  21010. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21011. <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>
  21012. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-2>ASCII digit</a><dd>
  21013. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21014. <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>
  21015. <dt>Otherwise<dd>
  21016. <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
  21017. <p>Decrement <var>index</var> by one.</p>
  21018. <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>
  21019. </dl>
  21020. <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>
  21021. <p>Run the appropriate substeps from the following list:</p>
  21022. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21023. <p>Set <var>negatives prejudiced</var> to true.</p>
  21024. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer>Push the buffer</a>.</p>
  21025. <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
  21026. <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint>Checkpoint</a>.</p>
  21027. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21028. <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>
  21029. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-3>ASCII digit</a><dd>
  21030. <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
  21031. <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>
  21032. <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint-2>Checkpoint</a>.</p>
  21033. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21034. <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>
  21035. <dt>Otherwise<dd>
  21036. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-2>Push the buffer</a>.</p>
  21037. </dl>
  21038. <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>
  21039. <p>Run the appropriate substeps from the following list:</p>
  21040. <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>
  21041. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21042. <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>
  21043. <dt>Otherwise<dd>
  21044. <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
  21045. <p>Decrement <var>index</var> by one.</p>
  21046. <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>
  21047. </dl>
  21048. <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>
  21049. <p>Run the appropriate substeps from the following list:</p>
  21050. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21051. <p>Set <var>negatives prejudiced</var> to true.</p>
  21052. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-3>Push the buffer</a>.</p>
  21053. <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>
  21054. <p>Set <var>decimals prejudiced</var> to true.</p>
  21055. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint>Push the checkpoint</a>.</p>
  21056. <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>
  21057. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-4>Push the buffer</a>.</p>
  21058. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-7>ASCII digit</a><dd>
  21059. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21060. <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>
  21061. <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint-3>Checkpoint</a>.</p>
  21062. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21063. <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>
  21064. <dt>Otherwise<dd>
  21065. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-5>Push the buffer</a>.</p>
  21066. </dl>
  21067. <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>
  21068. <p>Run the appropriate substeps from the following list:</p>
  21069. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-) and <var>negatives prejudiced</var> is false<dd>
  21070. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21071. <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>
  21072. <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
  21073. <p>Set <var>decimals prejudiced</var> to true.</p>
  21074. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-2>Push the checkpoint</a>.</p>
  21075. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-8>ASCII digit</a><dd>
  21076. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21077. <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>
  21078. <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
  21079. <p>Set <var>exponents prejudiced</var> to true.</p>
  21080. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-3>Push the checkpoint</a>.</p>
  21081. <dt>Otherwise<dd>
  21082. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-4>Push the checkpoint</a>.</p>
  21083. </dl>
  21084. <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>
  21085. <p>Run the appropriate substeps from the following list:</p>
  21086. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21087. <p>Set <var>negatives prejudiced</var> to true.</p>
  21088. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-5>Push the checkpoint</a>.</p>
  21089. <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
  21090. <p>Set <var>decimals prejudiced</var> to true.</p>
  21091. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-6>Push the checkpoint</a>.</p>
  21092. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-9>ASCII digit</a><dd>
  21093. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21094. <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>
  21095. <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
  21096. <p>Set <var>exponents prejudiced</var> to true.</p>
  21097. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-7>Push the checkpoint</a>.</p>
  21098. <dt>Otherwise<dd>
  21099. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-8>Push the checkpoint</a>.</p>
  21100. </dl>
  21101. <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>
  21102. <p>Run the appropriate substeps from the following list:</p>
  21103. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21104. <p>Set <var>negatives prejudiced</var> to true.</p>
  21105. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-6>Push the buffer</a>.</p>
  21106. <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
  21107. <p>Set <var>decimals prejudiced</var> to true.</p>
  21108. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-9>Push the checkpoint</a>.</p>
  21109. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-10>ASCII digit</a><dd>
  21110. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21111. <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
  21112. <p>Set <var>exponents prejudiced</var> to true.</p>
  21113. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-10>Push the checkpoint</a>.</p>
  21114. <dt>Otherwise<dd>
  21115. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-7>Push the buffer</a>.</p>
  21116. </dl>
  21117. <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>
  21118. <p>Run the appropriate substeps from the following list:</p>
  21119. <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
  21120. <p>Set <var>negatives prejudiced</var> to true.</p>
  21121. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-11>Push the checkpoint</a>.</p>
  21122. <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
  21123. <p>Set <var>decimals prejudiced</var> to true.</p>
  21124. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-12>Push the checkpoint</a>.</p>
  21125. <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-11>ASCII digit</a><dd>
  21126. <p>Append <var>c</var> to <var>buffer</var>.</p>
  21127. <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
  21128. <p>Set <var>exponents prejudiced</var> to true.</p>
  21129. <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-13>Push the checkpoint</a>.</p>
  21130. <dt>Otherwise<dd>
  21131. <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-8>Push the buffer</a>.</p>
  21132. </dl>
  21133. </dl>
  21134. <li>
  21135. <p>Increment <var>index</var> by one.</p>
  21136. <li>
  21137. <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.
  21138. Otherwise, return to the step labeled <i>top of loop</i>.</p>
  21139. </ol>
  21140. <li>
  21141. <p>Let <var>numbers</var> be an empty list.</p>
  21142. <p>Let <var>number strings</var> be an empty list.</p>
  21143. <p>Let <var>non-numeric strings</var> be an empty list.</p>
  21144. <li>
  21145. <p>For each even-numbered entry in <var>raw strings</var>, in order, starting from the
  21146. first entry (numbered 0), append an entry to <var>non-numeric strings</var> that
  21147. 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>
  21148. <li>
  21149. <p>If <var>raw strings</var> has more than one entry, then, for each odd-numbered entry
  21150. in <var>raw strings</var>, in order, starting from the second entry (numbered 1),
  21151. append an entry to <var>number strings</var> that consists of the value of the entry,
  21152. and append an entry to <var>number strings</var> that consists of the result of parsing
  21153. 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
  21154. values</a>.</p>
  21155. <li>
  21156. <p>Return <var>numbers</var>, <var>number strings</var>, <var>non-numeric strings</var>, and <var>raw strings</var> respectively.</p>
  21157. </ol>
  21158. <p>When the user agent is required by the step above to perform a <dfn id=locale-specific-string-comparison>locale-specific string
  21159. comparison</dfn> of two strings <var>a</var> and <var>b</var> in the context of
  21160. an element <var>e</var>, the user agent must apply the Unicode Collation Algorithm, using
  21161. the Default Unicode Collation Element Table as customised for the <a href=#language id=table-sorting-model:language>language</a> of the
  21162. 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
  21163. <var>a</var> first, then return "a before b"; if it places <var>b</var> first,
  21164. 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>
  21165. <p>When the user agent is required by the step above to perform a <dfn id=raw-string-comparison>raw string comparison</dfn>
  21166. of two strings <var>a</var> and <var>b</var>, the user agent must apply the
  21167. Unicode Collation Algorithm, using the Default Unicode Collation Element Table without
  21168. customizations, to the strings <var>a</var> and <var>b</var>. If the result of
  21169. 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
  21170. "equal". <a href=#refsUCA>[UCA]</a></p>
  21171. <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>
  21172. <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>
  21173. in <var>value</var> with a single U+0020 SPACE character.</ol>
  21174. <hr>
  21175. <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
  21176. 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
  21177. <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
  21178. 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
  21179. 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
  21180. 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
  21181. <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>
  21182. <hr>
  21183. <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>
  21184. <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
  21185. <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
  21186. <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
  21187. string "<code>reversed</code>", otherwise, set it to the empty string; then, abort these
  21188. 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>
  21189. 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
  21190. 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
  21191. <a href=#tree-order id=table-sorting-model:tree-order-6>tree order</a>.<li><p>Let <var>level</var> be 2.<li>
  21192. <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
  21193. headers</var>, in order, run the following substeps:</p>
  21194. <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
  21195. <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
  21196. <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
  21197. value is <var>level</var>.</p>
  21198. <li><p>Increment <var>level</var> by 1.</ol>
  21199. <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
  21200. the empty string.</ol>
  21201. <hr>
  21202. <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>
  21203. 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>
  21204. <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>
  21205. <dl class=domintro><dt><var>th</var> . <code id=table-sorting-model:dom-th-sort><a href=#dom-th-sort>sort</a></code>()<dd>
  21206. <p>Act as if the user had indicated that this was to be the new primary sort column.</p>
  21207. <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>
  21208. <dt><var>table</var> . <code id=table-sorting-model:dom-table-stopsorting><a href=#dom-table-stopsorting>stopSorting</a></code>()<dd>
  21209. <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
  21210. table to automatically sort its contents, if any.</p>
  21211. </dl>
  21212. <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
  21213. invoked, must run the following steps:</p>
  21214. <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>
  21215. element</a>, then abort these steps.<li>
  21216. <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>
  21217. <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>
  21218. </ol>
  21219. <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
  21220. 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
  21221. <code>th</code> elements of the table element</a> on which the method was invoked.</p>
  21222. <h4 id=table-examples>4.9.14 Examples</h4>
  21223. <p><i>This section is non-normative.</i></p>
  21224. <p>The following shows how might one mark up the bottom part of table 45 of the <cite>Smithsonian
  21225. physical tables, Volume 71</cite>:</p>
  21226. <pre>&lt;table>
  21227. &lt;caption>Specification values: &lt;b>Steel&lt;/b>, &lt;b>Castings&lt;/b>,
  21228. Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.&lt;/caption>
  21229. &lt;thead>
  21230. &lt;tr>
  21231. &lt;th rowspan=2>Grade.&lt;/th>
  21232. &lt;th rowspan=2>Yield Point.&lt;/th>
  21233. &lt;th colspan=2>Ultimate tensile strength&lt;/th>
  21234. &lt;th rowspan=2>Per cent elong. 50.8mm or 2 in.&lt;/th>
  21235. &lt;th rowspan=2>Per cent reduct. area.&lt;/th>
  21236. &lt;/tr>
  21237. &lt;tr>
  21238. &lt;th>kg/mm&lt;sup>2&lt;/sup>&lt;/th>
  21239. &lt;th>lb/in&lt;sup>2&lt;/sup>&lt;/th>
  21240. &lt;/tr>
  21241. &lt;/thead>
  21242. &lt;tbody>
  21243. &lt;tr>
  21244. &lt;td>Hard&lt;/td>
  21245. &lt;td>0.45 ultimate&lt;/td>
  21246. &lt;td>56.2&lt;/td>
  21247. &lt;td>80,000&lt;/td>
  21248. &lt;td>15&lt;/td>
  21249. &lt;td>20&lt;/td>
  21250. &lt;/tr>
  21251. &lt;tr>
  21252. &lt;td>Medium&lt;/td>
  21253. &lt;td>0.45 ultimate&lt;/td>
  21254. &lt;td>49.2&lt;/td>
  21255. &lt;td>70,000&lt;/td>
  21256. &lt;td>18&lt;/td>
  21257. &lt;td>25&lt;/td>
  21258. &lt;/tr>
  21259. &lt;tr>
  21260. &lt;td>Soft&lt;/td>
  21261. &lt;td>0.45 ultimate&lt;/td>
  21262. &lt;td>42.2&lt;/td>
  21263. &lt;td>60,000&lt;/td>
  21264. &lt;td>22&lt;/td>
  21265. &lt;td>30&lt;/td>
  21266. &lt;/tr>
  21267. &lt;/tbody>
  21268. &lt;/table></pre>
  21269. <p>This table could look like this:</p>
  21270. <table id=table-example-1><caption>Specification values: <b>Steel</b>, <b>Castings</b>,
  21271. 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>
  21272. <hr>
  21273. <p>The following shows how one might mark up the gross margin table on page 46 of Apple, Inc's
  21274. 10-K filing for fiscal year 2008:</p>
  21275. <pre>&lt;table>
  21276. &lt;thead>
  21277. &lt;tr>
  21278. &lt;th>
  21279. &lt;th>2008
  21280. &lt;th>2007
  21281. &lt;th>2006
  21282. &lt;tbody>
  21283. &lt;tr>
  21284. &lt;th>Net sales
  21285. &lt;td>$ 32,479
  21286. &lt;td>$ 24,006
  21287. &lt;td>$ 19,315
  21288. &lt;tr>
  21289. &lt;th>Cost of sales
  21290. &lt;td> 21,334
  21291. &lt;td> 15,852
  21292. &lt;td> 13,717
  21293. &lt;tbody>
  21294. &lt;tr>
  21295. &lt;th>Gross margin
  21296. &lt;td>$ 11,145
  21297. &lt;td>$ 8,154
  21298. &lt;td>$ 5,598
  21299. &lt;tfoot>
  21300. &lt;tr>
  21301. &lt;th>Gross margin percentage
  21302. &lt;td>34.3%
  21303. &lt;td>34.0%
  21304. &lt;td>29.0%
  21305. &lt;/table></pre>
  21306. <p>This table could look like this:</p>
  21307. <table class="apple-table-examples e1"><thead><tr><th>
  21308. <th>2008
  21309. <th>2007
  21310. <th>2006
  21311. <tbody><tr><th>Net sales
  21312. <td>$ 32,479
  21313. <td>$ 24,006
  21314. <td>$ 19,315
  21315. <tr><th>Cost of sales
  21316. <td> 21,334
  21317. <td> 15,852
  21318. <td> 13,717
  21319. <tbody><tr><th>Gross margin
  21320. <td>$ 11,145
  21321. <td>$ 8,154
  21322. <td>$ 5,598
  21323. <tfoot><tr><th>Gross margin percentage
  21324. <td>34.3%
  21325. <td>34.0%
  21326. <td>29.0%
  21327. </table>
  21328. <hr>
  21329. <p>The following shows how one might mark up the operating expenses table from lower on the same
  21330. page of that document:</p>
  21331. <pre>&lt;table>
  21332. &lt;colgroup> &lt;col>
  21333. &lt;colgroup> &lt;col> &lt;col> &lt;col>
  21334. &lt;thead>
  21335. &lt;tr> &lt;th> &lt;th>2008 &lt;th>2007 &lt;th>2006
  21336. &lt;tbody>
  21337. &lt;tr> &lt;th scope=rowgroup> Research and development
  21338. &lt;td> $ 1,109 &lt;td> $ 782 &lt;td> $ 712
  21339. &lt;tr> &lt;th scope=row> Percentage of net sales
  21340. &lt;td> 3.4% &lt;td> 3.3% &lt;td> 3.7%
  21341. &lt;tbody>
  21342. &lt;tr> &lt;th scope=rowgroup> Selling, general, and administrative
  21343. &lt;td> $ 3,761 &lt;td> $ 2,963 &lt;td> $ 2,433
  21344. &lt;tr> &lt;th scope=row> Percentage of net sales
  21345. &lt;td> 11.6% &lt;td> 12.3% &lt;td> 12.6%
  21346. &lt;/table></pre>
  21347. <p>This table could look like this:</p>
  21348. <table class="apple-table-examples e2"><thead><tr><th> <th>2008 <th>2007 <th>2006
  21349. <tbody><tr><th scope=rowgroup> Research and development
  21350. <td> $ 1,109 <td> $ 782 <td> $ 712
  21351. <tr><th scope=row> Percentage of net sales
  21352. <td> 3.4% <td> 3.3% <td> 3.7%
  21353. <tbody><tr><th scope=rowgroup> Selling, general, and administrative
  21354. <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
  21355. <tr><th scope=row> Percentage of net sales
  21356. <td> 11.6% <td> 12.3% <td> 12.6%
  21357. </table>
  21358. <hr>
  21359. <p>Sometimes, tables are used for dense data. For examples, here a table is used to show entries
  21360. in an access log:</p>
  21361. <pre>&lt;table sortable>
  21362. &lt;thead>
  21363. &lt;tr>
  21364. &lt;th sorted> Timestamp
  21365. &lt;th> IP
  21366. &lt;th> Message
  21367. &lt;tbody>
  21368. &lt;tr>
  21369. &lt;td> &lt;time>21:01&lt;/time>
  21370. &lt;td> 128.30.52.199
  21371. &lt;td> Exceeded ingress limit
  21372. &lt;tr>
  21373. &lt;td> &lt;time>21:04&lt;/time>
  21374. &lt;td> 128.30.52.3
  21375. &lt;td> Authentication failure
  21376. &lt;tr>
  21377. &lt;td> &lt;time>22:35&lt;/time>
  21378. &lt;td> 128.30.52.29
  21379. &lt;td> Malware command request blocked
  21380. &lt;tr>
  21381. &lt;td> &lt;time>22:36&lt;/time>
  21382. &lt;td> 128.30.52.3
  21383. &lt;td> Authentication failure
  21384. &lt;/table></pre>
  21385. <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>
  21386. attribute, the column headers can be selected to change the table's sort order.</p>
  21387. <p>This might render as follows:</p>
  21388. <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>
  21389. <p>If the user activates the second column, the table might change as follows:</p>
  21390. <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>
  21391. <p>If the user activates the second column again, reversing the sort order, it might change as follows:</p>
  21392. <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>
  21393. <h3 id=forms>4.10 Forms</h3>
  21394. <h4 id=introduction-5>4.10.1 Introduction</h4>
  21395. <p><i>This section is non-normative.</i></p>
  21396. <p>A form is a component of a Web page that has form controls, such as text fields, buttons,
  21397. checkboxes, range controls, or colour pickers. A user can interact with such a form, providing data
  21398. that can then be sent to the server for further processing (e.g. returning the results of a search
  21399. or calculation). No client-side scripting is needed in many cases, though an API is available so
  21400. that scripts can augment the user experience or use forms for purposes other than submitting data
  21401. to a server.</p>
  21402. <p>Writing a form consists of several steps, which can be performed in any order: writing the user
  21403. interface, implementing the server-side processing, and configuring the user interface to
  21404. communicate with the server.</p>
  21405. <h5 id="writing-a-form's-user-interface">4.10.1.1 Writing a form's user interface</h5>
  21406. <p><i>This section is non-normative.</i></p>
  21407. <p>For the purposes of this brief introduction, we will create a pizza ordering form.</p>
  21408. <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
  21409. 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
  21410. 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
  21411. 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
  21412. <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.
  21413. Putting this together, here is how one might ask for the customer's name:</p>
  21414. <pre><strong>&lt;form>
  21415. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21416. &lt;/form></strong></pre>
  21417. <p>To let the user select the size of the pizza, we can use a set of radio buttons. Radio buttons
  21418. 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
  21419. 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
  21420. of controls together, such as, in this case, the radio buttons, one can use the
  21421. <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
  21422. 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>
  21423. <pre>&lt;form>
  21424. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21425. <strong> &lt;fieldset>
  21426. &lt;legend> Pizza Size &lt;/legend>
  21427. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21428. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21429. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21430. &lt;/fieldset></strong>
  21431. &lt;/form></pre>
  21432. <p class=note>Changes from the previous step are highlighted.</p>
  21433. <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>
  21434. <pre>&lt;form>
  21435. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21436. &lt;fieldset>
  21437. &lt;legend> Pizza Size &lt;/legend>
  21438. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21439. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21440. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21441. &lt;/fieldset>
  21442. <strong> &lt;fieldset>
  21443. &lt;legend> Pizza Toppings &lt;/legend>
  21444. &lt;p>&lt;label> &lt;input type=checkbox> Bacon &lt;/label>&lt;/p>
  21445. &lt;p>&lt;label> &lt;input type=checkbox> Extra Cheese &lt;/label>&lt;/p>
  21446. &lt;p>&lt;label> &lt;input type=checkbox> Onion &lt;/label>&lt;/p>
  21447. &lt;p>&lt;label> &lt;input type=checkbox> Mushroom &lt;/label>&lt;/p>
  21448. &lt;/fieldset></strong>
  21449. &lt;/form></pre>
  21450. <p>The pizzeria for which this form is being written is always making mistakes, so it needs a way
  21451. to contact the customer. For this purpose, we can use form controls specifically for telephone
  21452. 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>
  21453. 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
  21454. (<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
  21455. <code id="writing-a-form's-user-interface:e-mail-state-(type=email)"><a href="#e-mail-state-(type=email)">email</a></code>):</p>
  21456. <pre>&lt;form>
  21457. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21458. <strong> &lt;p>&lt;label>Telephone: &lt;input type=tel>&lt;/label>&lt;/p>
  21459. &lt;p>&lt;label>E-mail address: &lt;input type=email>&lt;/label>&lt;/p></strong>
  21460. &lt;fieldset>
  21461. &lt;legend> Pizza Size &lt;/legend>
  21462. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21463. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21464. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21465. &lt;/fieldset>
  21466. &lt;fieldset>
  21467. &lt;legend> Pizza Toppings &lt;/legend>
  21468. &lt;p>&lt;label> &lt;input type=checkbox> Bacon &lt;/label>&lt;/p>
  21469. &lt;p>&lt;label> &lt;input type=checkbox> Extra Cheese &lt;/label>&lt;/p>
  21470. &lt;p>&lt;label> &lt;input type=checkbox> Onion &lt;/label>&lt;/p>
  21471. &lt;p>&lt;label> &lt;input type=checkbox> Mushroom &lt;/label>&lt;/p>
  21472. &lt;/fieldset>
  21473. &lt;/form></pre>
  21474. <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>
  21475. 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
  21476. of these form controls have attributes to control exactly what values can be specified; in this
  21477. 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
  21478. minimum time, the maximum time, and the interval between allowed values (in seconds). This
  21479. pizzeria only delivers between 11am and 9pm, and doesn't promise anything better than 15 minute
  21480. increments, which we can mark up as follows:</p>
  21481. <pre>&lt;form>
  21482. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21483. &lt;p>&lt;label>Telephone: &lt;input type=tel>&lt;/label>&lt;/p>
  21484. &lt;p>&lt;label>E-mail address: &lt;input type=email>&lt;/label>&lt;/p>
  21485. &lt;fieldset>
  21486. &lt;legend> Pizza Size &lt;/legend>
  21487. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21488. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21489. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21490. &lt;/fieldset>
  21491. &lt;fieldset>
  21492. &lt;legend> Pizza Toppings &lt;/legend>
  21493. &lt;p>&lt;label> &lt;input type=checkbox> Bacon &lt;/label>&lt;/p>
  21494. &lt;p>&lt;label> &lt;input type=checkbox> Extra Cheese &lt;/label>&lt;/p>
  21495. &lt;p>&lt;label> &lt;input type=checkbox> Onion &lt;/label>&lt;/p>
  21496. &lt;p>&lt;label> &lt;input type=checkbox> Mushroom &lt;/label>&lt;/p>
  21497. &lt;/fieldset>
  21498. <strong> &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900">&lt;/label>&lt;/p></strong>
  21499. &lt;/form></pre>
  21500. <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
  21501. instance, we are going to use it to provide a space for the customer to give delivery
  21502. instructions:</p>
  21503. <pre>&lt;form>
  21504. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21505. &lt;p>&lt;label>Telephone: &lt;input type=tel>&lt;/label>&lt;/p>
  21506. &lt;p>&lt;label>E-mail address: &lt;input type=email>&lt;/label>&lt;/p>
  21507. &lt;fieldset>
  21508. &lt;legend> Pizza Size &lt;/legend>
  21509. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21510. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21511. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21512. &lt;/fieldset>
  21513. &lt;fieldset>
  21514. &lt;legend> Pizza Toppings &lt;/legend>
  21515. &lt;p>&lt;label> &lt;input type=checkbox> Bacon &lt;/label>&lt;/p>
  21516. &lt;p>&lt;label> &lt;input type=checkbox> Extra Cheese &lt;/label>&lt;/p>
  21517. &lt;p>&lt;label> &lt;input type=checkbox> Onion &lt;/label>&lt;/p>
  21518. &lt;p>&lt;label> &lt;input type=checkbox> Mushroom &lt;/label>&lt;/p>
  21519. &lt;/fieldset>
  21520. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900">&lt;/label>&lt;/p>
  21521. <strong> &lt;p>&lt;label>Delivery instructions: &lt;textarea>&lt;/textarea>&lt;/label>&lt;/p></strong>
  21522. &lt;/form></pre>
  21523. <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>
  21524. <pre>&lt;form>
  21525. &lt;p>&lt;label>Customer name: &lt;input>&lt;/label>&lt;/p>
  21526. &lt;p>&lt;label>Telephone: &lt;input type=tel>&lt;/label>&lt;/p>
  21527. &lt;p>&lt;label>E-mail address: &lt;input type=email>&lt;/label>&lt;/p>
  21528. &lt;fieldset>
  21529. &lt;legend> Pizza Size &lt;/legend>
  21530. &lt;p>&lt;label> &lt;input type=radio name=size> Small &lt;/label>&lt;/p>
  21531. &lt;p>&lt;label> &lt;input type=radio name=size> Medium &lt;/label>&lt;/p>
  21532. &lt;p>&lt;label> &lt;input type=radio name=size> Large &lt;/label>&lt;/p>
  21533. &lt;/fieldset>
  21534. &lt;fieldset>
  21535. &lt;legend> Pizza Toppings &lt;/legend>
  21536. &lt;p>&lt;label> &lt;input type=checkbox> Bacon &lt;/label>&lt;/p>
  21537. &lt;p>&lt;label> &lt;input type=checkbox> Extra Cheese &lt;/label>&lt;/p>
  21538. &lt;p>&lt;label> &lt;input type=checkbox> Onion &lt;/label>&lt;/p>
  21539. &lt;p>&lt;label> &lt;input type=checkbox> Mushroom &lt;/label>&lt;/p>
  21540. &lt;/fieldset>
  21541. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900">&lt;/label>&lt;/p>
  21542. &lt;p>&lt;label>Delivery instructions: &lt;textarea>&lt;/textarea>&lt;/label>&lt;/p>
  21543. <strong> &lt;p>&lt;button>Submit order&lt;/button>&lt;/p></strong>
  21544. &lt;/form></pre>
  21545. <h5 id=implementing-the-server-side-processing-for-a-form>4.10.1.2 Implementing the server-side processing for a form</h5>
  21546. <p><i>This section is non-normative.</i></p>
  21547. <p>The exact details for writing a server-side processor are out of scope for this specification.
  21548. 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
  21549. <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,
  21550. expecting the following parameters sent in an HTTP POST body:</p>
  21551. <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>
  21552. <h5 id=configuring-a-form-to-communicate-with-a-server>4.10.1.3 Configuring a form to communicate with a server</h5>
  21553. <p><i>This section is non-normative.</i></p>
  21554. <p>Form submissions are exposed to servers in a variety of ways, most commonly as HTTP GET or POST
  21555. 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>
  21556. 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
  21557. 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>
  21558. 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
  21559. 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>
  21560. <p>For each form control you want submitted, you then have to give a name that will be used to
  21561. refer to the data in the submission. We already specified the name for the group of radio buttons;
  21562. 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.
  21563. Radio buttons can be distinguished from each other in the submission by giving them different
  21564. 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>
  21565. <p>Multiple controls can have the same name; for example, here we give all the checkboxes the same
  21566. name, and the server distinguishes which checkbox was checked by seeing which values are submitted
  21567. 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>
  21568. <p>Given the settings in the previous section, this all becomes:</p>
  21569. <pre>&lt;form<strong> method="post"
  21570. enctype="application/x-www-form-urlencoded"
  21571. action="https://pizza.example.com/order.cgi"</strong>>
  21572. &lt;p>&lt;label>Customer name: &lt;input<strong> name="custname"</strong>>&lt;/label>&lt;/p>
  21573. &lt;p>&lt;label>Telephone: &lt;input type=tel<strong> name="custtel"</strong>>&lt;/label>&lt;/p>
  21574. &lt;p>&lt;label>E-mail address: &lt;input type=email<strong> name="custemail"</strong>>&lt;/label>&lt;/p>
  21575. &lt;fieldset>
  21576. &lt;legend> Pizza Size &lt;/legend>
  21577. &lt;p>&lt;label> &lt;input type=radio name=size<strong> value="small"</strong>> Small &lt;/label>&lt;/p>
  21578. &lt;p>&lt;label> &lt;input type=radio name=size<strong> value="medium"</strong>> Medium &lt;/label>&lt;/p>
  21579. &lt;p>&lt;label> &lt;input type=radio name=size<strong> value="large"</strong>> Large &lt;/label>&lt;/p>
  21580. &lt;/fieldset>
  21581. &lt;fieldset>
  21582. &lt;legend> Pizza Toppings &lt;/legend>
  21583. &lt;p>&lt;label> &lt;input type=checkbox<strong> name="topping" value="bacon"</strong>> Bacon &lt;/label>&lt;/p>
  21584. &lt;p>&lt;label> &lt;input type=checkbox<strong> name="topping" value="cheese"</strong>> Extra Cheese &lt;/label>&lt;/p>
  21585. &lt;p>&lt;label> &lt;input type=checkbox<strong> name="topping" value="onion"</strong>> Onion &lt;/label>&lt;/p>
  21586. &lt;p>&lt;label> &lt;input type=checkbox<strong> name="topping" value="mushroom"</strong>> Mushroom &lt;/label>&lt;/p>
  21587. &lt;/fieldset>
  21588. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900"<strong> name="delivery"</strong>>&lt;/label>&lt;/p>
  21589. &lt;p>&lt;label>Delivery instructions: &lt;textarea<strong> name="comments"</strong>>&lt;/textarea>&lt;/label>&lt;/p>
  21590. &lt;p>&lt;button>Submit order&lt;/button>&lt;/p>
  21591. &lt;/form></pre>
  21592. <p class=note>There is no particular significance to the way some of the attributes have their
  21593. values quoted and others don't. The HTML syntax allows a variety of equally valid ways to specify
  21594. attributes, as discussed <a href=#syntax-attributes id=configuring-a-form-to-communicate-with-a-server:syntax-attributes>in the syntax section</a>.</p>
  21595. <p>For example, if the customer entered "Denise Lawrence" as their name, "555-321-8642" as their
  21596. telephone number, did not specify an e-mail address, asked for a medium-sized pizza, selected the
  21597. Extra Cheese and Mushroom toppings, entered a delivery time of 7pm, and left the delivery
  21598. instructions text field blank, the user agent would submit the following to the online Web
  21599. service:</p>
  21600. <pre>custname=Denise+Lawrence&amp;custtel=555-321-8642&amp;custemail=&amp;size=medium&amp;topping=cheese&amp;topping=mushroom&amp;delivery=19%3A00&amp;comments=</pre>
  21601. <h5 id=client-side-form-validation>4.10.1.4 Client-side form validation</h5>
  21602. <p><i>This section is non-normative.</i></p>
  21603. <p>Forms can be annotated in such a way that the user agent will check the user's input before the
  21604. form is submitted. The server still has to verify the input is valid (since hostile users can
  21605. easily bypass the form validation), but it allows the user to avoid the wait incurred by having
  21606. the server be the sole checker of the user's input.</p>
  21607. <p>The simplest annotation is the <code id=client-side-form-validation:attr-input-required><a href=#attr-input-required>required</a></code> attribute,
  21608. 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
  21609. submitted until a value is given. By adding this attribute to the customer name, pizza size, and
  21610. delivery time fields, we allow the user agent to notify the user when the user submits the form
  21611. without filling in those fields:</p>
  21612. <pre>&lt;form method="post"
  21613. enctype="application/x-www-form-urlencoded"
  21614. action="https://pizza.example.com/order.cgi">
  21615. &lt;p>&lt;label>Customer name: &lt;input name="custname"<strong> required</strong>>&lt;/label>&lt;/p>
  21616. &lt;p>&lt;label>Telephone: &lt;input type=tel name="custtel">&lt;/label>&lt;/p>
  21617. &lt;p>&lt;label>E-mail address: &lt;input type=email name="custemail">&lt;/label>&lt;/p>
  21618. &lt;fieldset>
  21619. &lt;legend> Pizza Size &lt;/legend>
  21620. &lt;p>&lt;label> &lt;input type=radio name=size<strong> required</strong> value="small"> Small &lt;/label>&lt;/p>
  21621. &lt;p>&lt;label> &lt;input type=radio name=size<strong> required</strong> value="medium"> Medium &lt;/label>&lt;/p>
  21622. &lt;p>&lt;label> &lt;input type=radio name=size<strong> required</strong> value="large"> Large &lt;/label>&lt;/p>
  21623. &lt;/fieldset>
  21624. &lt;fieldset>
  21625. &lt;legend> Pizza Toppings &lt;/legend>
  21626. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="bacon"> Bacon &lt;/label>&lt;/p>
  21627. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="cheese"> Extra Cheese &lt;/label>&lt;/p>
  21628. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="onion"> Onion &lt;/label>&lt;/p>
  21629. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="mushroom"> Mushroom &lt;/label>&lt;/p>
  21630. &lt;/fieldset>
  21631. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery"<strong> required</strong>>&lt;/label>&lt;/p>
  21632. &lt;p>&lt;label>Delivery instructions: &lt;textarea name="comments">&lt;/textarea>&lt;/label>&lt;/p>
  21633. &lt;p>&lt;button>Submit order&lt;/button>&lt;/p>
  21634. &lt;/form></pre>
  21635. <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>
  21636. element, we can limit users to 1000 characters, preventing them from writing huge essays to the
  21637. busy delivery drivers instead of staying focused and to the point:</p>
  21638. <pre>&lt;form method="post"
  21639. enctype="application/x-www-form-urlencoded"
  21640. action="https://pizza.example.com/order.cgi">
  21641. &lt;p>&lt;label>Customer name: &lt;input name="custname" required>&lt;/label>&lt;/p>
  21642. &lt;p>&lt;label>Telephone: &lt;input type=tel name="custtel">&lt;/label>&lt;/p>
  21643. &lt;p>&lt;label>E-mail address: &lt;input type=email name="custemail">&lt;/label>&lt;/p>
  21644. &lt;fieldset>
  21645. &lt;legend> Pizza Size &lt;/legend>
  21646. &lt;p>&lt;label> &lt;input type=radio name=size required value="small"> Small &lt;/label>&lt;/p>
  21647. &lt;p>&lt;label> &lt;input type=radio name=size required value="medium"> Medium &lt;/label>&lt;/p>
  21648. &lt;p>&lt;label> &lt;input type=radio name=size required value="large"> Large &lt;/label>&lt;/p>
  21649. &lt;/fieldset>
  21650. &lt;fieldset>
  21651. &lt;legend> Pizza Toppings &lt;/legend>
  21652. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="bacon"> Bacon &lt;/label>&lt;/p>
  21653. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="cheese"> Extra Cheese &lt;/label>&lt;/p>
  21654. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="onion"> Onion &lt;/label>&lt;/p>
  21655. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="mushroom"> Mushroom &lt;/label>&lt;/p>
  21656. &lt;/fieldset>
  21657. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required>&lt;/label>&lt;/p>
  21658. &lt;p>&lt;label>Delivery instructions: &lt;textarea name="comments"<strong> maxlength=1000</strong>>&lt;/textarea>&lt;/label>&lt;/p>
  21659. &lt;p>&lt;button>Submit order&lt;/button>&lt;/p>
  21660. &lt;/form></pre>
  21661. <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
  21662. 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
  21663. can be useful for displaying a summary of the problems with the form, since typically the browser
  21664. itself will only report one problem at a time.</p>
  21665. <h5 id=enabling-client-side-automatic-filling-of-form-controls>4.10.1.5 Enabling client-side automatic filling of form controls</h5>
  21666. <p><i>This section is non-normative.</i></p>
  21667. <p>Some browsers attempt to aid the user by automatically filling form controls rather than having
  21668. the user reenter their information each time. For example, a field asking for the user's telephone
  21669. number can be automatically filled with the user's phone number.</p>
  21670. <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>
  21671. attribute can be used to describe the field's purpose. In the case of this form, we have three
  21672. fields that can be usefully annotated in this way: the information about who the pizza is to be
  21673. delivered to. Adding this information looks like this:</p>
  21674. <pre>&lt;form method="post"
  21675. enctype="application/x-www-form-urlencoded"
  21676. action="https://pizza.example.com/order.cgi">
  21677. &lt;p>&lt;label>Customer name: &lt;input name="custname" required <strong>autocomplete="shipping name"</strong>>&lt;/label>&lt;/p>
  21678. &lt;p>&lt;label>Telephone: &lt;input type=tel name="custtel" <strong>autocomplete="shipping tel"</strong>>&lt;/label>&lt;/p>
  21679. &lt;p>&lt;label>E-mail address: &lt;input type=email name="custemail" <strong>autocomplete="shipping email"</strong>>&lt;/label>&lt;/p>
  21680. &lt;fieldset>
  21681. &lt;legend> Pizza Size &lt;/legend>
  21682. &lt;p>&lt;label> &lt;input type=radio name=size required value="small"> Small &lt;/label>&lt;/p>
  21683. &lt;p>&lt;label> &lt;input type=radio name=size required value="medium"> Medium &lt;/label>&lt;/p>
  21684. &lt;p>&lt;label> &lt;input type=radio name=size required value="large"> Large &lt;/label>&lt;/p>
  21685. &lt;/fieldset>
  21686. &lt;fieldset>
  21687. &lt;legend> Pizza Toppings &lt;/legend>
  21688. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="bacon"> Bacon &lt;/label>&lt;/p>
  21689. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="cheese"> Extra Cheese &lt;/label>&lt;/p>
  21690. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="onion"> Onion &lt;/label>&lt;/p>
  21691. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="mushroom"> Mushroom &lt;/label>&lt;/p>
  21692. &lt;/fieldset>
  21693. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required>&lt;/label>&lt;/p>
  21694. &lt;p>&lt;label>Delivery instructions: &lt;textarea name="comments" maxlength=1000>&lt;/textarea>&lt;/label>&lt;/p>
  21695. &lt;p>&lt;button>Submit order&lt;/button>&lt;/p>
  21696. &lt;/form></pre>
  21697. <h5 id=improving-the-user-experience-on-mobile-devices>4.10.1.6 Improving the user experience on mobile devices</h5>
  21698. <p><i>This section is non-normative.</i></p>
  21699. <p>Some devices, in particular those with on-screen keyboards and those in locales with languages
  21700. with many characters (e.g. Japanese), can provide the user with multiple input modalities. For
  21701. example, when typing in a credit card number the user may wish to only see keys for digits 0-9,
  21702. while when typing in their name they may wish to see a form field that by default capitalises each
  21703. word.</p>
  21704. <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
  21705. input modalities:</p>
  21706. <pre>&lt;form method="post"
  21707. enctype="application/x-www-form-urlencoded"
  21708. action="https://pizza.example.com/order.cgi">
  21709. &lt;p>&lt;label>Customer name: &lt;input name="custname" required autocomplete="shipping name" <strong>inputmode="latin-name"</strong>>&lt;/label>&lt;/p>
  21710. &lt;p>&lt;label>Telephone: &lt;input type=tel name="custtel" autocomplete="shipping tel">&lt;/label>&lt;/p>
  21711. &lt;p>&lt;label>E-mail address: &lt;input type=email name="custemail" autocomplete="shipping email">&lt;/label>&lt;/p>
  21712. &lt;fieldset>
  21713. &lt;legend> Pizza Size &lt;/legend>
  21714. &lt;p>&lt;label> &lt;input type=radio name=size required value="small"> Small &lt;/label>&lt;/p>
  21715. &lt;p>&lt;label> &lt;input type=radio name=size required value="medium"> Medium &lt;/label>&lt;/p>
  21716. &lt;p>&lt;label> &lt;input type=radio name=size required value="large"> Large &lt;/label>&lt;/p>
  21717. &lt;/fieldset>
  21718. &lt;fieldset>
  21719. &lt;legend> Pizza Toppings &lt;/legend>
  21720. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="bacon"> Bacon &lt;/label>&lt;/p>
  21721. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="cheese"> Extra Cheese &lt;/label>&lt;/p>
  21722. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="onion"> Onion &lt;/label>&lt;/p>
  21723. &lt;p>&lt;label> &lt;input type=checkbox name="topping" value="mushroom"> Mushroom &lt;/label>&lt;/p>
  21724. &lt;/fieldset>
  21725. &lt;p>&lt;label>Preferred delivery time: &lt;input type=time min="11:00" max="21:00" step="900" name="delivery" required>&lt;/label>&lt;/p>
  21726. &lt;p>&lt;label>Delivery instructions: &lt;textarea name="comments" maxlength=1000 <strong>inputmode="latin-prose"</strong>>&lt;/textarea>&lt;/label>&lt;/p>
  21727. &lt;p>&lt;button>Submit order&lt;/button>&lt;/p>
  21728. &lt;/form></pre>
  21729. <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>
  21730. <p><i>This section is non-normative.</i></p>
  21731. <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,
  21732. in all three cases, the string "<code>email</code>" is a valid value. This section
  21733. attempts to illustrate the difference between the three attributes and provides advice suggesting
  21734. how to use them.</p>
  21735. <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
  21736. what kind of control the user agent will use to expose the field. Choosing between different
  21737. 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>
  21738. 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>
  21739. element, etc.</p>
  21740. <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
  21741. what the value that the user will enter actually represents. Choosing between different values of
  21742. this attribute is the same choice as choosing what the label for the element will be.</p>
  21743. <p>First, consider telephone numbers. If a page is asking for a telephone number from the user,
  21744. 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)">&lt;input type=tel></a></code>.
  21745. 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
  21746. which phone number the page is asking for, whether they expect a telephone number in the
  21747. international format or just the local format, and so forth.</p>
  21748. <p>For example, a page that forms part of a checkout process on an e-commerce site for a customer
  21749. buying a gift to be shipped to a friend might need both the buyer's telephone number (in case of
  21750. payment issues) and the friend's telephone number (in case of delivery issues). If the site
  21751. expects international phone numbers (with the country code prefix), this could thus look like
  21752. this:</p>
  21753. <pre>&lt;p>&lt;label>Your phone number: &lt;input type=tel name=custtel autocomplete="billing tel">&lt;/label>
  21754. &lt;p>&lt;label>Recipient's phone number: &lt;input type=tel name=shiptel autocomplete="shipping tel">&lt;/label>
  21755. &lt;p>Please enter complete phone numbers including the country code prefix, as in "+1 555 123 4567".</pre>
  21756. <p>But if the site only supports British customers and recipients, it might instead look like this
  21757. (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
  21758. <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>
  21759. <pre>&lt;p>&lt;label>Your phone number: &lt;input type=tel name=custtel autocomplete="billing tel-national">&lt;/label>
  21760. &lt;p>&lt;label>Recipient's phone number: &lt;input type=tel name=shiptel autocomplete="shipping tel-national">&lt;/label>
  21761. &lt;p>Please enter complete UK phone numbers, as in "(01632) 960 123".</pre>
  21762. <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
  21763. 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)">&lt;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>&lt;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)">&lt;input
  21764. type=radio></a></code>), etc. It only depends on what kind of interface is desired.</p>
  21765. <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.
  21766. keyboard) to use, when the control is a free-form text field.</p>
  21767. <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)">&lt;input type=text></a></code>. If the page is asking for the user's
  21768. 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
  21769. for the user's Japanese name and the user's romanised name, then it would be helpful to the user
  21770. if the first field defaulted to a Japanese input modality, while the second defaulted to a Latin
  21771. 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>
  21772. <pre>&lt;p>&lt;label>Japanese name: &lt;input name="j" type="text" autocomplete="section-jp name" inputmode="kana">&lt;/label>
  21773. &lt;label>Romanised name: &lt;input name="e" type="text" autocomplete="section-en name" inputmode="latin-name">&lt;/label></pre>
  21774. <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
  21775. 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
  21776. that the two fields expect <em>different</em> names. Without them, the user agent could
  21777. automatically fill the second field with the value given in the first field when the user gave a
  21778. value to the first field.</p>
  21779. <p class=note>The "<code>-jp</code>" and "<code>-en</code>" parts of the
  21780. keywords are opaque to the user agent; the user agent cannot guess, from those, that the two names
  21781. are expected to be in Japanese and English respectively.</p>
  21782. <h5 id=input-author-notes>4.10.1.8 Date, time, and number formats</h5>
  21783. <p><i>This section is non-normative.</i></p>
  21784. <p>In this pizza delivery example, the times are specified in the format "HH:MM": two digits for
  21785. the hour, in 24-hour format, and two digits for the time. (Seconds could also be specified, though
  21786. they are not necessary in this example.)</p>
  21787. <p>In some locales, however, times are often expressed differently when presented to users. For
  21788. example, in the United States, it is still common to use the 12-hour clock with an am/pm
  21789. indicator, as in "2pm". In France, it is common to separate the hours from the minutes using an
  21790. "h" character, as in "14h00".</p>
  21791. <p>Similar issues exist with dates, with the added complication that even the order of the
  21792. components is not always consistent — for example, in Cyprus the first of February 2003
  21793. would typically be written "1/2/03", while that same date in Japan would typically be written as
  21794. "2003年02月01日" — and even with numbers, where locales differ, for
  21795. example, in what punctuation is used as the decimal separator and the thousands separator.</p>
  21796. <p>It is therefore important to distinguish the time, date, and number formats used in HTML and in
  21797. form submissions, which are always the formats defined in this specification (and based on the
  21798. well-established ISO 8601 standard for computer-readable date and time formats), from the time,
  21799. date, and number formats presented to the user by the browser and accepted as input from the user
  21800. by the browser.</p>
  21801. <p>The format used "on the wire", i.e. in HTML markup and in form submissions, is intended to be
  21802. computer-readable and consistent irrespective of the user's locale. Dates, for instance, are
  21803. always written in the format "YYYY-MM-DD", as in "2003-02-01". Users are not expected to ever see
  21804. this format.</p>
  21805. <p>The time, date, or number given by the page in the wire format is then translated to the user's
  21806. preferred presentation (based on user preferences or on the locale of the page itself), before
  21807. being displayed to the user. Similarly, after the user inputs a time, date, or number using their
  21808. preferred format, the user agent converts it back to the wire format before putting it in the DOM
  21809. or submitting it.</p>
  21810. <p>This allows scripts in pages and on servers to process times, dates, and numbers in a
  21811. consistent manner without needing to support dozens of different formats, while still supporting
  21812. the users' needs.</p>
  21813. <p class=note>See also the <a href=#input-impl-notes>implementation notes</a> regarding
  21814. localization of form controls.</p>
  21815. <h4 id=categories>4.10.2 Categories</h4>
  21816. <p>Mostly for historical reasons, elements in this section fall into several overlapping (but
  21817. subtly different) categories in addition to the usual ones like <a href=#flow-content-2 id=categories:flow-content-2>flow content</a>,
  21818. <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>
  21819. <p>A number of the elements are <dfn id=form-associated-element>form-associated
  21820. elements</dfn>, which means they can have a <a href=#form-owner id=categories:form-owner>form owner</a>.
  21821. <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>
  21822. <p>The <a href=#form-associated-element id=categories:form-associated-element>form-associated elements</a> fall into several
  21823. subcategories:</p>
  21824. <dl><dt><dfn id=category-listed>Listed elements</dfn><dd>
  21825. <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>
  21826. <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>
  21827. <dt><dfn id=category-submit>Submittable elements</dfn><dd>
  21828. <p>Denotes elements that can be used for <a href=#constructing-form-data-set>constructing the
  21829. 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>
  21830. <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>
  21831. <p>Some <a href=#category-submit id=categories:category-submit>submittable elements</a> can be, depending on their
  21832. attributes, <dfn id=concept-button>buttons</dfn>. The prose below defines when an element
  21833. is a button. Some buttons are specifically <dfn id=concept-submit-button>submit
  21834. buttons</dfn>.</p>
  21835. <dt><dfn id=category-reset>Resettable elements</dfn><dd>
  21836. <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>
  21837. <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>
  21838. <dt><dfn id=category-form-attr>Reassociateable elements</dfn><dd>
  21839. <p>Denotes elements that have a <code id=categories:attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute, and a
  21840. matching <code id=categories:dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute, that allow authors to specify an
  21841. explicit <a href=#form-owner id=categories:form-owner-2>form owner</a>.</p>
  21842. <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>
  21843. </dl>
  21844. <p>Some elements, not all of them <a href=#form-associated-element id=categories:form-associated-element-2>form-associated</a>,
  21845. are categorised as <dfn id=category-label>labelable elements</dfn>. These are elements that
  21846. can be associated with a <code id=categories:the-label-element-3><a href=#the-label-element>label</a></code> element.
  21847. <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>
  21848. <h4 id=the-form-element>4.10.3 The <dfn><code>form</code></dfn> element</h4>
  21849. <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>
  21850. <pre class=idl>[OverrideBuiltins]
  21851. interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement id=the-form-element:htmlelement>HTMLElement</a> {
  21852. attribute DOMString <a href=#dom-form-acceptcharset id=the-form-element:dom-form-acceptcharset>acceptCharset</a>;
  21853. attribute DOMString <a href=#dom-fs-action id=the-form-element:dom-fs-action>action</a>;
  21854. attribute DOMString <a href=#dom-form-autocomplete id=the-form-element:dom-form-autocomplete>autocomplete</a>;
  21855. attribute DOMString <a href=#dom-fs-enctype id=the-form-element:dom-fs-enctype>enctype</a>;
  21856. attribute DOMString <a href=#dom-fs-encoding id=the-form-element:dom-fs-encoding>encoding</a>;
  21857. attribute DOMString <a href=#dom-fs-method id=the-form-element:dom-fs-method>method</a>;
  21858. attribute DOMString <a href=#dom-form-name id=the-form-element:dom-form-name>name</a>;
  21859. attribute boolean <a href=#dom-fs-novalidate id=the-form-element:dom-fs-novalidate>noValidate</a>;
  21860. attribute DOMString <a href=#dom-fs-target id=the-form-element:dom-fs-target>target</a>;
  21861. 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>;
  21862. readonly attribute long <a href=#dom-form-length id=the-form-element:dom-form-length>length</a>;
  21863. <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);
  21864. <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);
  21865. void <a href=#dom-form-submit id=the-form-element:dom-form-submit>submit</a>();
  21866. void <a href=#dom-form-reset id=the-form-element:dom-form-reset>reset</a>();
  21867. boolean <a href=#dom-form-checkvalidity id=the-form-element:dom-form-checkvalidity>checkValidity</a>();
  21868. boolean <a href=#dom-form-reportvalidity id=the-form-element:dom-form-reportvalidity>reportValidity</a>();
  21869. void <a href=#dom-form-requestautocomplete id=the-form-element:dom-form-requestautocomplete>requestAutocomplete</a>();
  21870. };</pre>
  21871. </dl>
  21872. <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
  21873. editable values that can be submitted to a server for processing.</p>
  21874. <p>The <dfn id=attr-form-accept-charset><code>accept-charset</code></dfn> attribute gives the
  21875. character encodings that are to be used for the submission. If specified, the value must be an
  21876. <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
  21877. 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
  21878. 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
  21879. encoding</a>. <a href=#refsENCODING>[ENCODING]</a></p>
  21880. <p>The <dfn id=attr-form-name><code>name</code></dfn> attribute represents the
  21881. <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
  21882. 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>
  21883. 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
  21884. any.</p>
  21885. <p>The <dfn id=attr-form-autocomplete><code>autocomplete</code></dfn> attribute is an
  21886. <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
  21887. <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
  21888. 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
  21889. 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>
  21890. <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>,
  21891. <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>,
  21892. 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
  21893. submission</a>.</p>
  21894. <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>
  21895. <p>Returns an <code id=the-form-element:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> of the form controls in the form (excluding image
  21896. buttons for historical reasons).</p>
  21897. <dt><var>form</var> . <code id=the-form-element:dom-form-length-2><a href=#dom-form-length>length</a></code><dd>
  21898. <p>Returns the number of form controls in the form (excluding image buttons for historical
  21899. reasons).</p>
  21900. <dt><var>form</var>[<var>index</var>]<dd>
  21901. <p>Returns the <var>index</var>th element in the form (excluding image buttons for
  21902. historical reasons).</p>
  21903. <dt><var>form</var>[<var>name</var>]<dd>
  21904. <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
  21905. 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
  21906. 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>
  21907. <p>Once an element has been referenced using a particular name, that name will continue being
  21908. 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
  21909. the element remains in the <code id=the-form-element:document><a href=#document>Document</a></code>.</p>
  21910. <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
  21911. those elements is returned.</p>
  21912. <dt><var>form</var> . <code id=the-form-element:dom-form-submit-2><a href=#dom-form-submit>submit</a></code>()<dd>
  21913. <p>Submits the form.</p>
  21914. <dt><var>form</var> . <code id=the-form-element:dom-form-reset-2><a href=#dom-form-reset>reset</a></code>()<dd>
  21915. <p>Resets the form.</p>
  21916. <dt><var>form</var> . <code id=the-form-element:dom-form-checkvalidity-2><a href=#dom-form-checkvalidity>checkValidity</a></code>()<dd>
  21917. <p>Returns true if the form's controls are all valid; otherwise, returns false.</p>
  21918. <dt><var>form</var> . <code id=the-form-element:dom-form-reportvalidity-2><a href=#dom-form-reportvalidity>reportValidity</a></code>()<dd>
  21919. <p>Returns true if the form's controls are all valid; otherwise, returns false and informs the user.</p>
  21920. <dt><var>form</var> . <code id=the-form-element:dom-form-requestautocomplete-2><a href=#dom-form-requestautocomplete>requestAutocomplete</a></code>()<dd>
  21921. <p>Triggers a user-agent-specific asynchronous user interface to help the user fill in any
  21922. 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>
  21923. <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,
  21924. or <code id=the-form-element:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> (using the
  21925. <code id=the-form-element:autocompleteerrorevent><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code> interface), indicating that there was some problem (the
  21926. 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>
  21927. </dl>
  21928. <p>The <dfn id=dom-form-autocomplete><code>autocomplete</code></dfn> IDL attribute must
  21929. <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
  21930. values</a>.</p>
  21931. <p>The <code id=the-form-element:dom-form-requestautocomplete-3><a href=#dom-form-requestautocomplete>requestAutocomplete()</a></code> method is part of
  21932. the <a href=#attr-fe-autocomplete id=the-form-element:attr-fe-autocomplete>autofill mechanism</a>.</p>
  21933. <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>
  21934. the content attribute of the same name.</p>
  21935. <p>The <dfn id=dom-form-acceptcharset><code>acceptCharset</code></dfn> IDL attribute must
  21936. <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
  21937. attribute.</p>
  21938. <hr>
  21939. <p>The <dfn id=dom-form-elements><code>elements</code></dfn> IDL attribute must return an
  21940. <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
  21941. 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
  21942. <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
  21943. excluded from this particular collection.</p>
  21944. <p>The <dfn id=dom-form-length><code>length</code></dfn> IDL attribute must return the number
  21945. 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>
  21946. <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
  21947. object returned by the <code id=the-form-element:dom-form-elements-4><a href=#dom-form-elements>elements</a></code> attribute at that
  21948. instant.</p>
  21949. <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
  21950. 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
  21951. argument.</p>
  21952. <hr>
  21953. <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
  21954. map</dfn>. It is used to persist names of controls even when they change names.</p>
  21955. <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
  21956. algorithm, in the order obtained from this algorithm:</p>
  21957. <ol><li><p>Let <var>sourced names</var> be an initially empty ordered list of tuples
  21958. consisting of a string, an element, a source, where the source is either <i>id</i>, <i>name</i>,
  21959. or <i>past</i>, and, if the source is <i>past</i>, an age.<li>
  21960. <p>For each <a href=#category-listed id=the-form-element:category-listed-2>listed element</a> <var>candidate</var>
  21961. 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
  21962. <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
  21963. <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>
  21964. <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
  21965. 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>
  21966. attribute's value as the string, <var>candidate</var> as the element, and <i>id</i> as
  21967. 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,
  21968. 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>
  21969. as the element, and <i>name</i> as the source.</ol>
  21970. <li>
  21971. <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>
  21972. is the <code id=the-form-element:the-form-element-11><a href=#the-form-element>form</a></code> element, run these substeps:</p>
  21973. <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
  21974. 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>
  21975. attribute's value as the string, <var>candidate</var> as the element, and <i>id</i> as
  21976. 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,
  21977. 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>
  21978. as the element, and <i>name</i> as the source.</ol>
  21979. <li>
  21980. <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
  21981. to <var>sourced names</var> with the <var>past entry</var>'s name as the
  21982. string, <var>past entry</var>'s element as the element, <i>past</i> as the source, and
  21983. 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
  21984. the age.</p>
  21985. <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
  21986. each tuple, sorting entries with the same element by putting entries whose source is <i>id</i>
  21987. first, then entries whose source is <i>name</i>, and finally entries whose source is <i>past</i>,
  21988. 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
  21989. their name.<li><p>Remove any entries in <var>sourced names</var> that have the same name as an
  21990. earlier entry in the map.<li><p>Return the list of names from <var>sourced names</var>, maintaining their
  21991. relative order.</ol>
  21992. <p>The properties exposed in this way must be <a href=#unenumerable id=the-form-element:unenumerable>unenumerable</a>.</p>
  21993. <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
  21994. retrieval</dfn>, the user agent must run the following steps:</p>
  21995. <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>
  21996. 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
  21997. 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>
  21998. 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
  21999. 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
  22000. <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
  22001. 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
  22002. 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
  22003. 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
  22004. 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
  22005. <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>
  22006. 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
  22007. any.<li><p>Return the node in <var>candidates</var>.</ol>
  22008. <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
  22009. <a href=#form-owner id=the-form-element:form-owner-5>form owner</a>, then its entries must be removed from that map.</p>
  22010. <hr>
  22011. <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>
  22012. 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>
  22013. <p>The <dfn id=dom-form-reset><code>reset()</code></dfn> method, when invoked, must run the
  22014. following steps:</p>
  22015. <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
  22016. 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>
  22017. <p>If the <dfn id=dom-form-checkvalidity><code>checkValidity()</code></dfn> method is
  22018. 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
  22019. <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>
  22020. result, and false if it returned a <i>negative</i> result.</p>
  22021. <p>If the <dfn id=dom-form-reportvalidity><code>reportValidity()</code></dfn> method is
  22022. 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
  22023. <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>
  22024. result, and false if it returned a <i>negative</i> result.</p>
  22025. <div class=example>
  22026. <p>This example shows two search forms:</p>
  22027. <pre>&lt;form action="http://www.google.com/search" method="get">
  22028. &lt;label>Google: &lt;input type="search" name="q">&lt;/label> &lt;input type="submit" value="Search...">
  22029. &lt;/form>
  22030. &lt;form action="http://www.bing.com/search" method="get">
  22031. &lt;label>Bing: &lt;input type="search" name="q">&lt;/label> &lt;input type="submit" value="Search...">
  22032. &lt;/form></pre>
  22033. </div>
  22034. <h4 id=the-label-element>4.10.4 The <dfn><code>label</code></dfn> element</h4>
  22035. <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>
  22036. <pre class=idl>interface <dfn id=htmllabelelement>HTMLLabelElement</dfn> : <a href=#htmlelement id=the-label-element:htmlelement>HTMLElement</a> {
  22037. 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>;
  22038. attribute DOMString <a href=#dom-label-htmlfor id=the-label-element:dom-label-htmlfor>htmlFor</a>;
  22039. 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>;
  22040. };</pre>
  22041. </dl>
  22042. <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
  22043. caption can be associated with a specific form control, known as the
  22044. <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
  22045. <code id=the-label-element:the-label-element-4><a href=#the-label-element>label</a></code> element itself.</p>
  22046. <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
  22047. <a href=#labeled-control id=the-label-element:labeled-control-2>labeled control</a>.</p>
  22048. <p>The <dfn id=attr-label-for><code>for</code></dfn> attribute may be specified to indicate a
  22049. form control with which the caption is to be associated. If the attribute is specified, the
  22050. 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
  22051. <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
  22052. 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
  22053. 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
  22054. <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>
  22055. element's <a href=#labeled-control id=the-label-element:labeled-control-3>labeled control</a>.</p>
  22056. <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
  22057. <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,
  22058. 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
  22059. <a href=#labeled-control id=the-label-element:labeled-control-4>labeled control</a>.</p>
  22060. <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
  22061. its <a href=#activation-behavior id=the-label-element:activation-behavior>activation behavior</a> might be, if anything, should match the platform's label
  22062. 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
  22063. 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
  22064. 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>
  22065. <div class=example>
  22066. <p>For example, on platforms where clicking a checkbox label checks the checkbox, clicking the
  22067. <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
  22068. 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
  22069. been triggered by the user:</p>
  22070. <pre>&lt;label>&lt;input type=checkbox name=lost> Lost&lt;/label></pre>
  22071. <p>On other platforms, the behavior might be just to focus the control, or do nothing.</p>
  22072. </div>
  22073. <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
  22074. <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>
  22075. <div class=example>
  22076. <p>The following example shows three form controls each with a label, two of which have small
  22077. text showing the right format for users to use.</p>
  22078. <pre>&lt;p>&lt;label>Full name: &lt;input name=fn> &lt;small>Format: First Last&lt;/small>&lt;/label>&lt;/p>
  22079. &lt;p>&lt;label>Age: &lt;input name=age type=number min=0>&lt;/label>&lt;/p>
  22080. &lt;p>&lt;label>Post code: &lt;input name=pc> &lt;small>Format: AB12 3CD&lt;/small>&lt;/label>&lt;/p></pre>
  22081. </div>
  22082. <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>
  22083. <p>Returns the form control that is associated with this element.</p>
  22084. </dl>
  22085. <p>The <dfn id=dom-label-htmlfor><code>htmlFor</code></dfn> IDL attribute must
  22086. <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>
  22087. <p>The <dfn id=dom-label-control><code>control</code></dfn> IDL attribute must return the
  22088. <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>
  22089. <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
  22090. API.</p>
  22091. <hr>
  22092. <dl class=domintro><dt><var>control</var> . <code id=the-label-element:dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code><dd>
  22093. <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
  22094. is associated with.</p>
  22095. </dl>
  22096. <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
  22097. 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
  22098. 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
  22099. <code id=the-label-element:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
  22100. <h4 id=the-input-element>4.10.5 The <dfn><code>input</code></dfn> element</h4>
  22101. <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>
  22102. <pre class=idl>interface <dfn id=htmlinputelement>HTMLInputElement</dfn> : <a href=#htmlelement id=the-input-element:htmlelement>HTMLElement</a> {
  22103. attribute DOMString <a href=#dom-input-accept id=the-input-element:dom-input-accept>accept</a>;
  22104. attribute DOMString <a href=#dom-input-alt id=the-input-element:dom-input-alt>alt</a>;
  22105. attribute DOMString <a href=#dom-fe-autocomplete id=the-input-element:dom-fe-autocomplete>autocomplete</a>;
  22106. attribute boolean <a href=#dom-fe-autofocus id=the-input-element:dom-fe-autofocus>autofocus</a>;
  22107. attribute boolean <a href=#dom-input-defaultchecked id=the-input-element:dom-input-defaultchecked>defaultChecked</a>;
  22108. attribute boolean <a href=#dom-input-checked id=the-input-element:dom-input-checked>checked</a>;
  22109. attribute DOMString <a href=#dom-input-dirname id=the-input-element:dom-input-dirname>dirName</a>;
  22110. attribute boolean <a href=#dom-fe-disabled id=the-input-element:dom-fe-disabled>disabled</a>;
  22111. 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>;
  22112. 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>;
  22113. attribute DOMString <a href=#dom-fs-formaction id=the-input-element:dom-fs-formaction>formAction</a>;
  22114. attribute DOMString <a href=#dom-fs-formenctype id=the-input-element:dom-fs-formenctype>formEnctype</a>;
  22115. attribute DOMString <a href=#dom-fs-formmethod id=the-input-element:dom-fs-formmethod>formMethod</a>;
  22116. attribute boolean <a href=#dom-fs-formnovalidate id=the-input-element:dom-fs-formnovalidate>formNoValidate</a>;
  22117. attribute DOMString <a href=#dom-fs-formtarget id=the-input-element:dom-fs-formtarget>formTarget</a>;
  22118. attribute unsigned long <a href=#dom-input-height id=the-input-element:dom-input-height>height</a>;
  22119. attribute boolean <a href=#dom-input-indeterminate id=the-input-element:dom-input-indeterminate>indeterminate</a>;
  22120. attribute DOMString <a href=#dom-input-inputmode id=the-input-element:dom-input-inputmode>inputMode</a>;
  22121. 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>;
  22122. attribute DOMString <a href=#dom-input-max id=the-input-element:dom-input-max>max</a>;
  22123. attribute long <a href=#dom-input-maxlength id=the-input-element:dom-input-maxlength>maxLength</a>;
  22124. attribute DOMString <a href=#dom-input-min id=the-input-element:dom-input-min>min</a>;
  22125. attribute long <a href=#dom-input-minlength id=the-input-element:dom-input-minlength>minLength</a>;
  22126. attribute boolean <a href=#dom-input-multiple id=the-input-element:dom-input-multiple>multiple</a>;
  22127. attribute DOMString <a href=#dom-fe-name id=the-input-element:dom-fe-name>name</a>;
  22128. attribute DOMString <a href=#dom-input-pattern id=the-input-element:dom-input-pattern>pattern</a>;
  22129. attribute DOMString <a href=#dom-input-placeholder id=the-input-element:dom-input-placeholder>placeholder</a>;
  22130. attribute boolean <a href=#dom-input-readonly id=the-input-element:dom-input-readonly>readOnly</a>;
  22131. attribute boolean <a href=#dom-input-required id=the-input-element:dom-input-required>required</a>;
  22132. attribute unsigned long <a href=#dom-input-size id=the-input-element:dom-input-size>size</a>;
  22133. attribute DOMString <a href=#dom-input-src id=the-input-element:dom-input-src>src</a>;
  22134. attribute DOMString <a href=#dom-input-step id=the-input-element:dom-input-step>step</a>;
  22135. attribute DOMString <a href=#dom-input-type id=the-input-element:dom-input-type>type</a>;
  22136. attribute DOMString <a href=#dom-input-defaultvalue id=the-input-element:dom-input-defaultvalue>defaultValue</a>;
  22137. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-input-value id=the-input-element:dom-input-value>value</a>;
  22138. 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>;
  22139. attribute unrestricted double <a href=#dom-input-valueasnumber id=the-input-element:dom-input-valueasnumber>valueAsNumber</a>;
  22140. attribute double <a href=#dom-input-valuelow id=the-input-element:dom-input-valuelow>valueLow</a>;
  22141. attribute double <a href=#dom-input-valuehigh id=the-input-element:dom-input-valuehigh>valueHigh</a>;
  22142. attribute unsigned long <a href=#dom-input-width id=the-input-element:dom-input-width>width</a>;
  22143. void <a href=#dom-input-stepup id=the-input-element:dom-input-stepup>stepUp</a>(optional long n = 1);
  22144. void <a href=#dom-input-stepdown id=the-input-element:dom-input-stepdown>stepDown</a>(optional long n = 1);
  22145. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-input-element:dom-cva-willvalidate>willValidate</a>;
  22146. 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>;
  22147. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-input-element:dom-cva-validationmessage>validationMessage</a>;
  22148. boolean <a href=#dom-cva-checkvalidity id=the-input-element:dom-cva-checkvalidity>checkValidity</a>();
  22149. boolean <a href=#dom-cva-reportvalidity id=the-input-element:dom-cva-reportvalidity>reportValidity</a>();
  22150. void <a href=#dom-cva-setcustomvalidity id=the-input-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  22151. 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>;
  22152. void <a href=#dom-textarea/input-select id=the-input-element:dom-textarea/input-select>select</a>();
  22153. attribute unsigned long <a href=#dom-textarea/input-selectionstart id=the-input-element:dom-textarea/input-selectionstart>selectionStart</a>;
  22154. attribute unsigned long <a href=#dom-textarea/input-selectionend id=the-input-element:dom-textarea/input-selectionend>selectionEnd</a>;
  22155. attribute DOMString <a href=#dom-textarea/input-selectiondirection id=the-input-element:dom-textarea/input-selectiondirection>selectionDirection</a>;
  22156. void <a href=#dom-textarea/input-setrangetext id=the-input-element:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
  22157. 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");
  22158. 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);
  22159. // <a href="#HTMLInputElement-partial">also has obsolete members</a>
  22160. };</pre>
  22161. </dl>
  22162. <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
  22163. control to allow the user to edit the data.</p>
  22164. <p>The <dfn id=attr-input-type><code>type</code></dfn> attribute controls the data type (and
  22165. associated control) of the element. It is an <a href=#enumerated-attribute id=the-input-element:enumerated-attribute>enumerated attribute</a>. The following
  22166. table lists the keywords and states for the attribute — the keywords in the left column map
  22167. to the states in the cell in the second column on the same row as the keyword.</p>
  22168. <table id=attr-input-type-keywords><thead><tr><th> Keyword
  22169. <th> State
  22170. <th> Data type
  22171. <th> Control type
  22172. <tbody><tr><td> <dfn id=attr-input-type-hidden-keyword><code>hidden</code></dfn>
  22173. <td> <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-5">Hidden</a>
  22174. <td> An arbitrary string
  22175. <td> n/a
  22176. <tr><td> <dfn id=attr-input-type-text-keyword><code>text</code></dfn>
  22177. <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>
  22178. <td> Text with no line breaks
  22179. <td> A text field
  22180. <tr><td> <dfn id=attr-input-type-search-keyword><code>search</code></dfn>
  22181. <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>
  22182. <td> Text with no line breaks
  22183. <td> Search field
  22184. <tr><td> <dfn id=attr-input-type-tel-keyword><code>tel</code></dfn>
  22185. <td> <a href="#telephone-state-(type=tel)" id="the-input-element:telephone-state-(type=tel)">Telephone</a>
  22186. <td> Text with no line breaks
  22187. <td> A text field
  22188. <tr><td> <dfn id=attr-input-type-url-keyword><code>url</code></dfn>
  22189. <td> <a href="#url-state-(type=url)" id="the-input-element:url-state-(type=url)">URL</a>
  22190. <td> An absolute URL
  22191. <td> A text field
  22192. <tr><td> <dfn id=attr-input-type-email-keyword><code>email</code></dfn>
  22193. <td> <a href="#e-mail-state-(type=email)" id="the-input-element:e-mail-state-(type=email)">E-mail</a>
  22194. <td> An e-mail address or list of e-mail addresses
  22195. <td> A text field
  22196. <tr><td> <dfn id=attr-input-type-password-keyword><code>password</code></dfn>
  22197. <td> <a href="#password-state-(type=password)" id="the-input-element:password-state-(type=password)">Password</a>
  22198. <td> Text with no line breaks (sensitive information)
  22199. <td> A text field that obscures data entry
  22200. <tr><td> <dfn id=attr-input-type-datetime-keyword><code>datetime</code></dfn>
  22201. <td> <a href="#date-and-time-state-(type=datetime)" id="the-input-element:date-and-time-state-(type=datetime)">Date and Time</a>
  22202. <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with the time zone set to UTC
  22203. <td> A date and time control
  22204. <tr><td> <dfn id=attr-input-type-date-keyword><code>date</code></dfn>
  22205. <td> <a href="#date-state-(type=date)" id="the-input-element:date-state-(type=date)">Date</a>
  22206. <td> A date (year, month, day) with no time zone
  22207. <td> A date control
  22208. <tr><td> <dfn id=attr-input-type-month-keyword><code>month</code></dfn>
  22209. <td> <a href="#month-state-(type=month)" id="the-input-element:month-state-(type=month)">Month</a>
  22210. <td> A date consisting of a year and a month with no time zone
  22211. <td> A month control
  22212. <tr><td> <dfn id=attr-input-type-week-keyword><code>week</code></dfn>
  22213. <td> <a href="#week-state-(type=week)" id="the-input-element:week-state-(type=week)">Week</a>
  22214. <td> A date consisting of a week-year number and a week number with no time zone
  22215. <td> A week control
  22216. <tr><td> <dfn id=attr-input-type-time-keyword><code>time</code></dfn>
  22217. <td> <a href="#time-state-(type=time)" id="the-input-element:time-state-(type=time)">Time</a>
  22218. <td> A time (hour, minute, seconds, fractional seconds) with no time zone
  22219. <td> A time control
  22220. <tr><td> <dfn id=attr-input-type-datetime-local-keyword><code>datetime-local</code></dfn>
  22221. <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>
  22222. <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone
  22223. <td> A date and time control
  22224. <tr><td> <dfn id=attr-input-type-number-keyword><code>number</code></dfn>
  22225. <td> <a href="#number-state-(type=number)" id="the-input-element:number-state-(type=number)">Number</a>
  22226. <td> A numerical value
  22227. <td> A text field or spinner control
  22228. <tr><td> <dfn id=attr-input-type-range-keyword><code>range</code></dfn>
  22229. <td> <a href="#range-state-(type=range)" id="the-input-element:range-state-(type=range)">Range</a>
  22230. <td> A numerical value, with the extra semantic that the exact value is not important
  22231. <td> A slider control or similar
  22232. <tr><td> <dfn id=attr-input-type-color-keyword><code>color</code></dfn>
  22233. <td> <a href="#colour-state-(type=color)" id="the-input-element:colour-state-(type=color)">Colour</a>
  22234. <td> An sRGB colour with 8-bit red, green, and blue components
  22235. <td> A colour well
  22236. <tr><td> <dfn id=attr-input-type-checkbox-keyword><code>checkbox</code></dfn>
  22237. <td> <a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)">Checkbox</a>
  22238. <td> A set of zero or more values from a predefined list
  22239. <td> A checkbox
  22240. <tr><td> <dfn id=attr-input-type-radio-keyword><code>radio</code></dfn>
  22241. <td> <a href="#radio-button-state-(type=radio)" id="the-input-element:radio-button-state-(type=radio)">Radio Button</a>
  22242. <td> An enumerated value
  22243. <td> A radio button
  22244. <tr><td> <dfn id=attr-input-type-file-keyword><code>file</code></dfn>
  22245. <td> <a href="#file-upload-state-(type=file)" id="the-input-element:file-upload-state-(type=file)-2">File Upload</a>
  22246. <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
  22247. <td> A label and a button
  22248. <tr><td> <dfn id=attr-input-type-submit-keyword><code>submit</code></dfn>
  22249. <td> <a href="#submit-button-state-(type=submit)" id="the-input-element:submit-button-state-(type=submit)">Submit Button</a>
  22250. <td> An enumerated value, with the extra semantic that it must be the last value selected and initiates form submission
  22251. <td> A button
  22252. <tr><td> <dfn id=attr-input-type-image-keyword><code>image</code></dfn>
  22253. <td> <a href="#image-button-state-(type=image)" id="the-input-element:image-button-state-(type=image)">Image Button</a>
  22254. <td> A coordinate, relative to a particular image's size, with the extra semantic that it must
  22255. be the last value selected and initiates form submission
  22256. <td> Either a clickable image, or a button
  22257. <tr><td> <dfn id=attr-input-type-reset-keyword><code>reset</code></dfn>
  22258. <td> <a href="#reset-button-state-(type=reset)" id="the-input-element:reset-button-state-(type=reset)">Reset Button</a>
  22259. <td> n/a
  22260. <td> A button
  22261. <tr><td> <dfn id=attr-input-type-button-keyword><code>button</code></dfn>
  22262. <td> <a href="#button-state-(type=button)" id="the-input-element:button-state-(type=button)">Button</a>
  22263. <td> n/a
  22264. <td> A button
  22265. </table>
  22266. <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>
  22267. state.</p>
  22268. <p>Which of the
  22269. <code id=the-input-element:attr-input-accept-2><a href=#attr-input-accept>accept</a></code>,
  22270. <code id=the-input-element:attr-input-alt-2><a href=#attr-input-alt>alt</a></code>,
  22271. <code id=the-input-element:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  22272. <code id=the-input-element:attr-input-checked-2><a href=#attr-input-checked>checked</a></code>,
  22273. <code id=the-input-element:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code>,
  22274. <code id=the-input-element:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code>,
  22275. <code id=the-input-element:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>,
  22276. <code id=the-input-element:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code>,
  22277. <code id=the-input-element:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  22278. <code id=the-input-element:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code>,
  22279. <code id=the-input-element:attr-dim-height-2><a href=#attr-dim-height>height</a></code>,
  22280. <code id=the-input-element:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code>,
  22281. <code id=the-input-element:attr-input-list-2><a href=#attr-input-list>list</a></code>,
  22282. <code id=the-input-element:attr-input-max-2><a href=#attr-input-max>max</a></code>,
  22283. <code id=the-input-element:attr-input-maxlength-2><a href=#attr-input-maxlength>maxlength</a></code>,
  22284. <code id=the-input-element:attr-input-min-2><a href=#attr-input-min>min</a></code>,
  22285. <code id=the-input-element:attr-input-minlength-2><a href=#attr-input-minlength>minlength</a></code>,
  22286. <code id=the-input-element:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code>,
  22287. <code id=the-input-element:attr-input-pattern-3><a href=#attr-input-pattern>pattern</a></code>,
  22288. <code id=the-input-element:attr-input-placeholder-2><a href=#attr-input-placeholder>placeholder</a></code>,
  22289. <code id=the-input-element:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code>,
  22290. <code id=the-input-element:attr-input-required-2><a href=#attr-input-required>required</a></code>,
  22291. <code id=the-input-element:attr-input-size-2><a href=#attr-input-size>size</a></code>,
  22292. <code id=the-input-element:attr-input-src-2><a href=#attr-input-src>src</a></code>,
  22293. <code id=the-input-element:attr-input-step-2><a href=#attr-input-step>step</a></code>, and
  22294. <code id=the-input-element:attr-dim-width-2><a href=#attr-dim-width>width</a></code> content attributes, the
  22295. <code id=the-input-element:dom-input-checked-2><a href=#dom-input-checked>checked</a></code>,
  22296. <code id=the-input-element:dom-input-files-2><a href=#dom-input-files>files</a></code>,
  22297. <code id=the-input-element:dom-input-valueasdate-2><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  22298. <code id=the-input-element:dom-input-valueasnumber-2><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  22299. <code id=the-input-element:dom-input-valuelow-2><a href=#dom-input-valuelow>valueLow</a></code>,
  22300. <code id=the-input-element:dom-input-valuehigh-2><a href=#dom-input-valuehigh>valueHigh</a></code>, and
  22301. <code id=the-input-element:dom-input-list-2><a href=#dom-input-list>list</a></code> IDL attributes, the
  22302. <code id=the-input-element:dom-textarea/input-select-2><a href=#dom-textarea/input-select>select()</a></code> method, the
  22303. <code id=the-input-element:dom-textarea/input-selectionstart-2><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  22304. <code id=the-input-element:dom-textarea/input-selectionend-2><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
  22305. <code id=the-input-element:dom-textarea/input-selectiondirection-2><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, IDL attributes, the
  22306. <code id=the-input-element:dom-textarea/input-setrangetext-3><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code> and
  22307. <code id=the-input-element:dom-textarea/input-setselectionrange-2><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods, the
  22308. <code id=the-input-element:dom-input-stepup-2><a href=#dom-input-stepup>stepUp()</a></code> and
  22309. <code id=the-input-element:dom-input-stepdown-2><a href=#dom-input-stepdown>stepDown()</a></code> methods, and the
  22310. <code id=the-input-element:event-input-input><a href=#event-input-input>input</a></code> and
  22311. <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
  22312. <code id=the-input-element:the-input-element-2><a href=#the-input-element>input</a></code> element depends on the state of its
  22313. <code id=the-input-element:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute.
  22314. The subsections that define each type also clearly define in normative "bookkeeping" sections
  22315. which of these feature apply, and which <dfn id=do-not-apply>do not apply</dfn>, to each type. The behavior of
  22316. these features depends on whether they apply or not, as defined in their various sections (q.v.
  22317. 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>
  22318. <p>The following table is non-normative and summarizes which of those
  22319. 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>
  22320. <table id=input-type-attr-summary class=applies><thead><tr><th>
  22321. <th> <span><a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-6">Hidden</a></span>
  22322. <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>
  22323. <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>
  22324. <th> <span><a href="#url-state-(type=url)" id="the-input-element:url-state-(type=url)-2">URL</a>,</span>
  22325. <span><a href="#telephone-state-(type=tel)" id="the-input-element:telephone-state-(type=tel)-2">Telephone</a></span>
  22326. <th> <span><a href="#e-mail-state-(type=email)" id="the-input-element:e-mail-state-(type=email)-2">E-mail</a></span>
  22327. <th> <span><a href="#password-state-(type=password)" id="the-input-element:password-state-(type=password)-2">Password</a></span>
  22328. <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>
  22329. <span><a href="#date-state-(type=date)" id="the-input-element:date-state-(type=date)-2">Date</a>,</span>
  22330. <span><a href="#month-state-(type=month)" id="the-input-element:month-state-(type=month)-2">Month</a>,</span>
  22331. <span><a href="#week-state-(type=week)" id="the-input-element:week-state-(type=week)-2">Week</a>,</span>
  22332. <span><a href="#time-state-(type=time)" id="the-input-element:time-state-(type=time)-2">Time</a></span>
  22333. <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>
  22334. <th> <span><a href="#number-state-(type=number)" id="the-input-element:number-state-(type=number)-2">Number</a></span>
  22335. <th> <span><a href="#range-state-(type=range)" id="the-input-element:range-state-(type=range)-2">Range</a></span>
  22336. <th> <span><a href="#colour-state-(type=color)" id="the-input-element:colour-state-(type=color)-2">Colour</a></span>
  22337. <th> <span><a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)-2">Checkbox</a>,</span>
  22338. <span><a href="#radio-button-state-(type=radio)" id="the-input-element:radio-button-state-(type=radio)-2">Radio Button</a></span>
  22339. <th> <span><a href="#file-upload-state-(type=file)" id="the-input-element:file-upload-state-(type=file)-3">File Upload</a></span>
  22340. <th> <span><a href="#submit-button-state-(type=submit)" id="the-input-element:submit-button-state-(type=submit)-2">Submit Button</a></span>
  22341. <th> <span><a href="#image-button-state-(type=image)" id="the-input-element:image-button-state-(type=image)-2">Image Button</a></span>
  22342. <th> <span><a href="#reset-button-state-(type=reset)" id="the-input-element:reset-button-state-(type=reset)-2">Reset Button</a>,</span>
  22343. <span><a href="#button-state-(type=button)" id="the-input-element:button-state-(type=button)-2">Button</a></span>
  22344. <tbody><tr><th colspan=16 scope=rowgroup>Content attributes
  22345. <tr><th> <code id=the-input-element:attr-input-accept-3><a href=#attr-input-accept>accept</a></code>
  22346. <td class=no> ·
  22347. <td class=no> ·
  22348. <td class=no> ·
  22349. <td class=no> ·
  22350. <td class=no> ·
  22351. <td class=no> ·
  22352. <td class=no> ·
  22353. <td class=no> ·
  22354. <td class=no> ·
  22355. <td class=no> ·
  22356. <td class=no> ·
  22357. <td class=yes> Yes
  22358. <td class=no> ·
  22359. <td class=no> ·
  22360. <td class=no> ·
  22361. <tr><th> <code id=the-input-element:attr-input-alt-3><a href=#attr-input-alt>alt</a></code>
  22362. <td class=no> ·
  22363. <td class=no> ·
  22364. <td class=no> ·
  22365. <td class=no> ·
  22366. <td class=no> ·
  22367. <td class=no> ·
  22368. <td class=no> ·
  22369. <td class=no> ·
  22370. <td class=no> ·
  22371. <td class=no> ·
  22372. <td class=no> ·
  22373. <td class=no> ·
  22374. <td class=no> ·
  22375. <td class=yes> Yes
  22376. <td class=no> ·
  22377. <tr><th> <code id=the-input-element:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code>
  22378. <td class=yes> Yes
  22379. <td class=yes> Yes
  22380. <td class=yes> Yes
  22381. <td class=yes> Yes
  22382. <td class=yes> Yes
  22383. <td class=yes> Yes
  22384. <td class=yes> Yes
  22385. <td class=yes> Yes
  22386. <td class=yes> Yes
  22387. <td class=yes> Yes
  22388. <td class=no> ·
  22389. <td class=no> ·
  22390. <td class=no> ·
  22391. <td class=no> ·
  22392. <td class=no> ·
  22393. <tr><th> <code id=the-input-element:attr-input-checked-3><a href=#attr-input-checked>checked</a></code>
  22394. <td class=no> ·
  22395. <td class=no> ·
  22396. <td class=no> ·
  22397. <td class=no> ·
  22398. <td class=no> ·
  22399. <td class=no> ·
  22400. <td class=no> ·
  22401. <td class=no> ·
  22402. <td class=no> ·
  22403. <td class=no> ·
  22404. <td class=yes> Yes
  22405. <td class=no> ·
  22406. <td class=no> ·
  22407. <td class=no> ·
  22408. <td class=no> ·
  22409. <tr><th> <code id=the-input-element:attr-fe-dirname-3><a href=#attr-fe-dirname>dirname</a></code>
  22410. <td class=no> ·
  22411. <td class=yes> Yes
  22412. <td class=no> ·
  22413. <td class=no> ·
  22414. <td class=no> ·
  22415. <td class=no> ·
  22416. <td class=no> ·
  22417. <td class=no> ·
  22418. <td class=no> ·
  22419. <td class=no> ·
  22420. <td class=no> ·
  22421. <td class=no> ·
  22422. <td class=no> ·
  22423. <td class=no> ·
  22424. <td class=no> ·
  22425. <tr><th> <code id=the-input-element:attr-fs-formaction-3><a href=#attr-fs-formaction>formaction</a></code>
  22426. <td class=no> ·
  22427. <td class=no> ·
  22428. <td class=no> ·
  22429. <td class=no> ·
  22430. <td class=no> ·
  22431. <td class=no> ·
  22432. <td class=no> ·
  22433. <td class=no> ·
  22434. <td class=no> ·
  22435. <td class=no> ·
  22436. <td class=no> ·
  22437. <td class=no> ·
  22438. <td class=yes> Yes
  22439. <td class=yes> Yes
  22440. <td class=no> ·
  22441. <tr><th> <code id=the-input-element:attr-fs-formenctype-3><a href=#attr-fs-formenctype>formenctype</a></code>
  22442. <td class=no> ·
  22443. <td class=no> ·
  22444. <td class=no> ·
  22445. <td class=no> ·
  22446. <td class=no> ·
  22447. <td class=no> ·
  22448. <td class=no> ·
  22449. <td class=no> ·
  22450. <td class=no> ·
  22451. <td class=no> ·
  22452. <td class=no> ·
  22453. <td class=no> ·
  22454. <td class=yes> Yes
  22455. <td class=yes> Yes
  22456. <td class=no> ·
  22457. <tr><th> <code id=the-input-element:attr-fs-formmethod-3><a href=#attr-fs-formmethod>formmethod</a></code>
  22458. <td class=no> ·
  22459. <td class=no> ·
  22460. <td class=no> ·
  22461. <td class=no> ·
  22462. <td class=no> ·
  22463. <td class=no> ·
  22464. <td class=no> ·
  22465. <td class=no> ·
  22466. <td class=no> ·
  22467. <td class=no> ·
  22468. <td class=no> ·
  22469. <td class=no> ·
  22470. <td class=yes> Yes
  22471. <td class=yes> Yes
  22472. <td class=no> ·
  22473. <tr><th> <code id=the-input-element:attr-fs-formnovalidate-3><a href=#attr-fs-formnovalidate>formnovalidate</a></code>
  22474. <td class=no> ·
  22475. <td class=no> ·
  22476. <td class=no> ·
  22477. <td class=no> ·
  22478. <td class=no> ·
  22479. <td class=no> ·
  22480. <td class=no> ·
  22481. <td class=no> ·
  22482. <td class=no> ·
  22483. <td class=no> ·
  22484. <td class=no> ·
  22485. <td class=no> ·
  22486. <td class=yes> Yes
  22487. <td class=yes> Yes
  22488. <td class=no> ·
  22489. <tr><th> <code id=the-input-element:attr-fs-formtarget-3><a href=#attr-fs-formtarget>formtarget</a></code>
  22490. <td class=no> ·
  22491. <td class=no> ·
  22492. <td class=no> ·
  22493. <td class=no> ·
  22494. <td class=no> ·
  22495. <td class=no> ·
  22496. <td class=no> ·
  22497. <td class=no> ·
  22498. <td class=no> ·
  22499. <td class=no> ·
  22500. <td class=no> ·
  22501. <td class=no> ·
  22502. <td class=yes> Yes
  22503. <td class=yes> Yes
  22504. <td class=no> ·
  22505. <tr><th> <code id=the-input-element:attr-dim-height-3><a href=#attr-dim-height>height</a></code>
  22506. <td class=no> ·
  22507. <td class=no> ·
  22508. <td class=no> ·
  22509. <td class=no> ·
  22510. <td class=no> ·
  22511. <td class=no> ·
  22512. <td class=no> ·
  22513. <td class=no> ·
  22514. <td class=no> ·
  22515. <td class=no> ·
  22516. <td class=no> ·
  22517. <td class=no> ·
  22518. <td class=no> ·
  22519. <td class=yes> Yes
  22520. <td class=no> ·
  22521. <tr><th> <code id=the-input-element:attr-fe-inputmode-3><a href=#attr-fe-inputmode>inputmode</a></code>
  22522. <td class=no> ·
  22523. <td class=yes> Yes
  22524. <td class=no> ·
  22525. <td class=no> ·
  22526. <td class=yes> Yes
  22527. <td class=no> ·
  22528. <td class=no> ·
  22529. <td class=no> ·
  22530. <td class=no> ·
  22531. <td class=no> ·
  22532. <td class=no> ·
  22533. <td class=no> ·
  22534. <td class=no> ·
  22535. <td class=no> ·
  22536. <td class=no> ·
  22537. <tr><th> <code id=the-input-element:attr-input-list-3><a href=#attr-input-list>list</a></code>
  22538. <td class=no> ·
  22539. <td class=yes> Yes
  22540. <td class=yes> Yes
  22541. <td class=yes> Yes
  22542. <td class=no> ·
  22543. <td class=yes> Yes
  22544. <td class=yes> Yes
  22545. <td class=yes> Yes
  22546. <td class=yes> Yes
  22547. <td class=yes> Yes
  22548. <td class=no> ·
  22549. <td class=no> ·
  22550. <td class=no> ·
  22551. <td class=no> ·
  22552. <td class=no> ·
  22553. <tr><th> <code id=the-input-element:attr-input-max-3><a href=#attr-input-max>max</a></code>
  22554. <td class=no> ·
  22555. <td class=no> ·
  22556. <td class=no> ·
  22557. <td class=no> ·
  22558. <td class=no> ·
  22559. <td class=yes> Yes
  22560. <td class=yes> Yes
  22561. <td class=yes> Yes
  22562. <td class=yes> Yes
  22563. <td class=no> ·
  22564. <td class=no> ·
  22565. <td class=no> ·
  22566. <td class=no> ·
  22567. <td class=no> ·
  22568. <td class=no> ·
  22569. <tr><th> <code id=the-input-element:attr-input-maxlength-3><a href=#attr-input-maxlength>maxlength</a></code>
  22570. <td class=no> ·
  22571. <td class=yes> Yes
  22572. <td class=yes> Yes
  22573. <td class=yes> Yes
  22574. <td class=yes> Yes
  22575. <td class=no> ·
  22576. <td class=no> ·
  22577. <td class=no> ·
  22578. <td class=no> ·
  22579. <td class=no> ·
  22580. <td class=no> ·
  22581. <td class=no> ·
  22582. <td class=no> ·
  22583. <td class=no> ·
  22584. <td class=no> ·
  22585. <tr><th> <code id=the-input-element:attr-input-min-3><a href=#attr-input-min>min</a></code>
  22586. <td class=no> ·
  22587. <td class=no> ·
  22588. <td class=no> ·
  22589. <td class=no> ·
  22590. <td class=no> ·
  22591. <td class=yes> Yes
  22592. <td class=yes> Yes
  22593. <td class=yes> Yes
  22594. <td class=yes> Yes
  22595. <td class=no> ·
  22596. <td class=no> ·
  22597. <td class=no> ·
  22598. <td class=no> ·
  22599. <td class=no> ·
  22600. <td class=no> ·
  22601. <tr><th> <code id=the-input-element:attr-input-minlength-3><a href=#attr-input-minlength>minlength</a></code>
  22602. <td class=no> ·
  22603. <td class=yes> Yes
  22604. <td class=yes> Yes
  22605. <td class=yes> Yes
  22606. <td class=yes> Yes
  22607. <td class=no> ·
  22608. <td class=no> ·
  22609. <td class=no> ·
  22610. <td class=no> ·
  22611. <td class=no> ·
  22612. <td class=no> ·
  22613. <td class=no> ·
  22614. <td class=no> ·
  22615. <td class=no> ·
  22616. <td class=no> ·
  22617. <tr><th> <code id=the-input-element:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code>
  22618. <td class=no> ·
  22619. <td class=no> ·
  22620. <td class=no> ·
  22621. <td class=yes> Yes
  22622. <td class=no> ·
  22623. <td class=no> ·
  22624. <td class=no> ·
  22625. <td class=no> ·
  22626. <td class=yes> Yes
  22627. <td class=no> ·
  22628. <td class=no> ·
  22629. <td class=yes> Yes
  22630. <td class=no> ·
  22631. <td class=no> ·
  22632. <td class=no> ·
  22633. <tr><th> <code id=the-input-element:attr-input-pattern-4><a href=#attr-input-pattern>pattern</a></code>
  22634. <td class=no> ·
  22635. <td class=yes> Yes
  22636. <td class=yes> Yes
  22637. <td class=yes> Yes
  22638. <td class=yes> Yes
  22639. <td class=no> ·
  22640. <td class=no> ·
  22641. <td class=no> ·
  22642. <td class=no> ·
  22643. <td class=no> ·
  22644. <td class=no> ·
  22645. <td class=no> ·
  22646. <td class=no> ·
  22647. <td class=no> ·
  22648. <td class=no> ·
  22649. <tr><th> <code id=the-input-element:attr-input-placeholder-3><a href=#attr-input-placeholder>placeholder</a></code>
  22650. <td class=no> ·
  22651. <td class=yes> Yes
  22652. <td class=yes> Yes
  22653. <td class=yes> Yes
  22654. <td class=yes> Yes
  22655. <td class=no> ·
  22656. <td class=no> ·
  22657. <td class=yes> Yes
  22658. <td class=no> ·
  22659. <td class=no> ·
  22660. <td class=no> ·
  22661. <td class=no> ·
  22662. <td class=no> ·
  22663. <td class=no> ·
  22664. <td class=no> ·
  22665. <tr><th> <code id=the-input-element:attr-input-readonly-3><a href=#attr-input-readonly>readonly</a></code>
  22666. <td class=no> ·
  22667. <td class=yes> Yes
  22668. <td class=yes> Yes
  22669. <td class=yes> Yes
  22670. <td class=yes> Yes
  22671. <td class=yes> Yes
  22672. <td class=yes> Yes
  22673. <td class=yes> Yes
  22674. <td class=no> ·
  22675. <td class=no> ·
  22676. <td class=no> ·
  22677. <td class=no> ·
  22678. <td class=no> ·
  22679. <td class=no> ·
  22680. <td class=no> ·
  22681. <tr><th> <code id=the-input-element:attr-input-required-3><a href=#attr-input-required>required</a></code>
  22682. <td class=no> ·
  22683. <td class=yes> Yes
  22684. <td class=yes> Yes
  22685. <td class=yes> Yes
  22686. <td class=yes> Yes
  22687. <td class=yes> Yes
  22688. <td class=yes> Yes
  22689. <td class=yes> Yes
  22690. <td class=no> ·
  22691. <td class=no> ·
  22692. <td class=yes> Yes
  22693. <td class=yes> Yes
  22694. <td class=no> ·
  22695. <td class=no> ·
  22696. <td class=no> ·
  22697. <tr><th> <code id=the-input-element:attr-input-size-3><a href=#attr-input-size>size</a></code>
  22698. <td class=no> ·
  22699. <td class=yes> Yes
  22700. <td class=yes> Yes
  22701. <td class=yes> Yes
  22702. <td class=yes> Yes
  22703. <td class=no> ·
  22704. <td class=no> ·
  22705. <td class=no> ·
  22706. <td class=no> ·
  22707. <td class=no> ·
  22708. <td class=no> ·
  22709. <td class=no> ·
  22710. <td class=no> ·
  22711. <td class=no> ·
  22712. <td class=no> ·
  22713. <tr><th> <code id=the-input-element:attr-input-src-3><a href=#attr-input-src>src</a></code>
  22714. <td class=no> ·
  22715. <td class=no> ·
  22716. <td class=no> ·
  22717. <td class=no> ·
  22718. <td class=no> ·
  22719. <td class=no> ·
  22720. <td class=no> ·
  22721. <td class=no> ·
  22722. <td class=no> ·
  22723. <td class=no> ·
  22724. <td class=no> ·
  22725. <td class=no> ·
  22726. <td class=no> ·
  22727. <td class=yes> Yes
  22728. <td class=no> ·
  22729. <tr><th> <code id=the-input-element:attr-input-step-3><a href=#attr-input-step>step</a></code>
  22730. <td class=no> ·
  22731. <td class=no> ·
  22732. <td class=no> ·
  22733. <td class=no> ·
  22734. <td class=no> ·
  22735. <td class=yes> Yes
  22736. <td class=yes> Yes
  22737. <td class=yes> Yes
  22738. <td class=yes> Yes
  22739. <td class=no> ·
  22740. <td class=no> ·
  22741. <td class=no> ·
  22742. <td class=no> ·
  22743. <td class=no> ·
  22744. <td class=no> ·
  22745. <tr><th> <code id=the-input-element:attr-dim-width-3><a href=#attr-dim-width>width</a></code>
  22746. <td class=no> ·
  22747. <td class=no> ·
  22748. <td class=no> ·
  22749. <td class=no> ·
  22750. <td class=no> ·
  22751. <td class=no> ·
  22752. <td class=no> ·
  22753. <td class=no> ·
  22754. <td class=no> ·
  22755. <td class=no> ·
  22756. <td class=no> ·
  22757. <td class=no> ·
  22758. <td class=no> ·
  22759. <td class=yes> Yes
  22760. <td class=no> ·
  22761. <tbody><tr><th colspan=16 scope=rowgroup>IDL attributes and methods
  22762. <tr><th> <code id=the-input-element:dom-input-checked-3><a href=#dom-input-checked>checked</a></code>
  22763. <td class=no> ·
  22764. <td class=no> ·
  22765. <td class=no> ·
  22766. <td class=no> ·
  22767. <td class=no> ·
  22768. <td class=no> ·
  22769. <td class=no> ·
  22770. <td class=no> ·
  22771. <td class=no> ·
  22772. <td class=no> ·
  22773. <td class=yes> Yes
  22774. <td class=no> ·
  22775. <td class=no> ·
  22776. <td class=no> ·
  22777. <td class=no> ·
  22778. <tr><th> <code id=the-input-element:dom-input-files-3><a href=#dom-input-files>files</a></code>
  22779. <td class=no> ·
  22780. <td class=no> ·
  22781. <td class=no> ·
  22782. <td class=no> ·
  22783. <td class=no> ·
  22784. <td class=no> ·
  22785. <td class=no> ·
  22786. <td class=no> ·
  22787. <td class=no> ·
  22788. <td class=no> ·
  22789. <td class=no> ·
  22790. <td class=yes> Yes
  22791. <td class=no> ·
  22792. <td class=no> ·
  22793. <td class=no> ·
  22794. <tr><th> <code id=the-input-element:dom-input-value-2><a href=#dom-input-value>value</a></code>
  22795. <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default>default</a>
  22796. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value>value</a>
  22797. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-2>value</a>
  22798. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-3>value</a>
  22799. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-4>value</a>
  22800. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-5>value</a>
  22801. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-6>value</a>
  22802. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-7>value</a>
  22803. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-8>value</a>
  22804. <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-9>value</a>
  22805. <td class=yes> <a href=#dom-input-value-default-on id=the-input-element:dom-input-value-default-on>default/on</a>
  22806. <td class=yes> <a href=#dom-input-value-filename id=the-input-element:dom-input-value-filename>filename</a>
  22807. <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-2>default</a>
  22808. <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-3>default</a>
  22809. <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-4>default</a>
  22810. <tr><th> <code id=the-input-element:dom-input-valueasdate-3><a href=#dom-input-valueasdate>valueAsDate</a></code>
  22811. <td class=no> ·
  22812. <td class=no> ·
  22813. <td class=no> ·
  22814. <td class=no> ·
  22815. <td class=no> ·
  22816. <td class=yes> Yes
  22817. <td class=no> ·
  22818. <td class=no> ·
  22819. <td class=no> ·
  22820. <td class=no> ·
  22821. <td class=no> ·
  22822. <td class=no> ·
  22823. <td class=no> ·
  22824. <td class=no> ·
  22825. <td class=no> ·
  22826. <tr><th> <code id=the-input-element:dom-input-valueasnumber-3><a href=#dom-input-valueasnumber>valueAsNumber</a></code>
  22827. <td class=no> ·
  22828. <td class=no> ·
  22829. <td class=no> ·
  22830. <td class=no> ·
  22831. <td class=no> ·
  22832. <td class=yes> Yes
  22833. <td class=yes> Yes
  22834. <td class=yes> Yes
  22835. <td class=yes> Yes*
  22836. <td class=no> ·
  22837. <td class=no> ·
  22838. <td class=no> ·
  22839. <td class=no> ·
  22840. <td class=no> ·
  22841. <td class=no> ·
  22842. <tr><th> <code id=the-input-element:dom-input-valuelow-3><a href=#dom-input-valuelow>valueLow</a></code>
  22843. <td class=no> ·
  22844. <td class=no> ·
  22845. <td class=no> ·
  22846. <td class=no> ·
  22847. <td class=no> ·
  22848. <td class=no> ·
  22849. <td class=no> ·
  22850. <td class=no> ·
  22851. <td class=yes> Yes**
  22852. <td class=no> ·
  22853. <td class=no> ·
  22854. <td class=no> ·
  22855. <td class=no> ·
  22856. <td class=no> ·
  22857. <td class=no> ·
  22858. <tr><th> <code id=the-input-element:dom-input-valuehigh-3><a href=#dom-input-valuehigh>valueHigh</a></code>
  22859. <td class=no> ·
  22860. <td class=no> ·
  22861. <td class=no> ·
  22862. <td class=no> ·
  22863. <td class=no> ·
  22864. <td class=no> ·
  22865. <td class=no> ·
  22866. <td class=no> ·
  22867. <td class=yes> Yes**
  22868. <td class=no> ·
  22869. <td class=no> ·
  22870. <td class=no> ·
  22871. <td class=no> ·
  22872. <td class=no> ·
  22873. <td class=no> ·
  22874. <tr><th> <code id=the-input-element:dom-input-list-3><a href=#dom-input-list>list</a></code>
  22875. <td class=no> ·
  22876. <td class=yes> Yes
  22877. <td class=yes> Yes
  22878. <td class=yes> Yes
  22879. <td class=no> ·
  22880. <td class=yes> Yes
  22881. <td class=yes> Yes
  22882. <td class=yes> Yes
  22883. <td class=yes> Yes
  22884. <td class=yes> Yes
  22885. <td class=no> ·
  22886. <td class=no> ·
  22887. <td class=no> ·
  22888. <td class=no> ·
  22889. <td class=no> ·
  22890. <tr><th> <code id=the-input-element:dom-textarea/input-select-3><a href=#dom-textarea/input-select>select()</a></code>
  22891. <td class=no> ·
  22892. <td class=yes> Yes
  22893. <td class=yes> Yes
  22894. <td class=no> ·
  22895. <td class=yes> Yes
  22896. <td class=no> ·
  22897. <td class=no> ·
  22898. <td class=no> ·
  22899. <td class=no> ·
  22900. <td class=no> ·
  22901. <td class=no> ·
  22902. <td class=no> ·
  22903. <td class=no> ·
  22904. <td class=no> ·
  22905. <td class=no> ·
  22906. <tr><th> <code id=the-input-element:dom-textarea/input-selectionstart-3><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>
  22907. <td class=no> ·
  22908. <td class=yes> Yes
  22909. <td class=yes> Yes
  22910. <td class=no> ·
  22911. <td class=yes> Yes
  22912. <td class=no> ·
  22913. <td class=no> ·
  22914. <td class=no> ·
  22915. <td class=no> ·
  22916. <td class=no> ·
  22917. <td class=no> ·
  22918. <td class=no> ·
  22919. <td class=no> ·
  22920. <td class=no> ·
  22921. <td class=no> ·
  22922. <tr><th> <code id=the-input-element:dom-textarea/input-selectionend-3><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
  22923. <td class=no> ·
  22924. <td class=yes> Yes
  22925. <td class=yes> Yes
  22926. <td class=no> ·
  22927. <td class=yes> Yes
  22928. <td class=no> ·
  22929. <td class=no> ·
  22930. <td class=no> ·
  22931. <td class=no> ·
  22932. <td class=no> ·
  22933. <td class=no> ·
  22934. <td class=no> ·
  22935. <td class=no> ·
  22936. <td class=no> ·
  22937. <td class=no> ·
  22938. <tr><th> <code id=the-input-element:dom-textarea/input-selectiondirection-3><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
  22939. <td class=no> ·
  22940. <td class=yes> Yes
  22941. <td class=yes> Yes
  22942. <td class=no> ·
  22943. <td class=yes> Yes
  22944. <td class=no> ·
  22945. <td class=no> ·
  22946. <td class=no> ·
  22947. <td class=no> ·
  22948. <td class=no> ·
  22949. <td class=no> ·
  22950. <td class=no> ·
  22951. <td class=no> ·
  22952. <td class=no> ·
  22953. <td class=no> ·
  22954. <tr><th> <code id=the-input-element:dom-textarea/input-setrangetext-4><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>
  22955. <td class=no> ·
  22956. <td class=yes> Yes
  22957. <td class=yes> Yes
  22958. <td class=no> ·
  22959. <td class=yes> Yes
  22960. <td class=no> ·
  22961. <td class=no> ·
  22962. <td class=no> ·
  22963. <td class=no> ·
  22964. <td class=no> ·
  22965. <td class=no> ·
  22966. <td class=no> ·
  22967. <td class=no> ·
  22968. <td class=no> ·
  22969. <td class=no> ·
  22970. <tr><th> <code id=the-input-element:dom-textarea/input-setselectionrange-3><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
  22971. <td class=no> ·
  22972. <td class=yes> Yes
  22973. <td class=yes> Yes
  22974. <td class=no> ·
  22975. <td class=yes> Yes
  22976. <td class=no> ·
  22977. <td class=no> ·
  22978. <td class=no> ·
  22979. <td class=no> ·
  22980. <td class=no> ·
  22981. <td class=no> ·
  22982. <td class=no> ·
  22983. <td class=no> ·
  22984. <td class=no> ·
  22985. <td class=no> ·
  22986. <tr><th> <code id=the-input-element:dom-input-stepdown-3><a href=#dom-input-stepdown>stepDown()</a></code>
  22987. <td class=no> ·
  22988. <td class=no> ·
  22989. <td class=no> ·
  22990. <td class=no> ·
  22991. <td class=no> ·
  22992. <td class=yes> Yes
  22993. <td class=yes> Yes
  22994. <td class=yes> Yes
  22995. <td class=yes> Yes
  22996. <td class=no> ·
  22997. <td class=no> ·
  22998. <td class=no> ·
  22999. <td class=no> ·
  23000. <td class=no> ·
  23001. <td class=no> ·
  23002. <tr><th> <code id=the-input-element:dom-input-stepup-3><a href=#dom-input-stepup>stepUp()</a></code>
  23003. <td class=no> ·
  23004. <td class=no> ·
  23005. <td class=no> ·
  23006. <td class=no> ·
  23007. <td class=no> ·
  23008. <td class=yes> Yes
  23009. <td class=yes> Yes
  23010. <td class=yes> Yes
  23011. <td class=yes> Yes
  23012. <td class=no> ·
  23013. <td class=no> ·
  23014. <td class=no> ·
  23015. <td class=no> ·
  23016. <td class=no> ·
  23017. <td class=no> ·
  23018. <tbody><tr><th colspan=16 scope=rowgroup>Events
  23019. <tr><th> <span><code id=the-input-element:event-input-input-2><a href=#event-input-input>input</a></code> event</span>
  23020. <td class=no> ·
  23021. <td class=yes> Yes
  23022. <td class=yes> Yes
  23023. <td class=yes> Yes
  23024. <td class=yes> Yes
  23025. <td class=yes> Yes
  23026. <td class=yes> Yes
  23027. <td class=yes> Yes
  23028. <td class=yes> Yes
  23029. <td class=yes> Yes
  23030. <td class=yes> Yes
  23031. <td class=yes> Yes
  23032. <td class=no> ·
  23033. <td class=no> ·
  23034. <td class=no> ·
  23035. <tr><th> <span><code id=the-input-element:event-input-change-2><a href=#event-input-change>change</a></code> event</span>
  23036. <td class=no> ·
  23037. <td class=yes> Yes
  23038. <td class=yes> Yes
  23039. <td class=yes> Yes
  23040. <td class=yes> Yes
  23041. <td class=yes> Yes
  23042. <td class=yes> Yes
  23043. <td class=yes> Yes
  23044. <td class=yes> Yes
  23045. <td class=yes> Yes
  23046. <td class=yes> Yes
  23047. <td class=yes> Yes
  23048. <td class=no> ·
  23049. <td class=no> ·
  23050. <td class=no> ·
  23051. </table>
  23052. <p class=tablenote><small>* If the <code id=the-input-element:attr-input-multiple-4><a href=#attr-input-multiple>multiple</a></code> attribute
  23053. is not specified.</small></p>
  23054. <p class=tablenote><small>** If the <code id=the-input-element:attr-input-multiple-5><a href=#attr-input-multiple>multiple</a></code> attribute
  23055. <em>is</em> specified.</small></p>
  23056. <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
  23057. sanitization algorithm</dfn>.</p>
  23058. <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
  23059. 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
  23060. <dfn id=concept-input-value-string-number>algorithm to convert a string to a number</dfn>,
  23061. an <dfn id=concept-input-value-number-string>algorithm to convert a number to a
  23062. string</dfn>, an <dfn id=concept-input-value-string-date>algorithm to convert a string to a
  23063. <code>Date</code> object</dfn>, and an <dfn id=concept-input-value-date-string>algorithm to
  23064. 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>,
  23065. <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>,
  23066. <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>
  23067. <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
  23068. 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
  23069. initially set to false when the element is created, and must be set to true whenever the user
  23070. 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>.
  23071. (It is also set to true when the value is programmatically changed, as described in the definition
  23072. of the <code id=the-input-element:dom-input-value-4><a href=#dom-input-value>value</a></code> IDL attribute.)</p>
  23073. <p>The <dfn id=attr-input-value><code>value</code></dfn> content attribute gives the default
  23074. <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,
  23075. 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>
  23076. 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
  23077. 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
  23078. 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
  23079. algorithm</a>, if one is defined.</p>
  23080. <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>,
  23081. 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>
  23082. <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
  23083. element is said to have a <dfn id=concept-input-checked-dirty><i>dirty checkedness</i></dfn>.
  23084. The <a href=#concept-input-checked-dirty-flag id=the-input-element:concept-input-checked-dirty-flag>dirty checkedness flag</a> must be initially
  23085. set to false when the element is created, and must be set to true whenever the user interacts with
  23086. the control in a way that changes the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-2>checkedness</a>.</p>
  23087. <p>The <dfn id=attr-input-checked><code>checked</code></dfn> content attribute is a
  23088. <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,
  23089. 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
  23090. user agent must set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-4>checkedness</a> of the element to
  23091. 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
  23092. 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
  23093. agent must set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-5>checkedness</a> of the element to
  23094. false.</p>
  23095. <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>
  23096. 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
  23097. <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
  23098. 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
  23099. otherwise, set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-6>checkedness</a> of the element to true if
  23100. 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
  23101. it does not, empty the list of <a href=#concept-input-type-file-selected id=the-input-element:concept-input-type-file-selected>selected
  23102. 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>
  23103. <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
  23104. 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
  23105. 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>
  23106. <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>
  23107. <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
  23108. 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
  23109. being <i id=the-input-element:concept-fe-mutable-4><a href=#concept-fe-mutable>mutable</a></i>.</p>
  23110. <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
  23111. 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
  23112. to the copy.</p>
  23113. <hr>
  23114. <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
  23115. 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>
  23116. 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
  23117. <code id=the-input-element:attr-input-type-10><a href=#attr-input-type>type</a></code> attribute's state, must be invoked.</p>
  23118. <div id=input-type-change>
  23119. <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
  23120. changes state, the user agent must run the following steps:</p>
  23121. <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
  23122. 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
  23123. <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>
  23124. 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
  23125. 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
  23126. 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
  23127. 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>
  23128. </div>
  23129. <hr>
  23130. <p>
  23131. The <code id=the-input-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
  23132. 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.
  23133. 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.
  23134. 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>.
  23135. The <code id=the-input-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
  23136. 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.
  23137. 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.
  23138. </p>
  23139. <p>The <dfn id=dom-input-indeterminate><code>indeterminate</code></dfn> IDL attribute must
  23140. initially be set to false. On getting, it must return the last value it was set to. On setting, it
  23141. 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>
  23142. <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>,
  23143. <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>,
  23144. and <dfn id=dom-input-step><code>step</code></dfn> IDL attributes must <a href=#reflect id=the-input-element:reflect>reflect</a>
  23145. 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
  23146. <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
  23147. <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
  23148. <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
  23149. <dfn id=dom-input-defaultvalue><code>defaultValue</code></dfn> IDL attribute must
  23150. <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>
  23151. <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>
  23152. 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
  23153. <dfn id=dom-input-inputmode><code>inputMode</code></dfn> IDL attribute must
  23154. <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,
  23155. <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>
  23156. 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
  23157. 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>
  23158. 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
  23159. non-negative numbers</a>.</p>
  23160. <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
  23161. 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
  23162. visual medium; or else the intrinsic width and height of the image, in CSS pixels, if an image is
  23163. <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,
  23164. 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
  23165. <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>
  23166. <p>On setting, they must act as if they <a href=#reflect id=the-input-element:reflect-10>reflected</a> the respective
  23167. content attributes of the same name.</p>
  23168. <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
  23169. <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
  23170. 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
  23171. 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>
  23172. <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>
  23173. <h6 id="hidden-state-(type=hidden)">4.10.5.1.1 <dfn>Hidden</dfn> state (<code>type=hidden</code>)</h6>
  23174. <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
  23175. 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>
  23176. <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
  23177. examined or manipulated by the user.</p>
  23178. <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
  23179. validation</a>.</p>
  23180. <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
  23181. <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>
  23182. <div class=bookkeeping>
  23183. <p>The
  23184. <code id="hidden-state-(type=hidden):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>
  23185. content attribute <a href=#concept-input-apply id="hidden-state-(type=hidden):concept-input-apply">applies</a> to this element.</p>
  23186. <p>The
  23187. <code id="hidden-state-(type=hidden):dom-input-value"><a href=#dom-input-value>value</a></code>
  23188. IDL attribute <a href=#concept-input-apply id="hidden-state-(type=hidden):concept-input-apply-2">applies</a> to this element and is
  23189. in mode <a href=#dom-input-value-default id="hidden-state-(type=hidden):dom-input-value-default">default</a>.</p>
  23190. <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
  23191. apply</a> to the element:
  23192. <code id="hidden-state-(type=hidden):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23193. <code id="hidden-state-(type=hidden):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23194. <code id="hidden-state-(type=hidden):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23195. <code id="hidden-state-(type=hidden):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23196. <code id="hidden-state-(type=hidden):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23197. <code id="hidden-state-(type=hidden):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23198. <code id="hidden-state-(type=hidden):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23199. <code id="hidden-state-(type=hidden):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23200. <code id="hidden-state-(type=hidden):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23201. <code id="hidden-state-(type=hidden):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23202. <code id="hidden-state-(type=hidden):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23203. <code id="hidden-state-(type=hidden):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  23204. <code id="hidden-state-(type=hidden):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  23205. <code id="hidden-state-(type=hidden):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  23206. <code id="hidden-state-(type=hidden):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  23207. <code id="hidden-state-(type=hidden):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  23208. <code id="hidden-state-(type=hidden):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23209. <code id="hidden-state-(type=hidden):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  23210. <code id="hidden-state-(type=hidden):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  23211. <code id="hidden-state-(type=hidden):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  23212. <code id="hidden-state-(type=hidden):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  23213. <code id="hidden-state-(type=hidden):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  23214. <code id="hidden-state-(type=hidden):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  23215. <code id="hidden-state-(type=hidden):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  23216. <code id="hidden-state-(type=hidden):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23217. <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
  23218. element:
  23219. <code id="hidden-state-(type=hidden):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23220. <code id="hidden-state-(type=hidden):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23221. <code id="hidden-state-(type=hidden):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  23222. <code id="hidden-state-(type=hidden):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23223. <code id="hidden-state-(type=hidden):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23224. <code id="hidden-state-(type=hidden):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  23225. <code id="hidden-state-(type=hidden):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  23226. <code id="hidden-state-(type=hidden):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  23227. <code id="hidden-state-(type=hidden):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23228. <code id="hidden-state-(type=hidden):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23229. <code id="hidden-state-(type=hidden):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  23230. <code id="hidden-state-(type=hidden):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  23231. <code id="hidden-state-(type=hidden):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  23232. <code id="hidden-state-(type=hidden):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  23233. <code id="hidden-state-(type=hidden):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23234. <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>
  23235. </div>
  23236. <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>
  23237. <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
  23238. 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>
  23239. <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
  23240. the element's <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value">value</a>.</p>
  23241. <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
  23242. 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
  23243. 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
  23244. the platform's search fields rather than appearing like a regular text field.</p>
  23245. <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
  23246. users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the element's
  23247. <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value-3">value</a>.</p>
  23248. <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
  23249. user to change the writing direction of the element, setting it either to a left-to-right writing
  23250. direction or a right-to-left writing direction. If the user does so, the user agent must then run
  23251. the following steps:</p>
  23252. <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
  23253. "<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
  23254. 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>
  23255. <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
  23256. contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
  23257. <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
  23258. 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>
  23259. <div class=bookkeeping>
  23260. <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
  23261. 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:
  23262. <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23263. <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-dirname"><a href=#attr-fe-dirname>dirname</a></code>,
  23264. <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-inputmode"><a href=#attr-fe-inputmode>inputmode</a></code>,
  23265. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23266. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
  23267. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
  23268. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
  23269. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  23270. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23271. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23272. <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
  23273. <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23274. <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23275. <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23276. <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
  23277. <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
  23278. <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
  23279. <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
  23280. <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>
  23281. <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
  23282. 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>
  23283. <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>
  23284. <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
  23285. apply</a> to the element:
  23286. <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>,
  23287. <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>,
  23288. <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>,
  23289. <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>,
  23290. <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>,
  23291. <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>,
  23292. <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>,
  23293. <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>,
  23294. <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>,
  23295. <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>,
  23296. <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>,
  23297. <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>,
  23298. <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>,
  23299. <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
  23300. <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>
  23301. <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
  23302. element:
  23303. <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>,
  23304. <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>,
  23305. <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>,
  23306. <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>,
  23307. <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
  23308. <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;
  23309. <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
  23310. <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>
  23311. </div>
  23312. <h6 id="telephone-state-(type=tel)">4.10.5.1.3 <dfn>Telephone</dfn> state (<code>type=tel</code>)</h6>
  23313. <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
  23314. 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>
  23315. <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
  23316. given in the element's <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value">value</a>.</p>
  23317. <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
  23318. 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
  23319. user enters. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE
  23320. RETURN (CR) characters into the element's <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-4">value</a>.</p>
  23321. <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
  23322. contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
  23323. <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
  23324. breaks</a> from the <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-5">value</a>.</p>
  23325. <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
  23326. intentional; in practice, telephone number fields tend to be free-form fields, because there are a
  23327. wide variety of valid phone numbers. Systems that need to enforce a particular format are
  23328. 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
  23329. validation mechanism.</p>
  23330. <div class=bookkeeping>
  23331. <p>The following common <code id="telephone-state-(type=tel):the-input-element-3"><a href=#the-input-element>input</a></code> element content
  23332. attributes, IDL attributes, and methods <a href=#concept-input-apply id="telephone-state-(type=tel):concept-input-apply">apply</a> to the element:
  23333. <code id="telephone-state-(type=tel):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23334. <code id="telephone-state-(type=tel):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23335. <code id="telephone-state-(type=tel):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
  23336. <code id="telephone-state-(type=tel):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
  23337. <code id="telephone-state-(type=tel):attr-input-pattern-2"><a href=#attr-input-pattern>pattern</a></code>,
  23338. <code id="telephone-state-(type=tel):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  23339. <code id="telephone-state-(type=tel):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23340. <code id="telephone-state-(type=tel):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23341. <code id="telephone-state-(type=tel):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
  23342. <code id="telephone-state-(type=tel):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23343. <code id="telephone-state-(type=tel):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23344. <code id="telephone-state-(type=tel):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23345. <code id="telephone-state-(type=tel):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
  23346. <code id="telephone-state-(type=tel):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
  23347. <code id="telephone-state-(type=tel):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
  23348. <code id="telephone-state-(type=tel):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  23349. <code id="telephone-state-(type=tel):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  23350. <p>The <code id="telephone-state-(type=tel):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23351. in mode <a href=#dom-input-value-value id="telephone-state-(type=tel):dom-input-value-value">value</a>.</p>
  23352. <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>
  23353. <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
  23354. apply</a> to the element:
  23355. <code id="telephone-state-(type=tel):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23356. <code id="telephone-state-(type=tel):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23357. <code id="telephone-state-(type=tel):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23358. <code id="telephone-state-(type=tel):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23359. <code id="telephone-state-(type=tel):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23360. <code id="telephone-state-(type=tel):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23361. <code id="telephone-state-(type=tel):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23362. <code id="telephone-state-(type=tel):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23363. <code id="telephone-state-(type=tel):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23364. <code id="telephone-state-(type=tel):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23365. <code id="telephone-state-(type=tel):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23366. <code id="telephone-state-(type=tel):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  23367. <code id="telephone-state-(type=tel):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  23368. <code id="telephone-state-(type=tel):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23369. <code id="telephone-state-(type=tel):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  23370. <code id="telephone-state-(type=tel):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  23371. <code id="telephone-state-(type=tel):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23372. <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
  23373. element:
  23374. <code id="telephone-state-(type=tel):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23375. <code id="telephone-state-(type=tel):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23376. <code id="telephone-state-(type=tel):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  23377. <code id="telephone-state-(type=tel):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  23378. <code id="telephone-state-(type=tel):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23379. <code id="telephone-state-(type=tel):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23380. <code id="telephone-state-(type=tel):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
  23381. <code id="telephone-state-(type=tel):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23382. </div>
  23383. <h6 id="url-state-(type=url)">4.10.5.1.4 <dfn>URL</dfn> state (<code>type=url</code>)</h6>
  23384. <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
  23385. 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>
  23386. <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
  23387. <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>
  23388. <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
  23389. 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
  23390. 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
  23391. 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
  23392. 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>
  23393. <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
  23394. 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
  23395. 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>
  23396. <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
  23397. 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
  23398. <a href=#absolute-url id="url-state-(type=url):absolute-url-4">absolute URL</a>.</p>
  23399. <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
  23400. 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
  23401. trailing whitespace</a> from the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-8">value</a>.</p>
  23402. <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-9">value</a>
  23403. of the element is neither the empty string nor a <a href=#valid-url id="url-state-(type=url):valid-url-3">valid</a>
  23404. <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>
  23405. <div class=bookkeeping>
  23406. <p>The following common <code id="url-state-(type=url):the-input-element-3"><a href=#the-input-element>input</a></code> element content
  23407. attributes, IDL attributes, and methods <a href=#concept-input-apply id="url-state-(type=url):concept-input-apply">apply</a> to the element:
  23408. <code id="url-state-(type=url):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23409. <code id="url-state-(type=url):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23410. <code id="url-state-(type=url):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
  23411. <code id="url-state-(type=url):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
  23412. <code id="url-state-(type=url):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
  23413. <code id="url-state-(type=url):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  23414. <code id="url-state-(type=url):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23415. <code id="url-state-(type=url):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23416. <code id="url-state-(type=url):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
  23417. <code id="url-state-(type=url):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23418. <code id="url-state-(type=url):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23419. <code id="url-state-(type=url):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23420. <code id="url-state-(type=url):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
  23421. <code id="url-state-(type=url):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
  23422. <code id="url-state-(type=url):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
  23423. <code id="url-state-(type=url):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  23424. <code id="url-state-(type=url):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  23425. <p>The <code id="url-state-(type=url):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23426. in mode <a href=#dom-input-value-value id="url-state-(type=url):dom-input-value-value">value</a>.</p>
  23427. <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>
  23428. <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
  23429. apply</a> to the element:
  23430. <code id="url-state-(type=url):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23431. <code id="url-state-(type=url):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23432. <code id="url-state-(type=url):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23433. <code id="url-state-(type=url):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23434. <code id="url-state-(type=url):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23435. <code id="url-state-(type=url):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23436. <code id="url-state-(type=url):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23437. <code id="url-state-(type=url):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23438. <code id="url-state-(type=url):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23439. <code id="url-state-(type=url):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23440. <code id="url-state-(type=url):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23441. <code id="url-state-(type=url):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  23442. <code id="url-state-(type=url):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  23443. <code id="url-state-(type=url):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23444. <code id="url-state-(type=url):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  23445. <code id="url-state-(type=url):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  23446. <code id="url-state-(type=url):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23447. <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
  23448. element:
  23449. <code id="url-state-(type=url):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23450. <code id="url-state-(type=url):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23451. <code id="url-state-(type=url):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  23452. <code id="url-state-(type=url):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  23453. <code id="url-state-(type=url):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23454. <code id="url-state-(type=url):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23455. <code id="url-state-(type=url):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
  23456. <code id="url-state-(type=url):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23457. </div>
  23458. <div class=example>
  23459. <p>If a document contained the following markup:</p>
  23460. <pre>&lt;input type="url" name="location" list="urls">
  23461. &lt;datalist id="urls">
  23462. &lt;option label="MIME: Format of Internet Message Bodies" value="http://tools.ietf.org/html/rfc2045">
  23463. &lt;option label="HTML 4.01 Specification" value="http://www.w3.org/TR/html4/">
  23464. &lt;option label="Form Controls" value="http://www.w3.org/TR/xforms/slice8.html#ui-commonelems-hint">
  23465. &lt;option label="Scalable Vector Graphics (SVG) 1.1 Specification" value="http://www.w3.org/TR/SVG/">
  23466. &lt;option label="Feature Sets - SVG 1.1 - 20030114" value="http://www.w3.org/TR/SVG/feature.html">
  23467. &lt;option label="The Single UNIX Specification, Version 3" value="http://www.unix-systems.org/version3/">
  23468. &lt;/datalist>
  23469. </pre>
  23470. <p>...and the user had typed "<kbd>www.w3</kbd>", and the user agent had also found that the user
  23471. 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
  23472. like this:</p>
  23473. <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 &quot;www.w3&quot; 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>
  23474. <p>The first four URLs in this sample consist of the four URLs in the author-specified list that
  23475. match the text the user has entered, sorted in some UA-defined manner (maybe by how frequently
  23476. the user refers to those URLs). Note how the UA is using the knowledge that the values are URLs
  23477. to allow the user to omit the scheme part and perform intelligent matching on the domain
  23478. name.</p>
  23479. <p>The last two URLs (and probably many more, given the scrollbar's indications of more values
  23480. being available) are the matches from the user agent's session history data. This data is not
  23481. made available to the page DOM. In this particular case, the UA has no titles to provide for
  23482. those values.</p>
  23483. </div>
  23484. <h6 id="e-mail-state-(type=email)">4.10.5.1.5 <dfn>E-mail</dfn> state (<code>type=email</code>)</h6>
  23485. <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
  23486. 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>
  23487. <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
  23488. <code id="e-mail-state-(type=email):attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute is specified or not.</p>
  23489. <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
  23490. element<dd>
  23491. <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
  23492. address given in the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value">value</a>.</p>
  23493. <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
  23494. 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
  23495. address</a>. The user agent should act in a manner consistent with expecting the user to
  23496. 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
  23497. 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
  23498. 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
  23499. vice versa.</p>
  23500. <p><strong>Constraint validation</strong>: While the user interface is representing input that
  23501. 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
  23502. input</a>.</p>
  23503. <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
  23504. 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>
  23505. <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
  23506. 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
  23507. 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>
  23508. <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-10">value</a>
  23509. 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
  23510. 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>
  23511. <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
  23512. the element<dd>
  23513. <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
  23514. 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>
  23515. <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
  23516. 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
  23517. 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
  23518. 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
  23519. individual value to a string containing U+002C COMMA (,), U+000A LINE FEED (LF), or U+000D
  23520. CARRIAGE RETURN (CR) characters. User agents should allow the user to remove all the addresses
  23521. in the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-3">values</a>. User agents may
  23522. transform the <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-4">values</a> for display and editing; in
  23523. 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>
  23524. <p><strong>Constraint validation</strong>: While the user interface describes a situation where
  23525. an individual value contains a U+002C COMMA (,) or is representing input that the user agent
  23526. 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>
  23527. <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
  23528. steps:</p>
  23529. <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
  23530. concatenating all the values in <var>latest values</var>, separating each value from
  23531. the next by a single U+002C COMMA character (,), maintaining the list's order.</ol>
  23532. <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
  23533. 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>
  23534. <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>
  23535. <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
  23536. 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
  23537. (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
  23538. concatenating the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-6">values</a>, separating
  23539. each value from the next by a single U+002C COMMA character (,), maintaining the list's
  23540. order.</ol>
  23541. <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-18">value</a>
  23542. 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
  23543. from a type mismatch</a>.</p>
  23544. </dl>
  23545. <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
  23546. 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>
  23547. <p>A <dfn id=valid-e-mail-address>valid e-mail address</dfn> is a string that matches the <code>email</code>
  23548. production of the following ABNF, the character set for which is Unicode. This ABNF implements the
  23549. 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>
  23550. <pre>email = 1*( atext / "." ) "@" label *( "." label )
  23551. 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>
  23552. atext = &lt; as defined in <a href=http://tools.ietf.org/html/rfc5322#section-3.2.3>RFC 5322 section 3.2.3</a> >
  23553. let-dig = &lt; as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> >
  23554. ldh-str = &lt; as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> ></pre>
  23555. <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
  23556. syntax for e-mail addresses that is simultaneously too strict (before the "@" character), too
  23557. vague (after the "@" character), and too lax (allowing comments, whitespace characters, and quoted
  23558. strings in manners unfamiliar to most users) to be of practical use here.</p>
  23559. <div class=note>
  23560. <p>The following JavaScript- and Perl-compatible regular expression is an implementation of the
  23561. above definition.</p>
  23562. <pre>/^[a-zA-Z0-9.!#$%&amp;'*+/=?^_`{|}~-]+@[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>
  23563. </div>
  23564. <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
  23565. 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
  23566. 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>
  23567. <div class=bookkeeping>
  23568. <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
  23569. attributes, IDL attributes, and methods <a href=#concept-input-apply id="e-mail-state-(type=email):concept-input-apply">apply</a> to the element:
  23570. <code id="e-mail-state-(type=email):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23571. <code id="e-mail-state-(type=email):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23572. <code id="e-mail-state-(type=email):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
  23573. <code id="e-mail-state-(type=email):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
  23574. <code id="e-mail-state-(type=email):attr-input-multiple-5"><a href=#attr-input-multiple>multiple</a></code>,
  23575. <code id="e-mail-state-(type=email):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
  23576. <code id="e-mail-state-(type=email):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  23577. <code id="e-mail-state-(type=email):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23578. <code id="e-mail-state-(type=email):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23579. <code id="e-mail-state-(type=email):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
  23580. <code id="e-mail-state-(type=email):dom-input-list"><a href=#dom-input-list>list</a></code> and
  23581. <code id="e-mail-state-(type=email):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
  23582. <p>The <code id="e-mail-state-(type=email):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23583. in mode <a href=#dom-input-value-value id="e-mail-state-(type=email):dom-input-value-value">value</a>.</p>
  23584. <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>
  23585. <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
  23586. apply</a> to the element:
  23587. <code id="e-mail-state-(type=email):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23588. <code id="e-mail-state-(type=email):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23589. <code id="e-mail-state-(type=email):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23590. <code id="e-mail-state-(type=email):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23591. <code id="e-mail-state-(type=email):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23592. <code id="e-mail-state-(type=email):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23593. <code id="e-mail-state-(type=email):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23594. <code id="e-mail-state-(type=email):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23595. <code id="e-mail-state-(type=email):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23596. <code id="e-mail-state-(type=email):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23597. <code id="e-mail-state-(type=email):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23598. <code id="e-mail-state-(type=email):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  23599. <code id="e-mail-state-(type=email):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  23600. <code id="e-mail-state-(type=email):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  23601. <code id="e-mail-state-(type=email):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  23602. <code id="e-mail-state-(type=email):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23603. <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
  23604. element:
  23605. <code id="e-mail-state-(type=email):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23606. <code id="e-mail-state-(type=email):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23607. <code id="e-mail-state-(type=email):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23608. <code id="e-mail-state-(type=email):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23609. <code id="e-mail-state-(type=email):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  23610. <code id="e-mail-state-(type=email):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  23611. <code id="e-mail-state-(type=email):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  23612. <code id="e-mail-state-(type=email):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23613. <code id="e-mail-state-(type=email):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23614. <code id="e-mail-state-(type=email):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  23615. <code id="e-mail-state-(type=email):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  23616. <code id="e-mail-state-(type=email):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  23617. <code id="e-mail-state-(type=email):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
  23618. <code id="e-mail-state-(type=email):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23619. </div>
  23620. <h6 id="password-state-(type=password)">4.10.5.1.6 <dfn>Password</dfn> state (<code>type=password</code>)</h6>
  23621. <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
  23622. the <a href="#password-state-(type=password)" id="password-state-(type=password):password-state-(type=password)">Password</a> state, the rules in this section
  23623. apply.</p>
  23624. <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
  23625. 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
  23626. so that people other than the user cannot see it.</p>
  23627. <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
  23628. 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>
  23629. <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
  23630. contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
  23631. <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
  23632. breaks</a> from the <a href=#concept-fe-value id="password-state-(type=password):concept-fe-value-4">value</a>.</p>
  23633. <div class=bookkeeping>
  23634. <p>The following common <code id="password-state-(type=password):the-input-element-3"><a href=#the-input-element>input</a></code> element content
  23635. attributes, IDL attributes, and methods <a href=#concept-input-apply id="password-state-(type=password):concept-input-apply">apply</a> to the element:
  23636. <code id="password-state-(type=password):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23637. <code id="password-state-(type=password):attr-fe-inputmode"><a href=#attr-fe-inputmode>inputmode</a></code>,
  23638. <code id="password-state-(type=password):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
  23639. <code id="password-state-(type=password):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
  23640. <code id="password-state-(type=password):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
  23641. <code id="password-state-(type=password):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  23642. <code id="password-state-(type=password):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23643. <code id="password-state-(type=password):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23644. <code id="password-state-(type=password):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
  23645. <code id="password-state-(type=password):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23646. <code id="password-state-(type=password):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23647. <code id="password-state-(type=password):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
  23648. <code id="password-state-(type=password):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
  23649. <code id="password-state-(type=password):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
  23650. <code id="password-state-(type=password):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  23651. <code id="password-state-(type=password):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  23652. <p>The <code id="password-state-(type=password):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23653. in mode <a href=#dom-input-value-value id="password-state-(type=password):dom-input-value-value">value</a>.</p>
  23654. <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>
  23655. <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
  23656. apply</a> to the element:
  23657. <code id="password-state-(type=password):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23658. <code id="password-state-(type=password):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23659. <code id="password-state-(type=password):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23660. <code id="password-state-(type=password):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23661. <code id="password-state-(type=password):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23662. <code id="password-state-(type=password):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23663. <code id="password-state-(type=password):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23664. <code id="password-state-(type=password):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23665. <code id="password-state-(type=password):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23666. <code id="password-state-(type=password):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23667. <code id="password-state-(type=password):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  23668. <code id="password-state-(type=password):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  23669. <code id="password-state-(type=password):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  23670. <code id="password-state-(type=password):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23671. <code id="password-state-(type=password):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  23672. <code id="password-state-(type=password):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  23673. <code id="password-state-(type=password):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23674. <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
  23675. element:
  23676. <code id="password-state-(type=password):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23677. <code id="password-state-(type=password):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23678. <code id="password-state-(type=password):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  23679. <code id="password-state-(type=password):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  23680. <code id="password-state-(type=password):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  23681. <code id="password-state-(type=password):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23682. <code id="password-state-(type=password):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23683. <code id="password-state-(type=password):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
  23684. <code id="password-state-(type=password):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23685. </div>
  23686. <h6 id="date-and-time-state-(type=datetime)">4.10.5.1.7 <dfn>Date and Time</dfn> state (<code>type=datetime</code>)</h6>
  23687. <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
  23688. 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
  23689. apply.</p>
  23690. <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
  23691. <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
  23692. the date and time in whatever time zone is appropriate for the user.</p>
  23693. <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
  23694. 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
  23695. <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
  23696. 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
  23697. <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
  23698. the user to set and view the time in another time zone and silently translate the time to and from
  23699. 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
  23700. 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
  23701. 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
  23702. global date and time string</a> representing the user's selection. User agents should allow the
  23703. 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>
  23704. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  23705. 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>,
  23706. 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>
  23707. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  23708. the difference between the input format and submission format for date, time, and number form
  23709. controls, and the <a href=#input-impl-notes>implementation notes</a>
  23710. regarding localization of form controls.</p>
  23711. <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
  23712. 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>
  23713. <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
  23714. 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>
  23715. represents the same point in time but expressed in the UTC time zone as a <span>valid normalized
  23716. forced-UTC global date and time string</span>, otherwise, set it to the empty string instead.</p>
  23717. <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
  23718. 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>
  23719. 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
  23720. string</a>.</p>
  23721. <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
  23722. 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>
  23723. <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
  23724. 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>
  23725. <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
  23726. 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
  23727. milliseconds elapsed from midnight UTC on the morning of 1970-01-01 (the time represented by the
  23728. 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>
  23729. <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
  23730. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  23731. <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>
  23732. milliseconds after midnight UTC on the morning of 1970-01-01 (the time represented by the value
  23733. "<code>1970-01-01T00:00:00.0Z</code>").</p>
  23734. <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
  23735. <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
  23736. 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
  23737. <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>
  23738. <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
  23739. <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
  23740. 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
  23741. time</a> that is represented by <var>input</var>.</p>
  23742. <div id=only-contemporary-times class=note>
  23743. <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
  23744. time-related states described in subsequent sections) is not intended for the entry of values for
  23745. which a precise date and time relative to the contemporary calendar cannot be established. For
  23746. example, it would be inappropriate for the entry of times like "one millisecond after the big
  23747. bang", "the early part of the Jurassic period", or "a winter around 250 BCE".</p>
  23748. <p>For the input of dates before the introduction of the Gregorian calendar, authors are
  23749. 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
  23750. the other date- and time-related states described in subsequent sections), as user agents are not
  23751. required to support converting dates and times from earlier periods to the Gregorian calendar,
  23752. and asking users to do so manually puts an undue burden on users. (This is complicated by the
  23753. manner in which the Gregorian calendar was phased in, which occurred at different times in
  23754. different countries, ranging from partway through the 16th century all the way to early in the
  23755. 20th.) Instead, authors are encouraged to provide fine-grained input controls using the
  23756. <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>
  23757. </div>
  23758. <div class=bookkeeping>
  23759. <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
  23760. 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:
  23761. <code id="date-and-time-state-(type=datetime):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23762. <code id="date-and-time-state-(type=datetime):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23763. <code id="date-and-time-state-(type=datetime):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  23764. <code id="date-and-time-state-(type=datetime):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  23765. <code id="date-and-time-state-(type=datetime):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23766. <code id="date-and-time-state-(type=datetime):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23767. <code id="date-and-time-state-(type=datetime):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  23768. <code id="date-and-time-state-(type=datetime):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23769. <code id="date-and-time-state-(type=datetime):dom-input-value"><a href=#dom-input-value>value</a></code>,
  23770. <code id="date-and-time-state-(type=datetime):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
  23771. <code id="date-and-time-state-(type=datetime):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  23772. <code id="date-and-time-state-(type=datetime):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  23773. <code id="date-and-time-state-(type=datetime):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23774. <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
  23775. in mode <a href=#dom-input-value-value id="date-and-time-state-(type=datetime):dom-input-value-value">value</a>.</p>
  23776. <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>
  23777. <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
  23778. apply</a> to the element:
  23779. <code id="date-and-time-state-(type=datetime):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23780. <code id="date-and-time-state-(type=datetime):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23781. <code id="date-and-time-state-(type=datetime):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23782. <code id="date-and-time-state-(type=datetime):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23783. <code id="date-and-time-state-(type=datetime):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23784. <code id="date-and-time-state-(type=datetime):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23785. <code id="date-and-time-state-(type=datetime):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23786. <code id="date-and-time-state-(type=datetime):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23787. <code id="date-and-time-state-(type=datetime):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23788. <code id="date-and-time-state-(type=datetime):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23789. <code id="date-and-time-state-(type=datetime):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23790. <code id="date-and-time-state-(type=datetime):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  23791. <code id="date-and-time-state-(type=datetime):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  23792. <code id="date-and-time-state-(type=datetime):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23793. <code id="date-and-time-state-(type=datetime):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  23794. <code id="date-and-time-state-(type=datetime):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  23795. <code id="date-and-time-state-(type=datetime):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  23796. <code id="date-and-time-state-(type=datetime):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  23797. <code id="date-and-time-state-(type=datetime):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23798. <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
  23799. element:
  23800. <code id="date-and-time-state-(type=datetime):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23801. <code id="date-and-time-state-(type=datetime):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  23802. <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23803. <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23804. <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  23805. <code id="date-and-time-state-(type=datetime):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23806. <code id="date-and-time-state-(type=datetime):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23807. <code id="date-and-time-state-(type=datetime):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  23808. <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
  23809. <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>
  23810. </div>
  23811. <div class=example>
  23812. <p>The following fragment shows part of a calendar application. A user can specify a date and
  23813. time for a meeting (in his local time zone, probably, though the user agent can allow the user to
  23814. change that), and since the submitted data includes the time-zone offset, the application can
  23815. ensure that the meeting is shown at the correct time regardless of the time zones used by all the
  23816. participants.</p>
  23817. <pre>&lt;fieldset>
  23818. &lt;legend>Add Meeting&lt;/legend>
  23819. &lt;p>&lt;label>Meeting name: &lt;input type=text name="meeting.label">&lt;/label>
  23820. &lt;p>&lt;label>Meeting time: &lt;input type=datetime name="meeting.start">&lt;/label>
  23821. &lt;/fieldset></pre>
  23822. <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
  23823. application would have also had to explicitly determine which time zone the user intended.</p>
  23824. <p>For events where the precise time is to vary as the user travels (e.g. "celebrate the new
  23825. year!"), and for recurring events that are to stay at the same time for a specific geographic
  23826. location even though that location may go in and out of daylight savings time (e.g. "bring the
  23827. 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
  23828. 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
  23829. geographic location to which to anchor the time would be more appropriate.</p>
  23830. </div>
  23831. <h6 id="date-state-(type=date)">4.10.5.1.8 <dfn>Date</dfn> state (<code>type=date</code>)</h6>
  23832. <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
  23833. 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>
  23834. <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
  23835. <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>
  23836. <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
  23837. 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
  23838. 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
  23839. 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
  23840. 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
  23841. 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>
  23842. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  23843. 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
  23844. input</a>.</p>
  23845. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  23846. the difference between the input format and submission format for date, time, and number form
  23847. controls, and the <a href=#input-impl-notes>implementation notes</a>
  23848. regarding localization of form controls.</p>
  23849. <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
  23850. 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>
  23851. <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
  23852. set it to the empty string instead.</p>
  23853. <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
  23854. 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
  23855. 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>
  23856. <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
  23857. (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>
  23858. <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
  23859. 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>
  23860. <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
  23861. 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
  23862. error, then return an error; otherwise, return the number of milliseconds elapsed from midnight
  23863. 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>
  23864. <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
  23865. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  23866. <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
  23867. UTC, is current <var>input</var> milliseconds after midnight UTC on the morning of
  23868. 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>").</p>
  23869. <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
  23870. <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
  23871. 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
  23872. 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
  23873. <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>
  23874. <p><strong>The <a href=#concept-input-value-date-string id="date-state-(type=date):concept-input-value-date-string">algorithm to convert a
  23875. <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
  23876. 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>
  23877. <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
  23878. <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>
  23879. <div class=bookkeeping>
  23880. <p>The following common <code id="date-state-(type=date):the-input-element-3"><a href=#the-input-element>input</a></code> element content
  23881. attributes, IDL attributes, and methods <a href=#concept-input-apply id="date-state-(type=date):concept-input-apply">apply</a> to the element:
  23882. <code id="date-state-(type=date):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23883. <code id="date-state-(type=date):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23884. <code id="date-state-(type=date):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  23885. <code id="date-state-(type=date):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  23886. <code id="date-state-(type=date):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23887. <code id="date-state-(type=date):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23888. <code id="date-state-(type=date):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  23889. <code id="date-state-(type=date):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23890. <code id="date-state-(type=date):dom-input-value"><a href=#dom-input-value>value</a></code>,
  23891. <code id="date-state-(type=date):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
  23892. <code id="date-state-(type=date):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  23893. <code id="date-state-(type=date):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  23894. <code id="date-state-(type=date):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23895. <p>The <code id="date-state-(type=date):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23896. in mode <a href=#dom-input-value-value id="date-state-(type=date):dom-input-value-value">value</a>.</p>
  23897. <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>
  23898. <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
  23899. apply</a> to the element:
  23900. <code id="date-state-(type=date):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23901. <code id="date-state-(type=date):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  23902. <code id="date-state-(type=date):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  23903. <code id="date-state-(type=date):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  23904. <code id="date-state-(type=date):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  23905. <code id="date-state-(type=date):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  23906. <code id="date-state-(type=date):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  23907. <code id="date-state-(type=date):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  23908. <code id="date-state-(type=date):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  23909. <code id="date-state-(type=date):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  23910. <code id="date-state-(type=date):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  23911. <code id="date-state-(type=date):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  23912. <code id="date-state-(type=date):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  23913. <code id="date-state-(type=date):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  23914. <code id="date-state-(type=date):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  23915. <code id="date-state-(type=date):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  23916. <code id="date-state-(type=date):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  23917. <code id="date-state-(type=date):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  23918. <code id="date-state-(type=date):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  23919. <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
  23920. element:
  23921. <code id="date-state-(type=date):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  23922. <code id="date-state-(type=date):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  23923. <code id="date-state-(type=date):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  23924. <code id="date-state-(type=date):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  23925. <code id="date-state-(type=date):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  23926. <code id="date-state-(type=date):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  23927. <code id="date-state-(type=date):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  23928. <code id="date-state-(type=date):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  23929. <code id="date-state-(type=date):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  23930. </div>
  23931. <h6 id="month-state-(type=month)">4.10.5.1.9 <dfn>Month</dfn> state (<code>type=month</code>)</h6>
  23932. <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
  23933. 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>
  23934. <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
  23935. <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>
  23936. <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
  23937. 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
  23938. 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
  23939. 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
  23940. 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
  23941. 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>
  23942. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  23943. 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
  23944. input</a>.</p>
  23945. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  23946. the difference between the input format and submission format for date, time, and number form
  23947. controls, and the <a href=#input-impl-notes>implementation notes</a>
  23948. regarding localization of form controls.</p>
  23949. <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
  23950. 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>
  23951. <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>,
  23952. then set it to the empty string instead.</p>
  23953. <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
  23954. 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
  23955. 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>
  23956. <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
  23957. 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>
  23958. <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
  23959. 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>
  23960. <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
  23961. 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
  23962. error, then return an error; otherwise, return the number of months between January 1970 and the
  23963. parsed <a href=#concept-month id="month-state-(type=month):concept-month-5">month</a>.</p>
  23964. <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
  23965. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  23966. <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
  23967. has <var>input</var> months between it and January 1970.</p>
  23968. <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
  23969. <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
  23970. 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>
  23971. 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
  23972. new <code>Date</code> object</a> representing midnight UTC on the morning of the first day of
  23973. the parsed <a href=#concept-month id="month-state-(type=month):concept-month-7">month</a>.</p>
  23974. <p><strong>The <a href=#concept-input-value-date-string id="month-state-(type=month):concept-input-value-date-string">algorithm to convert a
  23975. <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
  23976. 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>
  23977. <div class=bookkeeping>
  23978. <p>The following common <code id="month-state-(type=month):the-input-element-3"><a href=#the-input-element>input</a></code> element content
  23979. attributes, IDL attributes, and methods <a href=#concept-input-apply id="month-state-(type=month):concept-input-apply">apply</a> to the element:
  23980. <code id="month-state-(type=month):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  23981. <code id="month-state-(type=month):attr-input-list"><a href=#attr-input-list>list</a></code>,
  23982. <code id="month-state-(type=month):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  23983. <code id="month-state-(type=month):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  23984. <code id="month-state-(type=month):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  23985. <code id="month-state-(type=month):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  23986. <code id="month-state-(type=month):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  23987. <code id="month-state-(type=month):dom-input-list"><a href=#dom-input-list>list</a></code>,
  23988. <code id="month-state-(type=month):dom-input-value"><a href=#dom-input-value>value</a></code>,
  23989. <code id="month-state-(type=month):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
  23990. <code id="month-state-(type=month):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  23991. <code id="month-state-(type=month):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  23992. <code id="month-state-(type=month):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  23993. <p>The <code id="month-state-(type=month):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
  23994. in mode <a href=#dom-input-value-value id="month-state-(type=month):dom-input-value-value">value</a>.</p>
  23995. <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>
  23996. <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
  23997. apply</a> to the element:
  23998. <code id="month-state-(type=month):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  23999. <code id="month-state-(type=month):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24000. <code id="month-state-(type=month):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24001. <code id="month-state-(type=month):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24002. <code id="month-state-(type=month):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24003. <code id="month-state-(type=month):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24004. <code id="month-state-(type=month):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24005. <code id="month-state-(type=month):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24006. <code id="month-state-(type=month):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24007. <code id="month-state-(type=month):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24008. <code id="month-state-(type=month):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24009. <code id="month-state-(type=month):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24010. <code id="month-state-(type=month):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24011. <code id="month-state-(type=month):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24012. <code id="month-state-(type=month):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24013. <code id="month-state-(type=month):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24014. <code id="month-state-(type=month):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24015. <code id="month-state-(type=month):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  24016. <code id="month-state-(type=month):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24017. <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
  24018. element:
  24019. <code id="month-state-(type=month):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24020. <code id="month-state-(type=month):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24021. <code id="month-state-(type=month):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24022. <code id="month-state-(type=month):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24023. <code id="month-state-(type=month):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24024. <code id="month-state-(type=month):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24025. <code id="month-state-(type=month):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24026. <code id="month-state-(type=month):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24027. <code id="month-state-(type=month):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  24028. <code id="month-state-(type=month):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  24029. </div>
  24030. <h6 id="week-state-(type=week)">4.10.5.1.10 <dfn>Week</dfn> state (<code>type=week</code>)</h6>
  24031. <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
  24032. 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>
  24033. <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
  24034. <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>
  24035. <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
  24036. 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
  24037. 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
  24038. 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
  24039. 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
  24040. 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>
  24041. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  24042. 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
  24043. input</a>.</p>
  24044. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  24045. the difference between the input format and submission format for date, time, and number form
  24046. controls, and the <a href=#input-impl-notes>implementation notes</a>
  24047. regarding localization of form controls.</p>
  24048. <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
  24049. 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>
  24050. <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
  24051. set it to the empty string instead.</p>
  24052. <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
  24053. 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
  24054. 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>
  24055. <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
  24056. (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
  24057. of week 1970-W01).</p>
  24058. <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
  24059. 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>
  24060. <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
  24061. 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
  24062. an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight
  24063. 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
  24064. parsed <a href=#concept-week id="week-state-(type=week):concept-week-5">week</a>, ignoring leap seconds.</p>
  24065. <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
  24066. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  24067. <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
  24068. UTC, is current <var>input</var> milliseconds after midnight UTC on the morning of
  24069. 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>").</p>
  24070. <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
  24071. <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
  24072. 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
  24073. 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
  24074. <code>Date</code> object</a> representing midnight UTC on the morning of the Monday of the
  24075. parsed <a href=#concept-week id="week-state-(type=week):concept-week-7">week</a>.</p>
  24076. <p><strong>The <a href=#concept-input-value-date-string id="week-state-(type=week):concept-input-value-date-string">algorithm to convert a
  24077. <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
  24078. 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>
  24079. <div class=bookkeeping>
  24080. <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
  24081. methods <a href=#concept-input-apply id="week-state-(type=week):concept-input-apply">apply</a> to the element:
  24082. <code id="week-state-(type=week):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24083. <code id="week-state-(type=week):attr-input-list"><a href=#attr-input-list>list</a></code>,
  24084. <code id="week-state-(type=week):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  24085. <code id="week-state-(type=week):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  24086. <code id="week-state-(type=week):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  24087. <code id="week-state-(type=week):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  24088. <code id="week-state-(type=week):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  24089. <code id="week-state-(type=week):dom-input-list"><a href=#dom-input-list>list</a></code>,
  24090. <code id="week-state-(type=week):dom-input-value"><a href=#dom-input-value>value</a></code>,
  24091. <code id="week-state-(type=week):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
  24092. <code id="week-state-(type=week):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  24093. <code id="week-state-(type=week):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  24094. <code id="week-state-(type=week):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24095. <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>
  24096. <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>
  24097. <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
  24098. element:
  24099. <code id="week-state-(type=week):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24100. <code id="week-state-(type=week):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24101. <code id="week-state-(type=week):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24102. <code id="week-state-(type=week):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24103. <code id="week-state-(type=week):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24104. <code id="week-state-(type=week):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24105. <code id="week-state-(type=week):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24106. <code id="week-state-(type=week):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24107. <code id="week-state-(type=week):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24108. <code id="week-state-(type=week):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24109. <code id="week-state-(type=week):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24110. <code id="week-state-(type=week):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24111. <code id="week-state-(type=week):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24112. <code id="week-state-(type=week):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24113. <code id="week-state-(type=week):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24114. <code id="week-state-(type=week):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24115. <code id="week-state-(type=week):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24116. <code id="week-state-(type=week):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  24117. <code id="week-state-(type=week):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24118. <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:
  24119. <code id="week-state-(type=week):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24120. <code id="week-state-(type=week):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24121. <code id="week-state-(type=week):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24122. <code id="week-state-(type=week):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24123. <code id="week-state-(type=week):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24124. <code id="week-state-(type=week):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24125. <code id="week-state-(type=week):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24126. <code id="week-state-(type=week):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24127. <code id="week-state-(type=week):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  24128. <code id="week-state-(type=week):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  24129. </div>
  24130. <h6 id="time-state-(type=time)">4.10.5.1.11 <dfn>Time</dfn> state (<code>type=time</code>)</h6>
  24131. <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
  24132. 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>
  24133. <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
  24134. <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>
  24135. <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
  24136. 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
  24137. 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
  24138. 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
  24139. 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
  24140. 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>
  24141. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  24142. 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
  24143. input</a>.</p>
  24144. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  24145. the difference between the input format and submission format for date, time, and number form
  24146. controls, and the <a href=#input-impl-notes>implementation notes</a>
  24147. regarding localization of form controls.</p>
  24148. <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
  24149. 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>
  24150. <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
  24151. set it to the empty string instead.</p>
  24152. <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>
  24153. <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
  24154. 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
  24155. 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>
  24156. <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
  24157. 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>
  24158. <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
  24159. 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>
  24160. <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
  24161. 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
  24162. error, then return an error; otherwise, return the number of milliseconds elapsed from midnight to
  24163. the parsed <a href=#concept-time id="time-state-(type=time):concept-time-5">time</a> on a day with no time changes.</p>
  24164. <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
  24165. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  24166. <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
  24167. <var>input</var> milliseconds after midnight on a day with no time changes.</p>
  24168. <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
  24169. <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
  24170. 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
  24171. 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
  24172. <code>Date</code> object</a> representing the parsed <a href=#concept-time id="time-state-(type=time):concept-time-7">time</a> in
  24173. UTC on 1970-01-01.</p>
  24174. <p><strong>The <a href=#concept-input-value-date-string id="time-state-(type=time):concept-input-value-date-string">algorithm to convert a
  24175. <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
  24176. 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>
  24177. <div class=bookkeeping>
  24178. <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
  24179. methods <a href=#concept-input-apply id="time-state-(type=time):concept-input-apply">apply</a> to the element:
  24180. <code id="time-state-(type=time):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24181. <code id="time-state-(type=time):attr-input-list"><a href=#attr-input-list>list</a></code>,
  24182. <code id="time-state-(type=time):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  24183. <code id="time-state-(type=time):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  24184. <code id="time-state-(type=time):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  24185. <code id="time-state-(type=time):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  24186. <code id="time-state-(type=time):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  24187. <code id="time-state-(type=time):dom-input-list"><a href=#dom-input-list>list</a></code>,
  24188. <code id="time-state-(type=time):dom-input-value"><a href=#dom-input-value>value</a></code>,
  24189. <code id="time-state-(type=time):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
  24190. <code id="time-state-(type=time):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  24191. <code id="time-state-(type=time):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  24192. <code id="time-state-(type=time):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24193. <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>
  24194. <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>
  24195. <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
  24196. element:
  24197. <code id="time-state-(type=time):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24198. <code id="time-state-(type=time):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24199. <code id="time-state-(type=time):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24200. <code id="time-state-(type=time):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24201. <code id="time-state-(type=time):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24202. <code id="time-state-(type=time):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24203. <code id="time-state-(type=time):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24204. <code id="time-state-(type=time):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24205. <code id="time-state-(type=time):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24206. <code id="time-state-(type=time):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24207. <code id="time-state-(type=time):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24208. <code id="time-state-(type=time):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24209. <code id="time-state-(type=time):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24210. <code id="time-state-(type=time):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24211. <code id="time-state-(type=time):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24212. <code id="time-state-(type=time):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24213. <code id="time-state-(type=time):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24214. <code id="time-state-(type=time):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  24215. <code id="time-state-(type=time):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24216. <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:
  24217. <code id="time-state-(type=time):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24218. <code id="time-state-(type=time):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24219. <code id="time-state-(type=time):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24220. <code id="time-state-(type=time):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24221. <code id="time-state-(type=time):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24222. <code id="time-state-(type=time):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24223. <code id="time-state-(type=time):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24224. <code id="time-state-(type=time):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24225. <code id="time-state-(type=time):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  24226. <code id="time-state-(type=time):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  24227. </div>
  24228. <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>
  24229. <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
  24230. 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
  24231. this section apply.</p>
  24232. <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
  24233. <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
  24234. information.</p>
  24235. <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
  24236. 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
  24237. <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
  24238. 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
  24239. normalised local date and time string</a>. If the user agent provides a user interface for
  24240. 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
  24241. string</a> representing the user's selection. User agents should allow the user to set the
  24242. <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>
  24243. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  24244. 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
  24245. <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>
  24246. <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
  24247. the difference between the input format and submission format for date, time, and number form
  24248. controls, and the <a href=#input-impl-notes>implementation notes</a>
  24249. regarding localization of form controls.</p>
  24250. <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
  24251. 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>
  24252. <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
  24253. 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>
  24254. representing the same date and time; otherwise, set it to the empty string instead.</p>
  24255. <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
  24256. 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>
  24257. 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
  24258. string</a>.</p>
  24259. <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
  24260. 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>
  24261. <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
  24262. 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>
  24263. <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
  24264. 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
  24265. milliseconds elapsed from midnight on the morning of 1970-01-01 (the time represented by the value
  24266. "<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>
  24267. <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
  24268. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  24269. <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
  24270. <var>input</var> milliseconds after midnight on the morning of 1970-01-01 (the time
  24271. represented by the value "<code>1970-01-01T00:00:00.0</code>").</p>
  24272. <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
  24273. <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>
  24274. <div class=bookkeeping>
  24275. <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
  24276. 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:
  24277. <code id="local-date-and-time-state-(type=datetime-local):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24278. <code id="local-date-and-time-state-(type=datetime-local):attr-input-list"><a href=#attr-input-list>list</a></code>,
  24279. <code id="local-date-and-time-state-(type=datetime-local):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  24280. <code id="local-date-and-time-state-(type=datetime-local):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  24281. <code id="local-date-and-time-state-(type=datetime-local):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  24282. <code id="local-date-and-time-state-(type=datetime-local):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  24283. <code id="local-date-and-time-state-(type=datetime-local):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  24284. <code id="local-date-and-time-state-(type=datetime-local):dom-input-list"><a href=#dom-input-list>list</a></code>,
  24285. <code id="local-date-and-time-state-(type=datetime-local):dom-input-value"><a href=#dom-input-value>value</a></code>, and
  24286. <code id="local-date-and-time-state-(type=datetime-local):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  24287. <code id="local-date-and-time-state-(type=datetime-local):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  24288. <code id="local-date-and-time-state-(type=datetime-local):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24289. <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
  24290. in mode <a href=#dom-input-value-value id="local-date-and-time-state-(type=datetime-local):dom-input-value-value">value</a>.</p>
  24291. <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>
  24292. <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
  24293. apply</a> to the element:
  24294. <code id="local-date-and-time-state-(type=datetime-local):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24295. <code id="local-date-and-time-state-(type=datetime-local):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24296. <code id="local-date-and-time-state-(type=datetime-local):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24297. <code id="local-date-and-time-state-(type=datetime-local):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24298. <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24299. <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24300. <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24301. <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24302. <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24303. <code id="local-date-and-time-state-(type=datetime-local):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24304. <code id="local-date-and-time-state-(type=datetime-local):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24305. <code id="local-date-and-time-state-(type=datetime-local):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24306. <code id="local-date-and-time-state-(type=datetime-local):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24307. <code id="local-date-and-time-state-(type=datetime-local):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24308. <code id="local-date-and-time-state-(type=datetime-local):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24309. <code id="local-date-and-time-state-(type=datetime-local):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24310. <code id="local-date-and-time-state-(type=datetime-local):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24311. <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
  24312. <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>
  24313. <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
  24314. element:
  24315. <code id="local-date-and-time-state-(type=datetime-local):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24316. <code id="local-date-and-time-state-(type=datetime-local):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24317. <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>,
  24318. <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>,
  24319. <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>,
  24320. <code id="local-date-and-time-state-(type=datetime-local):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24321. <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
  24322. <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;
  24323. <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>,
  24324. <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
  24325. <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>
  24326. </div>
  24327. <div class=example>
  24328. <p>The following example shows part of a flight booking application. The application uses an
  24329. <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
  24330. <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
  24331. given date and time in the time zone of the selected airport.</p>
  24332. <pre>&lt;fieldset>
  24333. &lt;legend>Destination&lt;/legend>
  24334. &lt;p>&lt;label>Airport: &lt;input type=text name=to list=airports>&lt;/label>&lt;/p>
  24335. &lt;p>&lt;label>Departure time: &lt;input type=datetime-local name=totime step=3600>&lt;/label>&lt;/p>
  24336. &lt;/fieldset>
  24337. &lt;datalist id=airports>
  24338. &lt;option value=ATL label="Atlanta">
  24339. &lt;option value=MEM label="Memphis">
  24340. &lt;option value=LHR label="London Heathrow">
  24341. &lt;option value=LAX label="Los Angeles">
  24342. &lt;option value=FRA label="Frankfurt">
  24343. &lt;/datalist></pre>
  24344. <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>
  24345. type, then the user would have to work out the time-zone conversions himself, which is clearly
  24346. not a good user experience!</p>
  24347. </div>
  24348. <h6 id="number-state-(type=number)">4.10.5.1.13 <dfn id=number-state>Number</dfn> state (<code>type=number</code>)</h6>
  24349. <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
  24350. 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>
  24351. <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
  24352. <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value">value</a> to a string representing a number.</p>
  24353. <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
  24354. 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
  24355. 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
  24356. 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
  24357. 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
  24358. 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
  24359. 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>
  24360. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  24361. 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
  24362. from bad input</a>.</p>
  24363. <p class=note>This specification does not define what user interface user agents are to use;
  24364. user agent vendors are encouraged to consider what would best serve their users' needs. For
  24365. example, a user agent in Persian or Arabic markets might support Persian and Arabic numeric input
  24366. (converting it to the format required for submission as described above). Similarly, a user agent
  24367. designed for Romans might display the value in Roman numerals rather than in decimal; or (more
  24368. realistically) a user agent designed for the French market might display the value with
  24369. apostrophes between thousands and commas before the decimals, and allow the user to enter a value
  24370. in that manner, internally converting it to the submission format described above.</p>
  24371. <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
  24372. 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>
  24373. <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
  24374. number</a>, then set it to the empty string instead.</p>
  24375. <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
  24376. 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,
  24377. 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>
  24378. <p>The <a href=#concept-input-step-scale id="number-state-(type=number):concept-input-step-scale">step scale factor</a> is
  24379. 1. The <a href=#concept-input-step-default id="number-state-(type=number):concept-input-step-default">default step</a> is 1 (allowing only
  24380. 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
  24381. base</a> has a non-integer value).</p>
  24382. <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
  24383. 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
  24384. 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
  24385. there are two such numbers, user agents are encouraged to pick the one nearest positive
  24386. infinity.</p>
  24387. <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
  24388. number</a>, given a string <var>input</var>, is as follows</strong>: If applying the
  24389. <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
  24390. in an error, then return an error; otherwise, return the resulting number.</p>
  24391. <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
  24392. string</a>, given a number <var>input</var>, is as follows</strong>: Return a
  24393. <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>
  24394. <div class=bookkeeping>
  24395. <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
  24396. methods <a href=#concept-input-apply id="number-state-(type=number):concept-input-apply">apply</a> to the element:
  24397. <code id="number-state-(type=number):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24398. <code id="number-state-(type=number):attr-input-list"><a href=#attr-input-list>list</a></code>,
  24399. <code id="number-state-(type=number):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  24400. <code id="number-state-(type=number):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
  24401. <code id="number-state-(type=number):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
  24402. <code id="number-state-(type=number):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
  24403. <code id="number-state-(type=number):attr-input-required"><a href=#attr-input-required>required</a></code>, and
  24404. <code id="number-state-(type=number):attr-input-step"><a href=#attr-input-step>step</a></code> content attributes;
  24405. <code id="number-state-(type=number):dom-input-list"><a href=#dom-input-list>list</a></code>,
  24406. <code id="number-state-(type=number):dom-input-value"><a href=#dom-input-value>value</a></code>, and
  24407. <code id="number-state-(type=number):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  24408. <code id="number-state-(type=number):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  24409. <code id="number-state-(type=number):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24410. <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>
  24411. <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>
  24412. <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
  24413. element:
  24414. <code id="number-state-(type=number):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24415. <code id="number-state-(type=number):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24416. <code id="number-state-(type=number):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24417. <code id="number-state-(type=number):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24418. <code id="number-state-(type=number):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24419. <code id="number-state-(type=number):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24420. <code id="number-state-(type=number):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24421. <code id="number-state-(type=number):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24422. <code id="number-state-(type=number):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24423. <code id="number-state-(type=number):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24424. <code id="number-state-(type=number):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24425. <code id="number-state-(type=number):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24426. <code id="number-state-(type=number):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24427. <code id="number-state-(type=number):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24428. <code id="number-state-(type=number):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24429. <code id="number-state-(type=number):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24430. <code id="number-state-(type=number):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  24431. <code id="number-state-(type=number):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24432. <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:
  24433. <code id="number-state-(type=number):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24434. <code id="number-state-(type=number):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24435. <code id="number-state-(type=number):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24436. <code id="number-state-(type=number):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24437. <code id="number-state-(type=number):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24438. <code id="number-state-(type=number):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24439. <code id="number-state-(type=number):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24440. <code id="number-state-(type=number):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24441. <code id="number-state-(type=number):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24442. <code id="number-state-(type=number):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  24443. <code id="number-state-(type=number):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  24444. </div>
  24445. <div class=example>
  24446. <p>Here is an example of using a numeric input control:</p>
  24447. <pre>&lt;label>How much do you want to charge? $&lt;input type=number min=0 step=0.01 name=price>&lt;/label></pre>
  24448. <p>As described above, a user agent might support numeric input in the user's local format,
  24449. converting it to the format required for submission as described above. This might include
  24450. handling grouping separators (as in "872,000,000,000") and various decimal separators (such as
  24451. "3,99" vs "3.99") or using local digits (such as those in Arabic, Devanagari, Persian, and
  24452. Thai).</p>
  24453. </div>
  24454. <p class=note>The <code>type=number</code> state is not appropriate for input that
  24455. happens to only consist of numbers but isn't strictly speaking a number. For example, it would be
  24456. inappropriate for credit card numbers or US postal codes. A simple way of determining whether to
  24457. use <code>type=number</code> is to consider whether it would make sense for the input
  24458. control to have a spinbox interface (e.g. with "up" and "down" arrows). Getting a credit card
  24459. number wrong by 1 in the last digit isn't a minor mistake, it's as wrong as getting every digit
  24460. incorrect. So it would not make sense for the user to select a credit card number using "up" and
  24461. "down" buttons. When a spinbox interface is not appropriate, <code>type=text</code> is
  24462. 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>
  24463. attribute).</p>
  24464. <h6 id="range-state-(type=range)">4.10.5.1.14 <dfn>Range</dfn> state (<code>type=range</code>)</h6>
  24465. <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
  24466. 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>
  24467. <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
  24468. <code id="range-state-(type=range):attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute is specified or not.</p>
  24469. <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
  24470. element<dd>
  24471. <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
  24472. <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value">value</a> to a string representing a number, but with the
  24473. caveat that the exact value is not important, letting UAs provide a simpler interface than they
  24474. do for the <a href="#number-state-(type=number)" id="range-state-(type=range):number-state-(type=number)">Number</a> state.</p>
  24475. <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
  24476. 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
  24477. 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.
  24478. 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
  24479. 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
  24480. 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
  24481. 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
  24482. representation of the number representing the user's selection as a floating-point
  24483. 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>
  24484. <p><strong>Constraint validation</strong>: While the user interface describes input that the
  24485. 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
  24486. <a href=#suffering-from-bad-input id="range-state-(type=range):suffering-from-bad-input">suffering from bad input</a>.</p>
  24487. <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
  24488. 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>
  24489. <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
  24490. 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>
  24491. <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>
  24492. <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
  24493. 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
  24494. number</a>, of the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-5">minimum</a>.</p>
  24495. <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
  24496. represents the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-4">maximum</a>.</p>
  24497. <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
  24498. 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
  24499. 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
  24500. 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.
  24501. If two numbers match these constraints, then user agents must use the one nearest to positive
  24502. infinity.</p>
  24503. <p class=example>For example, the markup
  24504. <code>&lt;input type="range" min=0 max=100 step=20 value=50></code>
  24505. results in a range control whose initial value is 60.</p>
  24506. <div class=example>
  24507. <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
  24508. the full range of the control that are especially important, such as preconfigured light levels
  24509. or typical speed limits in a range control used as a speed control. The following markup
  24510. fragment:</p>
  24511. <pre>&lt;input type="range" min="-100" max="100" value="0" step="10" name="power" list="powers">
  24512. &lt;datalist id="powers">
  24513. &lt;option value="0">
  24514. &lt;option value="-30">
  24515. &lt;option value="30">
  24516. <span class=bad> &lt;option value="++50"></span>
  24517. &lt;/datalist>
  24518. </pre>
  24519. <p>...with the following style sheet applied:</p>
  24520. <pre>input { height: 75px; width: 49px; background: #D5CCBB; color: black; }</pre>
  24521. <p>...might render as:</p>
  24522. <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>
  24523. <p>Note how the UA determined the orientation of the control from the ratio of the
  24524. style-sheet-specified height and width properties. The colours were similarly derived from the
  24525. 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,
  24526. the UA deciding to only use the author-specified completion values and then adding longer tick
  24527. marks at the extremes.</p>
  24528. <p>Note also how the invalid value <code>++50</code> was completely ignored.</p>
  24529. </div>
  24530. <div class=example>
  24531. <p>For another example, consider the following markup fragment:</p>
  24532. <pre>&lt;input name=x type=range min=100 max=700 step=9.09090909 value=509.090909></pre>
  24533. <p>A user agent could display in a variety of ways, for instance:</p>
  24534. <p><img src=http://images.whatwg.org/sample-range-2a.png width=231 alt="As a dial." height=57></p>
  24535. <p>Or, alternatively, for instance:</p>
  24536. <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>
  24537. <p>The user agent could pick which one to display based on the dimensions given in the style
  24538. sheet. This would allow it to maintain the same resolution for the tick marks, despite the
  24539. differences in width.</p>
  24540. </div>
  24541. <div class=example>
  24542. <p>Finally, here is an example of a range control with two labeled values:</p>
  24543. <pre>&lt;input type="range" name="a" list="a-values">
  24544. &lt;datalist id="a-values">
  24545. &lt;option value="10" label="Low">
  24546. &lt;option value="90" label="High">
  24547. &lt;/datalist>
  24548. </pre>
  24549. <p>With styles that make the control draw vertically, it might look as follows:</p>
  24550. <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>
  24551. </div>
  24552. <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
  24553. the element<dd>
  24554. <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
  24555. <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values">value<em>s</em></a> to two strings representing numbers, but
  24556. with the caveat that the exact values are not important, enabling UAs provide a graphical
  24557. interface rather than requiring the user to type the numbers directly.</p>
  24558. <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
  24559. 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
  24560. floating-point number values</a> to them, and ensuring that the first value is never larger
  24561. than the second value. User agents must not allow the user to set either the first or second of
  24562. 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
  24563. floating-point number</a>. If the user agent provides a user interface for selecting a
  24564. 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
  24565. the numbers representing the user's selections as floating-point numbers</a>. User agents
  24566. 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
  24567. string.</p>
  24568. <p><strong>Constraint validation</strong>: While the user interface describes input that the
  24569. 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
  24570. 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>
  24571. <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
  24572. 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>
  24573. separated by a single U+002C COMMA character (,).</p>
  24574. <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>
  24575. <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
  24576. 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
  24577. floating-point number</a>, of the element's <a href=#concept-input-min id="range-state-(type=range):concept-input-min-9">minimum</a>
  24578. and the element's <a href=#concept-input-max id="range-state-(type=range):concept-input-max-7">maximum</a>, with the smaller value
  24579. 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
  24580. 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
  24581. concatenating the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-8">values</a>, separating them by
  24582. a single U+002C COMMA character (,), with the lower value coming first.</ol>
  24583. <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
  24584. 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
  24585. concatenating the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-10">values</a>, separating them by a
  24586. single U+002C COMMA character (,), with the lower value coming first.</p>
  24587. <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
  24588. 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
  24589. 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>,
  24590. of the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-11">minimum</a>.</p>
  24591. <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
  24592. represents the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-10">maximum</a>.</p>
  24593. <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
  24594. 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
  24595. 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
  24596. <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.
  24597. If two numbers match these constraints, then user agents must use the one nearest to positive
  24598. infinity.</p>
  24599. <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>
  24600. 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
  24601. (,), with the lower value coming first.</p>
  24602. <div class=example>
  24603. <p>Consider a user interface that filters possible flights by departure and arrival time:</p>
  24604. <pre>&lt;form ...>
  24605. &lt;fieldset>
  24606. &lt;legend>Outbound flight time&lt;/legend>
  24607. &lt;select ...>
  24608. &lt;option>Departure
  24609. &lt;option>Arrival
  24610. &lt;/select>
  24611. &lt;p>&lt;output name=o1>00:00&lt;/output> – &lt;output name=o2>24:00&lt;/output>&lt;/p>
  24612. &lt;input type=range multiple min=0 max=24 value=0,24 step=1.0 ...
  24613. oninput="o1.value = valueLow + ':00'; o2.value = valueHigh + ':00'">
  24614. &lt;/fieldset>
  24615. ...
  24616. &lt;/form></pre>
  24617. <p>With appropriate styling, this might look like:</p>
  24618. <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.">
  24619. </div>
  24620. </dl>
  24621. <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
  24622. user agent must run the <a href=#value-sanitization-algorithm id="range-state-(type=range):value-sanitization-algorithm-3">value sanitization algorithm</a>.</p>
  24623. <p class=note>In this state, the range and step constraints are enforced even during user input,
  24624. and there is no way to set the value to the empty string.</p>
  24625. <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
  24626. 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
  24627. 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
  24628. 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>
  24629. <p>The <a href=#concept-input-step-scale id="range-state-(type=range):concept-input-step-scale">step scale factor</a> is
  24630. 1. The <a href=#concept-input-step-default id="range-state-(type=range):concept-input-step-default">default step</a> is 1 (allowing only
  24631. 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
  24632. value).</p>
  24633. <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
  24634. number</a>, given a string <var>input</var>, is as follows</strong>: If applying the
  24635. <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
  24636. in an error, then return an error; otherwise, return the resulting number.</p>
  24637. <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
  24638. 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
  24639. floating-point number</a>, of <var>input</var>.</p>
  24640. <div class=bookkeeping>
  24641. <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
  24642. methods <a href=#concept-input-apply id="range-state-(type=range):concept-input-apply">apply</a> to the element:
  24643. <code id="range-state-(type=range):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24644. <code id="range-state-(type=range):attr-input-list-2"><a href=#attr-input-list>list</a></code>,
  24645. <code id="range-state-(type=range):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
  24646. <code id="range-state-(type=range):attr-input-min-3"><a href=#attr-input-min>min</a></code>,
  24647. <code id="range-state-(type=range):attr-input-multiple-5"><a href=#attr-input-multiple>multiple</a></code>, and
  24648. <code id="range-state-(type=range):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
  24649. <code id="range-state-(type=range):dom-input-list"><a href=#dom-input-list>list</a></code>,
  24650. <code id="range-state-(type=range):dom-input-value"><a href=#dom-input-value>value</a></code>, and
  24651. <code id="range-state-(type=range):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
  24652. <code id="range-state-(type=range):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
  24653. <code id="range-state-(type=range):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24654. <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:
  24655. <code id="range-state-(type=range):dom-input-valueasnumber-2"><a href=#dom-input-valueasnumber>valueAsNumber</a></code>.</p>
  24656. <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:
  24657. <code id="range-state-(type=range):dom-input-valuelow"><a href=#dom-input-valuelow>valueLow</a></code> and
  24658. <code id="range-state-(type=range):dom-input-valuehigh"><a href=#dom-input-valuehigh>valueHigh</a></code>.</p>
  24659. <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>
  24660. <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>
  24661. <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
  24662. element:
  24663. <code id="range-state-(type=range):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24664. <code id="range-state-(type=range):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24665. <code id="range-state-(type=range):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24666. <code id="range-state-(type=range):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24667. <code id="range-state-(type=range):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24668. <code id="range-state-(type=range):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24669. <code id="range-state-(type=range):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24670. <code id="range-state-(type=range):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24671. <code id="range-state-(type=range):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24672. <code id="range-state-(type=range):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24673. <code id="range-state-(type=range):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24674. <code id="range-state-(type=range):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24675. <code id="range-state-(type=range):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24676. <code id="range-state-(type=range):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24677. <code id="range-state-(type=range):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24678. <code id="range-state-(type=range):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  24679. <code id="range-state-(type=range):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  24680. <code id="range-state-(type=range):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24681. <code id="range-state-(type=range):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
  24682. <code id="range-state-(type=range):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24683. <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:
  24684. <code id="range-state-(type=range):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24685. <code id="range-state-(type=range):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24686. <code id="range-state-(type=range):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24687. <code id="range-state-(type=range):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24688. <code id="range-state-(type=range):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24689. <code id="range-state-(type=range):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24690. <code id="range-state-(type=range):dom-input-valuelow-2" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24691. <code id="range-state-(type=range):dom-input-valuehigh-2" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24692. <code id="range-state-(type=range):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24693. <code id="range-state-(type=range):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
  24694. <code id="range-state-(type=range):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
  24695. <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
  24696. 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
  24697. attribute is not specified:
  24698. <code id="range-state-(type=range):dom-input-valuelow-3" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code> and
  24699. <code id="range-state-(type=range):dom-input-valuehigh-3" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code>.</p>
  24700. <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
  24701. 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:
  24702. <code id="range-state-(type=range):dom-input-valueasnumber-3" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>.</p>
  24703. </div>
  24704. <h6 id="colour-state-(type=color)">4.10.5.1.15 <dfn>Colour</dfn> state (<code>type=color</code>)</h6>
  24705. <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
  24706. 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>
  24707. <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
  24708. 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
  24709. colour</a>.</p>
  24710. <p class=note>In this state, there is always a colour picked, and there is no way to set the
  24711. value to the empty string.</p>
  24712. <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
  24713. 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
  24714. 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
  24715. 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
  24716. 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
  24717. 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
  24718. 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
  24719. 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
  24720. string.</p>
  24721. <p><strong>Constraint validation</strong>: While the user interface describes input that the user
  24722. 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
  24723. <a href=#suffering-from-bad-input id="colour-state-(type=color):suffering-from-bad-input">suffering from bad input</a>.</p>
  24724. <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
  24725. have a value that is a <a href=#valid-simple-colour id="colour-state-(type=color):valid-simple-colour">valid simple colour</a>.</p>
  24726. <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
  24727. 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
  24728. lowercase</a>; otherwise, set it to the string "<code>#000000</code>".</p>
  24729. <div class=bookkeeping>
  24730. <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:
  24731. <code id="colour-state-(type=color):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code> and
  24732. <code id="colour-state-(type=color):attr-input-list"><a href=#attr-input-list>list</a></code> content attributes;
  24733. <code id="colour-state-(type=color):dom-input-list"><a href=#dom-input-list>list</a></code> and
  24734. <code id="colour-state-(type=color):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
  24735. <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>
  24736. <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>
  24737. <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
  24738. element:
  24739. <code id="colour-state-(type=color):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24740. <code id="colour-state-(type=color):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24741. <code id="colour-state-(type=color):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  24742. <code id="colour-state-(type=color):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24743. <code id="colour-state-(type=color):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24744. <code id="colour-state-(type=color):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24745. <code id="colour-state-(type=color):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24746. <code id="colour-state-(type=color):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24747. <code id="colour-state-(type=color):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24748. <code id="colour-state-(type=color):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24749. <code id="colour-state-(type=color):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24750. <code id="colour-state-(type=color):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  24751. <code id="colour-state-(type=color):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24752. <code id="colour-state-(type=color):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  24753. <code id="colour-state-(type=color):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24754. <code id="colour-state-(type=color):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24755. <code id="colour-state-(type=color):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24756. <code id="colour-state-(type=color):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24757. <code id="colour-state-(type=color):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  24758. <code id="colour-state-(type=color):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  24759. <code id="colour-state-(type=color):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24760. <code id="colour-state-(type=color):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  24761. <code id="colour-state-(type=color):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  24762. <code id="colour-state-(type=color):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24763. <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:
  24764. <code id="colour-state-(type=color):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  24765. <code id="colour-state-(type=color):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24766. <code id="colour-state-(type=color):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24767. <code id="colour-state-(type=color):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24768. <code id="colour-state-(type=color):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24769. <code id="colour-state-(type=color):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24770. <code id="colour-state-(type=color):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  24771. <code id="colour-state-(type=color):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24772. <code id="colour-state-(type=color):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24773. <code id="colour-state-(type=color):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24774. <code id="colour-state-(type=color):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  24775. <code id="colour-state-(type=color):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  24776. <code id="colour-state-(type=color):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  24777. <code id="colour-state-(type=color):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24778. </div>
  24779. <h6 id="checkbox-state-(type=checkbox)">4.10.5.1.16 <dfn>Checkbox</dfn> state (<code>type=checkbox</code>)</h6>
  24780. <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
  24781. the <a href="#checkbox-state-(type=checkbox)" id="checkbox-state-(type=checkbox):checkbox-state-(type=checkbox)">Checkbox</a> state, the rules in this section
  24782. apply.</p>
  24783. <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
  24784. 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
  24785. 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
  24786. control's selection should be obscured as if the control was in a third, indeterminate, state.</p>
  24787. <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
  24788. third state.</p>
  24789. <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
  24790. 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,
  24791. 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
  24792. 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
  24793. 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>
  24794. 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>
  24795. that bubbles named <code id="checkbox-state-(type=checkbox):event-input-change"><a href=#event-input-change>change</a></code> at the element. </p>
  24796. <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
  24797. behavior</a>.</p>
  24798. <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
  24799. being missing</a>.</p>
  24800. <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>
  24801. <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>
  24802. controls so that the current value is not visible.</p>
  24803. </dl>
  24804. <div class=bookkeeping>
  24805. <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:
  24806. <code id="checkbox-state-(type=checkbox):attr-input-checked"><a href=#attr-input-checked>checked</a></code>, and
  24807. <code id="checkbox-state-(type=checkbox):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
  24808. <code id="checkbox-state-(type=checkbox):dom-input-checked"><a href=#dom-input-checked>checked</a></code> and
  24809. <code id="checkbox-state-(type=checkbox):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
  24810. <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>
  24811. <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>
  24812. <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
  24813. element:
  24814. <code id="checkbox-state-(type=checkbox):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24815. <code id="checkbox-state-(type=checkbox):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24816. <code id="checkbox-state-(type=checkbox):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24817. <code id="checkbox-state-(type=checkbox):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24818. <code id="checkbox-state-(type=checkbox):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24819. <code id="checkbox-state-(type=checkbox):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24820. <code id="checkbox-state-(type=checkbox):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24821. <code id="checkbox-state-(type=checkbox):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24822. <code id="checkbox-state-(type=checkbox):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24823. <code id="checkbox-state-(type=checkbox):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24824. <code id="checkbox-state-(type=checkbox):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24825. <code id="checkbox-state-(type=checkbox):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  24826. <code id="checkbox-state-(type=checkbox):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  24827. <code id="checkbox-state-(type=checkbox):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24828. <code id="checkbox-state-(type=checkbox):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  24829. <code id="checkbox-state-(type=checkbox):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24830. <code id="checkbox-state-(type=checkbox):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24831. <code id="checkbox-state-(type=checkbox):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24832. <code id="checkbox-state-(type=checkbox):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24833. <code id="checkbox-state-(type=checkbox):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  24834. <code id="checkbox-state-(type=checkbox):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24835. <code id="checkbox-state-(type=checkbox):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  24836. <code id="checkbox-state-(type=checkbox):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  24837. <code id="checkbox-state-(type=checkbox):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24838. <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:
  24839. <code id="checkbox-state-(type=checkbox):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24840. <code id="checkbox-state-(type=checkbox):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  24841. <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24842. <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24843. <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24844. <code id="checkbox-state-(type=checkbox):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24845. <code id="checkbox-state-(type=checkbox):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  24846. <code id="checkbox-state-(type=checkbox):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24847. <code id="checkbox-state-(type=checkbox):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24848. <code id="checkbox-state-(type=checkbox):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24849. <code id="checkbox-state-(type=checkbox):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  24850. <code id="checkbox-state-(type=checkbox):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  24851. <code id="checkbox-state-(type=checkbox):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  24852. <code id="checkbox-state-(type=checkbox):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24853. </div>
  24854. <h6 id="radio-button-state-(type=radio)">4.10.5.1.17 <dfn>Radio Button</dfn> state (<code>type=radio</code>)</h6>
  24855. <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
  24856. 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
  24857. apply.</p>
  24858. <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
  24859. 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
  24860. 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
  24861. 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
  24862. represents the selected control in the group, and if it is false, it indicates a control in the
  24863. group that is not selected.</p>
  24864. <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
  24865. <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
  24866. of the following conditions:</p>
  24867. <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
  24868. 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>,
  24869. 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
  24870. 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
  24871. 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>
  24872. <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>
  24873. contains only that element.</p>
  24874. <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
  24875. button group</a></i> must be set to false:</p>
  24876. <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
  24877. 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
  24878. 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>
  24879. <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
  24880. <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
  24881. 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
  24882. <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
  24883. activation steps</a> for <var>R</var> consist of checking if the element to which a reference
  24884. 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
  24885. <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
  24886. 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
  24887. 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
  24888. 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
  24889. <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>
  24890. 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>
  24891. <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
  24892. behavior</a>.</p>
  24893. <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
  24894. <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
  24895. 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>
  24896. <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
  24897. they are inserted into the document, then they will all be initially unchecked in the interface,
  24898. until such time as one of them is checked (either by the user or by script).</p>
  24899. <div class=bookkeeping>
  24900. <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:
  24901. <code id="radio-button-state-(type=radio):attr-input-checked"><a href=#attr-input-checked>checked</a></code> and
  24902. <code id="radio-button-state-(type=radio):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
  24903. <code id="radio-button-state-(type=radio):dom-input-checked"><a href=#dom-input-checked>checked</a></code> and
  24904. <code id="radio-button-state-(type=radio):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
  24905. <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>
  24906. <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>
  24907. <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
  24908. element:
  24909. <code id="radio-button-state-(type=radio):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  24910. <code id="radio-button-state-(type=radio):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  24911. <code id="radio-button-state-(type=radio):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  24912. <code id="radio-button-state-(type=radio):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  24913. <code id="radio-button-state-(type=radio):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  24914. <code id="radio-button-state-(type=radio):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  24915. <code id="radio-button-state-(type=radio):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  24916. <code id="radio-button-state-(type=radio):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  24917. <code id="radio-button-state-(type=radio):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  24918. <code id="radio-button-state-(type=radio):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  24919. <code id="radio-button-state-(type=radio):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  24920. <code id="radio-button-state-(type=radio):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  24921. <code id="radio-button-state-(type=radio):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  24922. <code id="radio-button-state-(type=radio):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  24923. <code id="radio-button-state-(type=radio):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  24924. <code id="radio-button-state-(type=radio):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  24925. <code id="radio-button-state-(type=radio):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  24926. <code id="radio-button-state-(type=radio):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  24927. <code id="radio-button-state-(type=radio):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  24928. <code id="radio-button-state-(type=radio):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  24929. <code id="radio-button-state-(type=radio):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  24930. <code id="radio-button-state-(type=radio):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  24931. <code id="radio-button-state-(type=radio):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  24932. <code id="radio-button-state-(type=radio):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  24933. <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:
  24934. <code id="radio-button-state-(type=radio):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  24935. <code id="radio-button-state-(type=radio):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  24936. <code id="radio-button-state-(type=radio):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  24937. <code id="radio-button-state-(type=radio):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  24938. <code id="radio-button-state-(type=radio):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  24939. <code id="radio-button-state-(type=radio):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  24940. <code id="radio-button-state-(type=radio):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  24941. <code id="radio-button-state-(type=radio):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  24942. <code id="radio-button-state-(type=radio):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  24943. <code id="radio-button-state-(type=radio):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  24944. <code id="radio-button-state-(type=radio):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  24945. <code id="radio-button-state-(type=radio):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  24946. <code id="radio-button-state-(type=radio):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  24947. <code id="radio-button-state-(type=radio):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  24948. </div>
  24949. <h6 id="file-upload-state-(type=file)">4.10.5.1.18 <dfn>File Upload</dfn> state (<code>type=file</code>)</h6>
  24950. <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
  24951. 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
  24952. apply.</p>
  24953. <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
  24954. name, a file type, and a file body (the contents of the file).</p>
  24955. <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
  24956. in the case that a user has selected an entire directory hierarchy or multiple files with the same
  24957. name from different directories. <dfn id=concept-input-file-path>Path components</dfn>, for
  24958. 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
  24959. of file names that are separated by U+005C REVERSE SOLIDUS character (\) characters.</p>
  24960. <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
  24961. 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
  24962. files</a>.</p>
  24963. <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
  24964. <a href=#activation-behavior id="file-upload-state-(type=file):activation-behavior">activation behavior</a> is to run the following steps:</p>
  24965. <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
  24966. 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>
  24967. <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
  24968. file selected; otherwise, any number may be selected. Files can be from the filesystem or created
  24969. on the fly, e.g. a picture taken from a camera connected to the user's device.</p>
  24970. <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
  24971. 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
  24972. 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
  24973. <code id="file-upload-state-(type=file):the-input-element-4"><a href=#the-input-element>input</a></code> element.</ol>
  24974. <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
  24975. user to change the files on the list in other ways also, e.g. adding or removing files by
  24976. 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
  24977. 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
  24978. 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
  24979. <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
  24980. <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>
  24981. <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
  24982. behavior</a> and the user agent must not allow the user to change the element's selection.</p>
  24983. <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
  24984. <a href=#suffering-from-being-missing id="file-upload-state-(type=file):suffering-from-being-missing">suffering from being missing</a>.</p>
  24985. <hr>
  24986. <p>The <dfn id=attr-input-accept><code>accept</code></dfn> attribute may be specified to
  24987. provide user agents with a hint of what file types will be accepted.</p>
  24988. <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
  24989. 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>
  24990. <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>
  24991. <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
  24992. (i.e. duplicates are not allowed). To obtain the list of tokens from the
  24993. 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
  24994. commas</a>.</p>
  24995. <p>User agents may use the value of this attribute to display a more appropriate user interface
  24996. than a generic file picker. For instance, given the value <code>image/*</code>, a user
  24997. agent could offer the user the option of using a local camera or selecting a photograph from their
  24998. photo collection; given the value <code>audio/*</code>, a user agent could offer the user
  24999. the option of recording a clip using a headset microphone.</p>
  25000. <p>User agents should prevent the user from selecting files that are not accepted by one (or more)
  25001. of these tokens.</p>
  25002. <p class=note>Authors are encouraged to specify both any MIME types and any corresponding
  25003. extensions when looking for data in a specific format.</p>
  25004. <div class=example>
  25005. <p>For example, consider an application that converts Microsoft Word documents to Open Document
  25006. Format files. Since Microsoft Word documents are described with a wide variety of MIME types and
  25007. extensions, the site can list several, as follows:</p>
  25008. <pre>&lt;input type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"></pre>
  25009. <p>On platforms that only use file extensions to describe file types, the extensions listed here
  25010. can be used to filter the allowed documents, while the MIME types can be used with the system's
  25011. type registration table (mapping MIME types to extensions used by the system), if any, to
  25012. determine any other extensions to allow. Similarly, on a system that does not have file names or
  25013. extensions but labels documents with MIME types internally, the MIME types can be used to pick
  25014. the allowed files, while the extensions can be used if the system has an extension registration
  25015. table that maps known extensions to MIME types used by the system.</p>
  25016. </div>
  25017. <p class=warning>Extensions tend to be ambiguous (e.g. there are an untold number of formats
  25018. that use the "<code>.dat</code>" extension, and users can typically quite easily rename
  25019. their files to have a "<code>.doc</code>" extension even if they are not Microsoft Word
  25020. documents), and MIME types tend to be unreliable (e.g. many formats have no formally registered
  25021. types, and many formats are in practice labeled using a number of different MIME types). Authors
  25022. are reminded that, as usual, data received from a client should be treated with caution, as it may
  25023. not be in an expected format even if the user is not hostile and the user agent fully obeyed the
  25024. <code id="file-upload-state-(type=file):attr-input-accept"><a href=#attr-input-accept>accept</a></code> attribute's requirements.</p>
  25025. <div id=fakepath-srsly class=example>
  25026. <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
  25027. the file name with the string "<code>C:\fakepath\</code>". Some legacy user agents
  25028. actually included the full path (which was a security vulnerability). As a result of this,
  25029. 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
  25030. backwards-compatible way is non-trivial. The following function extracts the file name in a
  25031. suitably compatible manner:</p>
  25032. <pre>function extractFilename(path) {
  25033. if (path.substr(0, 12) == "C:\\fakepath\\")
  25034. return path.substr(12); // modern browser
  25035. var x;
  25036. x = path.lastIndexOf('/');
  25037. if (x >= 0) // Unix-based path
  25038. return path.substr(x+1);
  25039. x = path.lastIndexOf('\\');
  25040. if (x >= 0) // Windows-based path
  25041. return path.substr(x+1);
  25042. return path; // just the file name
  25043. }</pre>
  25044. <p>This can be used as follows:</p>
  25045. <pre>&lt;p>&lt;input type=file name=image onchange="updateFilename(this.value)">&lt;/p>
  25046. &lt;p>The name of the file you picked is: &lt;span id="filename">(none)&lt;/span>&lt;/p>
  25047. &lt;script>
  25048. function updateFilename(path) {
  25049. var name = extractFilename(path);
  25050. document.getElementById('filename').textContent = name;
  25051. }
  25052. &lt;/script></pre>
  25053. </div>
  25054. <hr>
  25055. <div class=bookkeeping>
  25056. <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:
  25057. <code id="file-upload-state-(type=file):attr-input-accept-2"><a href=#attr-input-accept>accept</a></code>,
  25058. <code id="file-upload-state-(type=file):attr-input-multiple-3"><a href=#attr-input-multiple>multiple</a></code>, and
  25059. <code id="file-upload-state-(type=file):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
  25060. <code id="file-upload-state-(type=file):dom-input-files"><a href=#dom-input-files>files</a></code> and
  25061. <code id="file-upload-state-(type=file):dom-input-value-3"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
  25062. <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>
  25063. <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>
  25064. <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
  25065. element:
  25066. <code id="file-upload-state-(type=file):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  25067. <code id="file-upload-state-(type=file):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  25068. <code id="file-upload-state-(type=file):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  25069. <code id="file-upload-state-(type=file):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  25070. <code id="file-upload-state-(type=file):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  25071. <code id="file-upload-state-(type=file):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  25072. <code id="file-upload-state-(type=file):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  25073. <code id="file-upload-state-(type=file):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  25074. <code id="file-upload-state-(type=file):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  25075. <code id="file-upload-state-(type=file):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  25076. <code id="file-upload-state-(type=file):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  25077. <code id="file-upload-state-(type=file):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  25078. <code id="file-upload-state-(type=file):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  25079. <code id="file-upload-state-(type=file):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  25080. <code id="file-upload-state-(type=file):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  25081. <code id="file-upload-state-(type=file):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  25082. <code id="file-upload-state-(type=file):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  25083. <code id="file-upload-state-(type=file):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  25084. <code id="file-upload-state-(type=file):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  25085. <code id="file-upload-state-(type=file):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  25086. <code id="file-upload-state-(type=file):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  25087. <code id="file-upload-state-(type=file):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  25088. <code id="file-upload-state-(type=file):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  25089. <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>
  25090. <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:
  25091. <code id="file-upload-state-(type=file):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  25092. <code id="file-upload-state-(type=file):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  25093. <code id="file-upload-state-(type=file):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  25094. <code id="file-upload-state-(type=file):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  25095. <code id="file-upload-state-(type=file):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  25096. <code id="file-upload-state-(type=file):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  25097. <code id="file-upload-state-(type=file):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  25098. <code id="file-upload-state-(type=file):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  25099. <code id="file-upload-state-(type=file):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  25100. <code id="file-upload-state-(type=file):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  25101. <code id="file-upload-state-(type=file):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  25102. <code id="file-upload-state-(type=file):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  25103. <code id="file-upload-state-(type=file):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  25104. <code id="file-upload-state-(type=file):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  25105. </div>
  25106. <h6 id="submit-button-state-(type=submit)">4.10.5.1.19 <dfn>Submit Button</dfn> state (<code>type=submit</code>)</h6>
  25107. <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
  25108. 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
  25109. apply.</p>
  25110. <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
  25111. 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>
  25112. attribute, the button's label must be the value of that attribute; otherwise, it must be an
  25113. 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
  25114. button</a>.
  25115. <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>
  25116. </p>
  25117. <p class=note>Since the default label is implementation-defined, and the width of the button
  25118. typically depends on the button's label, the button's width can leak a few bits of fingerprintable
  25119. information. These bits are likely to be strongly correlated to the identity of the user agent and
  25120. the user's locale.</p>
  25121. <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
  25122. <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>,
  25123. 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>,
  25124. <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
  25125. <code id="submit-button-state-(type=submit):the-input-element-3"><a href=#the-input-element>input</a></code> element; otherwise, do nothing.</p>
  25126. <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
  25127. behavior</a>.</p>
  25128. <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
  25129. submission</a>.</p>
  25130. <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
  25131. used to make submit buttons that do not trigger the constraint validation.</p>
  25132. <div class=bookkeeping>
  25133. <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:
  25134. <code id="submit-button-state-(type=submit):attr-fs-formaction-2"><a href=#attr-fs-formaction>formaction</a></code>,
  25135. <code id="submit-button-state-(type=submit):attr-fs-formenctype-2"><a href=#attr-fs-formenctype>formenctype</a></code>,
  25136. <code id="submit-button-state-(type=submit):attr-fs-formmethod-2"><a href=#attr-fs-formmethod>formmethod</a></code>,
  25137. <code id="submit-button-state-(type=submit):attr-fs-formnovalidate-3"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and
  25138. <code id="submit-button-state-(type=submit):attr-fs-formtarget-2"><a href=#attr-fs-formtarget>formtarget</a></code> content attributes;
  25139. <code id="submit-button-state-(type=submit):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute.</p>
  25140. <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>
  25141. <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
  25142. element:
  25143. <code id="submit-button-state-(type=submit):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  25144. <code id="submit-button-state-(type=submit):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  25145. <code id="submit-button-state-(type=submit):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  25146. <code id="submit-button-state-(type=submit):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  25147. <code id="submit-button-state-(type=submit):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  25148. <code id="submit-button-state-(type=submit):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  25149. <code id="submit-button-state-(type=submit):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  25150. <code id="submit-button-state-(type=submit):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  25151. <code id="submit-button-state-(type=submit):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  25152. <code id="submit-button-state-(type=submit):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  25153. <code id="submit-button-state-(type=submit):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  25154. <code id="submit-button-state-(type=submit):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  25155. <code id="submit-button-state-(type=submit):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  25156. <code id="submit-button-state-(type=submit):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  25157. <code id="submit-button-state-(type=submit):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  25158. <code id="submit-button-state-(type=submit):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  25159. <code id="submit-button-state-(type=submit):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  25160. <code id="submit-button-state-(type=submit):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  25161. <code id="submit-button-state-(type=submit):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  25162. <code id="submit-button-state-(type=submit):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  25163. <code id="submit-button-state-(type=submit):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  25164. <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:
  25165. <code id="submit-button-state-(type=submit):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  25166. <code id="submit-button-state-(type=submit):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  25167. <code id="submit-button-state-(type=submit):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  25168. <code id="submit-button-state-(type=submit):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  25169. <code id="submit-button-state-(type=submit):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  25170. <code id="submit-button-state-(type=submit):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  25171. <code id="submit-button-state-(type=submit):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  25172. <code id="submit-button-state-(type=submit):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  25173. <code id="submit-button-state-(type=submit):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  25174. <code id="submit-button-state-(type=submit):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  25175. <code id="submit-button-state-(type=submit):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  25176. <code id="submit-button-state-(type=submit):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  25177. <code id="submit-button-state-(type=submit):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  25178. <code id="submit-button-state-(type=submit):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  25179. <code id="submit-button-state-(type=submit):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  25180. <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>
  25181. </div>
  25182. <h6 id="image-button-state-(type=image)">4.10.5.1.20 <dfn>Image Button</dfn> state (<code>type=image</code>)</h6>
  25183. <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
  25184. 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
  25185. apply.</p>
  25186. <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
  25187. select a coordinate and submit the form, or alternatively a button from which the user can submit
  25188. 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>
  25189. <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
  25190. of the control but with "<code>.x</code>" and "<code>.y</code>" appended to the
  25191. name with the <var>x</var> and <var>y</var> components of the coordinate
  25192. respectively.</p>
  25193. <hr>
  25194. <p>The image is given by the <dfn id=attr-input-src><code>src</code></dfn> attribute. The
  25195. <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
  25196. non-empty URL potentially surrounded by spaces</a> referencing a non-interactive, optionally
  25197. animated, image resource that is neither paged nor scripted.</p>
  25198. <p>When any of the following events occur, unless the user agent cannot support images, or its
  25199. support for images has been disabled, or the user agent only fetches elements on demand, or the
  25200. <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
  25201. <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,
  25202. 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>
  25203. <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
  25204. 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
  25205. 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
  25206. 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
  25207. 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
  25208. 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
  25209. 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>
  25210. <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
  25211. <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
  25212. <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>
  25213. (defined below) has been run.</p>
  25214. <p>If the image was successfully obtained, with no network errors, and the image's type is a
  25215. supported image type, and the image is a valid image of that type, then the image is said to be
  25216. <dfn id=input-img-available><i>available</i></dfn>. If this is true before the image is
  25217. 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>
  25218. <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
  25219. 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
  25220. type</var>. If these rules are not applied, then the type of the image must be the type given by
  25221. the image's <a href=#content-type id="image-button-state-(type=image):content-type-2">associated Content-Type headers</a>.</p>
  25222. <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
  25223. agents must not run executable code embedded in the image resource. User agents must only display
  25224. the first page of a multipage resource. User agents must not allow the resource to act in an
  25225. interactive fashion, but should honor any animation in the resource.</p>
  25226. <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
  25227. 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
  25228. 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
  25229. otherwise, if the fetching process fails without a response from the remote server, or completes
  25230. 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
  25231. 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>
  25232. <hr>
  25233. <p>The <dfn id=attr-input-alt><code>alt</code></dfn> attribute provides the textual label for
  25234. 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
  25235. giving the label that would be appropriate for an equivalent button if the image was
  25236. unavailable.</p>
  25237. <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>
  25238. <hr>
  25239. <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,
  25240. 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
  25241. <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
  25242. 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
  25243. <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>
  25244. 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
  25245. selecting a coordinate, then the coordinate (0,0) must be assumed.</p>
  25246. <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
  25247. 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
  25248. 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
  25249. <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
  25250. coordinate</a> to (0,0), and <a href=#concept-form-submit id="image-button-state-(type=image):concept-form-submit-2">submit</a> the
  25251. <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>
  25252. <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
  25253. <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>,
  25254. 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>
  25255. <p>The <dfn id=concept-input-type-image-coordinate>selected coordinate</dfn> must consist of
  25256. an <var>x</var>-component and a <var>y</var>-component. The coordinates
  25257. represent the position relative to the edge of the image, with the coordinate space having the
  25258. positive <var>x</var> direction to the right, and the positive <var>y</var>
  25259. direction downwards.</p>
  25260. <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
  25261. <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
  25262. image, <var>border<sub>right</sub></var> is the width of the border on the right
  25263. of the image, and <var>padding<sub>right</sub></var> is the width of the padding
  25264. on the right of the image, with all dimensions given in CSS pixels.</p>
  25265. <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
  25266. <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
  25267. <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
  25268. all dimensions given in CSS pixels.</p>
  25269. <p>Where a border or padding is missing, its width is zero CSS pixels.</p>
  25270. <hr>
  25271. <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
  25272. submission</a>.</p>
  25273. <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>
  25274. <p>These attributes return the actual rendered dimensions of the image, or zero if the
  25275. dimensions are not known.</p>
  25276. <p>They can be set, to change the corresponding content attributes.</p>
  25277. </dl>
  25278. <div class=bookkeeping>
  25279. <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:
  25280. <code id="image-button-state-(type=image):attr-input-alt-3"><a href=#attr-input-alt>alt</a></code>,
  25281. <code id="image-button-state-(type=image):attr-fs-formaction-2"><a href=#attr-fs-formaction>formaction</a></code>,
  25282. <code id="image-button-state-(type=image):attr-fs-formenctype-2"><a href=#attr-fs-formenctype>formenctype</a></code>,
  25283. <code id="image-button-state-(type=image):attr-fs-formmethod-2"><a href=#attr-fs-formmethod>formmethod</a></code>,
  25284. <code id="image-button-state-(type=image):attr-fs-formnovalidate-2"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  25285. <code id="image-button-state-(type=image):attr-fs-formtarget-2"><a href=#attr-fs-formtarget>formtarget</a></code>,
  25286. <code id="image-button-state-(type=image):attr-dim-height"><a href=#attr-dim-height>height</a></code>,
  25287. <code id="image-button-state-(type=image):attr-input-src-9"><a href=#attr-input-src>src</a></code>, and
  25288. <code id="image-button-state-(type=image):attr-dim-width"><a href=#attr-dim-width>width</a></code> content attributes;
  25289. <code id="image-button-state-(type=image):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute.</p>
  25290. <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>
  25291. <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
  25292. element:
  25293. <code id="image-button-state-(type=image):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  25294. <code id="image-button-state-(type=image):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  25295. <code id="image-button-state-(type=image):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  25296. <code id="image-button-state-(type=image):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  25297. <code id="image-button-state-(type=image):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  25298. <code id="image-button-state-(type=image):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  25299. <code id="image-button-state-(type=image):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  25300. <code id="image-button-state-(type=image):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  25301. <code id="image-button-state-(type=image):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  25302. <code id="image-button-state-(type=image):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  25303. <code id="image-button-state-(type=image):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  25304. <code id="image-button-state-(type=image):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  25305. <code id="image-button-state-(type=image):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  25306. <code id="image-button-state-(type=image):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  25307. <code id="image-button-state-(type=image):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  25308. <code id="image-button-state-(type=image):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>, and
  25309. <code id="image-button-state-(type=image):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>.</p>
  25310. <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>
  25311. <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:
  25312. <code id="image-button-state-(type=image):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  25313. <code id="image-button-state-(type=image):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  25314. <code id="image-button-state-(type=image):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  25315. <code id="image-button-state-(type=image):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  25316. <code id="image-button-state-(type=image):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  25317. <code id="image-button-state-(type=image):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  25318. <code id="image-button-state-(type=image):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  25319. <code id="image-button-state-(type=image):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  25320. <code id="image-button-state-(type=image):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  25321. <code id="image-button-state-(type=image):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  25322. <code id="image-button-state-(type=image):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  25323. <code id="image-button-state-(type=image):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  25324. <code id="image-button-state-(type=image):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  25325. <code id="image-button-state-(type=image):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  25326. <code id="image-button-state-(type=image):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  25327. <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>
  25328. </div>
  25329. <p class=note>Many aspects of this state's behavior are similar to the behavior of the
  25330. <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
  25331. requirements are described in more detail.</p>
  25332. <div class=example>
  25333. <p>Take the following form:</p>
  25334. <pre>&lt;form action="process.cgi">
  25335. &lt;input type=image src=map.png name=where alt="Show location list">
  25336. &lt;/form></pre>
  25337. <p>If the user clicked on the image at coordinate (127,40) then the URL used to submit the form
  25338. would be "<code>process.cgi?where.x=127&amp;where.y=40</code>".</p>
  25339. <p>(In this example, it's assumed that for users who don't see the map, and who instead just see
  25340. a button labeled "Show location list", clicking the button will cause the server to show a list
  25341. of locations to pick from instead of the map.)</p>
  25342. </div>
  25343. <h6 id="reset-button-state-(type=reset)">4.10.5.1.21 <dfn>Reset Button</dfn> state (<code>type=reset</code>)</h6>
  25344. <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
  25345. 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
  25346. apply.</p>
  25347. <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
  25348. 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>
  25349. attribute, the button's label must be the value of that attribute; otherwise, it must be an
  25350. 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>.
  25351. <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>
  25352. </p>
  25353. <p class=note>Since the default label is implementation-defined, and the width of the button
  25354. typically depends on the button's label, the button's width can leak a few bits of fingerprintable
  25355. information. These bits are likely to be strongly correlated to the identity of the user agent and
  25356. the user's locale.</p>
  25357. <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
  25358. <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
  25359. <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
  25360. nothing.</p>
  25361. <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
  25362. behavior</a>.</p>
  25363. <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
  25364. validation</a>.</p>
  25365. <div class=bookkeeping>
  25366. <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>
  25367. <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
  25368. element:
  25369. <code id="reset-button-state-(type=reset):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  25370. <code id="reset-button-state-(type=reset):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  25371. <code id="reset-button-state-(type=reset):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  25372. <code id="reset-button-state-(type=reset):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  25373. <code id="reset-button-state-(type=reset):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  25374. <code id="reset-button-state-(type=reset):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  25375. <code id="reset-button-state-(type=reset):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  25376. <code id="reset-button-state-(type=reset):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  25377. <code id="reset-button-state-(type=reset):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  25378. <code id="reset-button-state-(type=reset):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  25379. <code id="reset-button-state-(type=reset):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  25380. <code id="reset-button-state-(type=reset):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  25381. <code id="reset-button-state-(type=reset):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  25382. <code id="reset-button-state-(type=reset):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  25383. <code id="reset-button-state-(type=reset):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  25384. <code id="reset-button-state-(type=reset):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  25385. <code id="reset-button-state-(type=reset):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  25386. <code id="reset-button-state-(type=reset):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  25387. <code id="reset-button-state-(type=reset):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  25388. <code id="reset-button-state-(type=reset):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  25389. <code id="reset-button-state-(type=reset):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  25390. <code id="reset-button-state-(type=reset):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  25391. <code id="reset-button-state-(type=reset):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  25392. <code id="reset-button-state-(type=reset):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  25393. <code id="reset-button-state-(type=reset):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  25394. <code id="reset-button-state-(type=reset):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  25395. <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:
  25396. <code id="reset-button-state-(type=reset):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  25397. <code id="reset-button-state-(type=reset):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  25398. <code id="reset-button-state-(type=reset):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  25399. <code id="reset-button-state-(type=reset):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  25400. <code id="reset-button-state-(type=reset):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  25401. <code id="reset-button-state-(type=reset):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  25402. <code id="reset-button-state-(type=reset):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  25403. <code id="reset-button-state-(type=reset):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  25404. <code id="reset-button-state-(type=reset):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  25405. <code id="reset-button-state-(type=reset):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  25406. <code id="reset-button-state-(type=reset):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  25407. <code id="reset-button-state-(type=reset):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  25408. <code id="reset-button-state-(type=reset):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  25409. <code id="reset-button-state-(type=reset):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  25410. <code id="reset-button-state-(type=reset):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  25411. <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>
  25412. </div>
  25413. <h6 id="button-state-(type=button)">4.10.5.1.22 <dfn>Button</dfn> state (<code>type=button</code>)</h6>
  25414. <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
  25415. 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>
  25416. <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
  25417. 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>
  25418. 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
  25419. 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>
  25420. <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
  25421. behavior</a> is to do nothing.</p>
  25422. <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
  25423. behavior</a>.</p>
  25424. <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
  25425. validation</a>.</p>
  25426. <div class=bookkeeping>
  25427. <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>
  25428. <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
  25429. element:
  25430. <code id="button-state-(type=button):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
  25431. <code id="button-state-(type=button):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
  25432. <code id="button-state-(type=button):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
  25433. <code id="button-state-(type=button):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
  25434. <code id="button-state-(type=button):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
  25435. <code id="button-state-(type=button):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
  25436. <code id="button-state-(type=button):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
  25437. <code id="button-state-(type=button):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
  25438. <code id="button-state-(type=button):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
  25439. <code id="button-state-(type=button):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
  25440. <code id="button-state-(type=button):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
  25441. <code id="button-state-(type=button):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
  25442. <code id="button-state-(type=button):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
  25443. <code id="button-state-(type=button):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
  25444. <code id="button-state-(type=button):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
  25445. <code id="button-state-(type=button):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
  25446. <code id="button-state-(type=button):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
  25447. <code id="button-state-(type=button):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
  25448. <code id="button-state-(type=button):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
  25449. <code id="button-state-(type=button):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
  25450. <code id="button-state-(type=button):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
  25451. <code id="button-state-(type=button):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
  25452. <code id="button-state-(type=button):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
  25453. <code id="button-state-(type=button):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
  25454. <code id="button-state-(type=button):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
  25455. <code id="button-state-(type=button):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
  25456. <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:
  25457. <code id="button-state-(type=button):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
  25458. <code id="button-state-(type=button):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
  25459. <code id="button-state-(type=button):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
  25460. <code id="button-state-(type=button):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
  25461. <code id="button-state-(type=button):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
  25462. <code id="button-state-(type=button):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
  25463. <code id="button-state-(type=button):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
  25464. <code id="button-state-(type=button):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
  25465. <code id="button-state-(type=button):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
  25466. <code id="button-state-(type=button):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
  25467. <code id="button-state-(type=button):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
  25468. <code id="button-state-(type=button):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
  25469. <code id="button-state-(type=button):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
  25470. <code id="button-state-(type=button):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
  25471. <code id="button-state-(type=button):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
  25472. <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>
  25473. </div>
  25474. <h5 id=input-impl-notes>4.10.5.2 Implemention notes regarding localization of form controls</h5>
  25475. <p><i>This section is non-normative.</i></p>
  25476. <p>The formats shown to the user in date, time, and number controls is independent of the format
  25477. used for form submission.</p>
  25478. <p>Browsers are encouraged to use user interfaces that present dates, times, and numbers according
  25479. 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
  25480. <a href=#language id=input-impl-notes:language>language</a> or the user's preferred locale. Using the page's locale will ensure
  25481. consistency with page-provided data.
  25482. <p class=example>For example, it would be confusing to users if an American English page claimed
  25483. that a Cirque De Soleil show was going to be showing on 02/03, but their
  25484. 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
  25485. date was presented in the same format everywhere. (There's still a risk that the user would end up
  25486. arriving a month late, of course, but there's only so much that can be done about such cultural
  25487. differences...)</p>
  25488. <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>
  25489. <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>
  25490. 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
  25491. declares that the attribute <a href=#concept-input-apply id=common-input-element-attributes:concept-input-apply-2>applies</a>. When an attribute
  25492. <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
  25493. <a href=#ignore id=common-input-element-attributes:ignore>ignore</a> the attribute, regardless of the requirements and definitions below.</p>
  25494. <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>
  25495. <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>
  25496. <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>
  25497. <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
  25498. <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
  25499. <a href=#maximum-allowed-value-length id=the-maxlength-and-minlength-attributes:maximum-allowed-value-length-2>maximum allowed value length</a>.</p>
  25500. <div class=example>
  25501. <p>The following extract shows how a messaging client's text entry could be arbitrarily
  25502. restricted to a fixed number of characters, thus forcing any conversation through this medium to
  25503. be terse and discouraging intelligent discourse.</p>
  25504. <pre>&lt;label>What are you doing? &lt;input name=status maxlength=140>&lt;/label></pre>
  25505. </div>
  25506. <div class=example>
  25507. <p>Here, a password is given a minimum length:</p>
  25508. <pre>&lt;p>&lt;label>Username: &lt;input name=u required>&lt;/label>
  25509. &lt;p>&lt;label>Password: &lt;input name=p required minlength=12>&lt;/label></pre>
  25510. </div>
  25511. <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>
  25512. <p>The <dfn id=attr-input-size><code>size</code></dfn> attribute gives the number of
  25513. characters that, in a visual rendering, the user agent is to allow the user to see while editing
  25514. the element's <a href=#concept-fe-value id=the-size-attribute:concept-fe-value>value</a>.</p>
  25515. <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
  25516. 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>
  25517. <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
  25518. non-negative integers</a>, and if the result is a number greater than zero, then the user agent
  25519. should ensure that at least that many characters are visible.</p>
  25520. <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
  25521. non-negative numbers greater than zero</a> and has a default value of 20.</p>
  25522. <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>
  25523. <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
  25524. 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>
  25525. <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>
  25526. element, the element is <a href=#barred-from-constraint-validation id=the-readonly-attribute:barred-from-constraint-validation>barred from constraint validation</a>.</p>
  25527. <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
  25528. user can still select the text and interact with it, whereas disabled controls are entirely
  25529. non-interactive. (For this reason, only text controls can be made read-only: it wouldn't make
  25530. sense for checkboxes or buttons, for instances.)</p>
  25531. <div class=example>
  25532. <p>In the following example, the existing product identifiers cannot be modified, but they are
  25533. still displayed as part of the form, for consistency with the row representing a new product
  25534. (where the identifier is not yet filled in).</p>
  25535. <pre>&lt;form action="products.cgi" method="post" enctype="multipart/form-data">
  25536. &lt;table>
  25537. &lt;tr> &lt;th> Product ID &lt;th> Product name &lt;th> Price &lt;th> Action
  25538. &lt;tr>
  25539. &lt;td> &lt;input readonly="readonly" name="1.pid" value="H412">
  25540. &lt;td> &lt;input required="required" name="1.pname" value="Floor lamp Ulke">
  25541. &lt;td> $&lt;input required="required" type="number" min="0" step="0.01" name="1.pprice" value="49.99">
  25542. &lt;td> &lt;button formnovalidate="formnovalidate" name="action" value="delete:1">Delete&lt;/button>
  25543. &lt;tr>
  25544. &lt;td> &lt;input readonly="readonly" name="2.pid" value="FG28">
  25545. &lt;td> &lt;input required="required" name="2.pname" value="Table lamp Ulke">
  25546. &lt;td> $&lt;input required="required" type="number" min="0" step="0.01" name="2.pprice" value="24.99">
  25547. &lt;td> &lt;button formnovalidate="formnovalidate" name="action" value="delete:2">Delete&lt;/button>
  25548. &lt;tr>
  25549. &lt;td> &lt;input required="required" name="3.pid" value="" pattern="[A-Z0-9]+">
  25550. &lt;td> &lt;input required="required" name="3.pname" value="">
  25551. &lt;td> $&lt;input required="required" type="number" min="0" step="0.01" name="3.pprice" value="">
  25552. &lt;td> &lt;button formnovalidate="formnovalidate" name="action" value="delete:3">Delete&lt;/button>
  25553. &lt;/table>
  25554. &lt;p> &lt;button formnovalidate="formnovalidate" name="action" value="add">Add&lt;/button> &lt;/p>
  25555. &lt;p> &lt;button name="action" value="update">Save&lt;/button> &lt;/p>
  25556. &lt;/form></pre>
  25557. </div>
  25558. <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>
  25559. <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
  25560. attribute</a>. When specified, the element is <dfn id=concept-input-required><i>required</i></dfn>.</p>
  25561. <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>
  25562. 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
  25563. from being missing</a>.</p>
  25564. <div class=example>
  25565. <p>The following form has two required fields, one for an e-mail address and one for a password.
  25566. It also has a third field that is only considered valid if the user types the same password in
  25567. the password field and this third field.</p>
  25568. <pre>&lt;h1>Create new account&lt;/h1>
  25569. &lt;form action="/newaccount" method=post
  25570. oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')">
  25571. &lt;p>
  25572. &lt;label for="username">E-mail address:&lt;/label>
  25573. &lt;input id="username" type=email required name=un>
  25574. &lt;p>
  25575. &lt;label for="password1">Password:&lt;/label>
  25576. &lt;input id="password1" type=password required name=up>
  25577. &lt;p>
  25578. &lt;label for="password2">Confirm password:&lt;/label>
  25579. &lt;input id="password2" type=password name=up2>
  25580. &lt;p>
  25581. &lt;input type=submit value="Create account">
  25582. &lt;/form></pre>
  25583. </div>
  25584. <div class=example>
  25585. <p>For radio buttons, the <code id=the-required-attribute:attr-input-required-2><a href=#attr-input-required>required</a></code> attribute is
  25586. satisfied if any of the radio buttons in the <a href=#radio-button-group id=the-required-attribute:radio-button-group>group</a> is
  25587. selected. Thus, in the following example, any of the radio buttons can be checked, not just the
  25588. one marked as required:</p>
  25589. <pre>&lt;fieldset>
  25590. &lt;legend>Did the movie pass the Bechdel test?&lt;/legend>
  25591. &lt;p>&lt;label>&lt;input type="radio" name="bechdel" value="no-characters"> No, there are not even two female characters in the movie. &lt;/label>
  25592. &lt;p>&lt;label>&lt;input type="radio" name="bechdel" value="no-names"> No, the female characters never talk to each other. &lt;/label>
  25593. &lt;p>&lt;label>&lt;input type="radio" name="bechdel" value="no-topic"> No, when female characters talk to each other it's always about a male character. &lt;/label>
  25594. &lt;p>&lt;label>&lt;input type="radio" name="bechdel" value="yes" <strong>required</strong>> Yes. &lt;/label>
  25595. &lt;p>&lt;label>&lt;input type="radio" name="bechdel" value="unknown"> I don't know. &lt;/label>
  25596. &lt;/fieldset></pre>
  25597. <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
  25598. are encouraged to specify the attribute on all the radio buttons in a group. Indeed, in general,
  25599. authors are encouraged to avoid having radio button groups that do not have any initially checked
  25600. controls in the first place, as this is a state that the user cannot return to, and is therefore
  25601. generally considered a poor user interface.</p>
  25602. </div>
  25603. <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>
  25604. <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
  25605. attribute</a> that indicates whether the user is to be allowed to specify more than one
  25606. value.</p>
  25607. <div class=example>
  25608. <p>The following extract shows how an e-mail client's "Cc" field could accept multiple e-mail
  25609. addresses.</p>
  25610. <pre>&lt;label>Cc: &lt;input type=email multiple name=cc>&lt;/label></pre>
  25611. <p>If the user had, amongst many friends in his user contacts database, two friends "Arthur Dent"
  25612. (with address "art@example.net") and "Adam Josh" (with address "adamjosh@example.net"), then,
  25613. after the user has typed "a", the user agent might suggest these two e-mail addresses to the
  25614. user.</p>
  25615. <p><img src=http://images.whatwg.org/sample-email-1.png width=500 alt="" height=140></p>
  25616. <p>The page could also link in the user's contacts database from the site:</p>
  25617. <pre>&lt;label>Cc: &lt;input type=email multiple name=cc list=contacts>&lt;/label>
  25618. ...
  25619. &lt;datalist id="contacts">
  25620. &lt;option value="hedral@damowmow.com">
  25621. &lt;option value="pillar@example.com">
  25622. &lt;option value="astrophy@cute.example">
  25623. &lt;option value="astronomy@science.example.org">
  25624. &lt;/datalist></pre>
  25625. <p>Suppose the user had entered "bob@example.net" into this text field, and then started typing a
  25626. second e-mail address starting with "a". The user agent might show both the two friends mentioned
  25627. 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>
  25628. element.</p>
  25629. <p><img src=http://images.whatwg.org/sample-email-2.png width=500 alt="" height=171></p>
  25630. </div>
  25631. <div class=example>
  25632. <p>The following extract shows how an e-mail client's "Attachments" field could accept multiple
  25633. files for upload.</p>
  25634. <pre>&lt;label>Attachments: &lt;input type=file multiple name=att>&lt;/label></pre>
  25635. </div>
  25636. <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>
  25637. <p>The <dfn id=attr-input-pattern><code>pattern</code></dfn> attribute specifies a regular
  25638. expression against which the control's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value>value</a>, or, when the
  25639. <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>
  25640. <p>If specified, the attribute's value must match the JavaScript <i>Pattern</i>
  25641. production. <a href=#refsECMA262>[ECMA262]</a></p>
  25642. <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>
  25643. attribute specified, and the attribute's value, when compiled as a JavaScript regular expression
  25644. 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
  25645. through 15.10.7.4), compiles successfully, then the resulting regular expression is the element's
  25646. <dfn id=compiled-pattern-regular-expression>compiled pattern regular expression</dfn>. If the element has no such attribute, or if the
  25647. 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
  25648. expression</a>. <a href=#refsECMA262>[ECMA262]</a></p>
  25649. <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
  25650. <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
  25651. entirety of the element's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value-3>value</a>, then the element is
  25652. <a href=#suffering-from-a-pattern-mismatch id=the-pattern-attribute:suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p>
  25653. <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
  25654. 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
  25655. entirety of each of the element's <a href=#concept-fe-values id=the-pattern-attribute:concept-fe-values-2>values</a>, then the
  25656. 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>
  25657. <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
  25658. its start anchored to the start of the string and its end anchored to the end of the string.</p>
  25659. <p class=note>This implies that the regular expression language used for this attribute is the
  25660. 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>
  25661. attribute is matched against the entire value, not just any subset (somewhat as if it implied a
  25662. <code>^(?:</code> at the start of the pattern and a <code>)$</code> at the
  25663. end).</p>
  25664. <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>
  25665. attribute specified, authors should include a <dfn id=attr-input-title><code>title</code></dfn> attribute to give a description of the pattern.
  25666. User agents may use the contents of this attribute, if it is present, when informing the user that
  25667. the pattern is not matched, or at any other suitable time, such as in a tooltip or read out by
  25668. assistive technology when the control <a href=#gains-focus id=the-pattern-attribute:gains-focus>gains focus</a>.</p>
  25669. <div class=example>
  25670. <p>For example, the following snippet:</p>
  25671. <pre>&lt;label> Part number:
  25672. &lt;input pattern="[0-9][A-Z]{3}" name="part"
  25673. title="A part number is a digit followed by three uppercase letters."/>
  25674. &lt;/label></pre>
  25675. <p>...could cause the UA to display an alert such as:</p>
  25676. <pre><samp>A part number is a digit followed by three uppercase letters.
  25677. You cannot submit this form when the field is incorrect.</samp></pre>
  25678. </div>
  25679. <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
  25680. information could also be included, so long as it assists the user in filling in the control.
  25681. Otherwise, assistive technology would be impaired.</p>
  25682. <p class=example>For instance, if the title attribute contained the caption of the control,
  25683. assistive technology could end up saying something like <samp>The text you have entered does not
  25684. match the required pattern. Birthday</samp>, which is not useful.</p>
  25685. <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
  25686. example, as a tooltip when hovering over the control), so authors should be careful not to word
  25687. <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>
  25688. <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>
  25689. <p>Some form controls can have explicit constraints applied limiting the allowed range of values
  25690. that the user can provide. Normally, such a range would be linear and continuous. A form control
  25691. can <dfn id=has-a-periodic-domain>have a periodic domain</dfn>, however, in which case the
  25692. form control's broadest possible range is finite, and authors can specify explicit ranges within
  25693. it that span the boundaries.</p>
  25694. <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
  25695. authors can set both continuous linear ranges (such as 9pm to 11pm) and discontinuous ranges
  25696. spanning midnight (such as 11pm to 1am).</p>
  25697. <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
  25698. the element.</p>
  25699. <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>
  25700. <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
  25701. 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
  25702. 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,
  25703. then that number is the element's <dfn id=concept-input-min>minimum</dfn>; otherwise, if the
  25704. <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>
  25705. <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>
  25706. <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
  25707. 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
  25708. 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,
  25709. then that number is the element's <dfn id=concept-input-max>maximum</dfn>; otherwise, if the
  25710. <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>
  25711. <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
  25712. <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>
  25713. <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
  25714. 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>
  25715. or <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow>suffering from an overflow</a>.</p>
  25716. <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
  25717. <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>
  25718. <p>An element <dfn id=have-range-limitations>has range limitations</dfn> if it has a defined
  25719. <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>
  25720. <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>
  25721. <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
  25722. 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>
  25723. <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
  25724. 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
  25725. 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
  25726. 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
  25727. underflow</a>.</p>
  25728. <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
  25729. 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
  25730. 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
  25731. 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
  25732. overflow</a>.</p>
  25733. <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>,
  25734. 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
  25735. 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
  25736. 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
  25737. 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>
  25738. <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
  25739. 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>
  25740. <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
  25741. 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
  25742. 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
  25743. <a href=#suffering-from-an-underflow id=the-min-and-max-attributes:suffering-from-an-underflow-4>suffering from an underflow</a>.</p>
  25744. <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
  25745. 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
  25746. 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
  25747. <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow-4>suffering from an overflow</a>.</p>
  25748. </dl>
  25749. <div class=example>
  25750. <p>The following date control limits input to dates that are before the 1980s:</p>
  25751. <pre>&lt;input name=bday type=date max="1979-12-31"></pre>
  25752. </div>
  25753. <div class=example>
  25754. <p>The following number control limits input to whole numbers greater than zero:</p>
  25755. <pre>&lt;input name=quantity required="" type="number" min="1" value="1"></pre>
  25756. </div>
  25757. <div class=example>
  25758. <p>The following time control limits input to those minutes that occur between 9pm and 6am,
  25759. defaulting to midnight:</p>
  25760. <pre>&lt;input name="sleepStart" type=time min="21:00" max="06:00" step="60" value="00:00"></pre>
  25761. </div>
  25762. <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>
  25763. <p>The <dfn id=attr-input-step><code>step</code></dfn> attribute indicates the granularity
  25764. 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
  25765. 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
  25766. 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
  25767. attribute as described below.</p>
  25768. <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
  25769. 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
  25770. 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>
  25771. <p>The attribute provides the <dfn id=concept-input-step>allowed value step</dfn> for the
  25772. element, as follows:</p>
  25773. <ol><li>If the attribute is absent, then the <a href=#concept-input-step id=the-step-attribute:concept-input-step>allowed value
  25774. step</a> is the <a href=#concept-input-step-default id=the-step-attribute:concept-input-step-default>default step</a> multiplied by the
  25775. <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
  25776. string "<code>any</code>", then there is no <a href=#concept-input-step id=the-step-attribute:concept-input-step-2>allowed
  25777. 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
  25778. applied to the attribute's value, return an error, zero, or a number less than zero, then the
  25779. <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
  25780. 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
  25781. 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
  25782. factor</a>.</ol>
  25783. <p>The <dfn id=concept-input-min-zero>step base</dfn> is the value returned by the following
  25784. algorithm:</p>
  25785. <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
  25786. result of applying the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number>algorithm to convert a
  25787. 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
  25788. attribute is not an error, then return that result and abort these steps.<li>
  25789. <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
  25790. 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
  25791. 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,
  25792. then return that result and abort these steps.</p>
  25793. <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>
  25794. <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
  25795. 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
  25796. 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
  25797. 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
  25798. steps.</ol>
  25799. <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
  25800. 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
  25801. it and abort these steps.</p>
  25802. <li><p>Return zero.</ol>
  25803. <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>
  25804. <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
  25805. 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>
  25806. <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
  25807. 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
  25808. 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
  25809. integral multiple of the <a href=#concept-input-step id=the-step-attribute:concept-input-step-6>allowed value step</a>, the
  25810. 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>
  25811. <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
  25812. 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>
  25813. <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
  25814. 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
  25815. 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
  25816. integral multiple of the <a href=#concept-input-step id=the-step-attribute:concept-input-step-7>allowed value step</a>, the
  25817. 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>
  25818. </dl>
  25819. <div class=example>
  25820. <p>The following range control only accepts values in the range 0..1, and allows 256 steps in
  25821. that range:</p>
  25822. <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863></pre>
  25823. </div>
  25824. <div class=example>
  25825. <p>The following control allows any time in the day to be selected, with any accuracy (e.g.
  25826. thousandth-of-a-second accuracy or more):</p>
  25827. <pre>&lt;input name=favtime type=time step=any></pre>
  25828. <p>Normally, time controls are limited to an accuracy of one minute.</p>
  25829. </div>
  25830. <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>
  25831. <p>The <dfn id=attr-input-list><code>list</code></dfn> attribute is used to identify an
  25832. element that lists predefined options suggested to the user.</p>
  25833. <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>
  25834. element in the same document.</p>
  25835. <p>The <dfn id=concept-input-list>suggestions source element</dfn> is the first element in
  25836. 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
  25837. 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
  25838. <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,
  25839. 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
  25840. 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
  25841. no <a href=#concept-input-list id=the-list-attribute:concept-input-list>suggestions source element</a>.</p>
  25842. <p>If there is a <a href=#concept-input-list id=the-list-attribute:concept-input-list-2>suggestions source element</a>, then, when
  25843. 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
  25844. the <a href=#concept-input-list id=the-list-attribute:concept-input-list-3>suggestions source element</a> to the user in a manner
  25845. 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>
  25846. <p>How user selections of suggestions are handled depends on whether the element is a control
  25847. accepting a single value only, or whether it accepts multiple values:</p>
  25848. <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
  25849. 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>
  25850. <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>
  25851. <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>
  25852. <p>When the user selects a suggestion, the user agent must identify which value in the element's
  25853. <a href=#concept-fe-values id=the-list-attribute:concept-fe-values>values</a> the user intended to update, and must then update
  25854. the element's <a href=#concept-fe-values id=the-list-attribute:concept-fe-values-2>values</a> so that the relevant value is
  25855. 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>
  25856. <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>
  25857. <p>When the user selects a suggestion, the user agent must either add a new entry to the
  25858. <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
  25859. is the selected suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value-3>value</a>, or change an
  25860. 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
  25861. suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value-4>value</a>, as if the user had himself added
  25862. an entry with that value, or edited an existing entry to be that value. Which behavior is to be
  25863. applied depends on the user interface in a user-agent-defined manner.</p>
  25864. </dl>
  25865. <hr>
  25866. <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
  25867. apply</a>, there is no <a href=#concept-input-list id=the-list-attribute:concept-input-list-4>suggestions source element</a>.</p>
  25868. <div class=example>
  25869. <p>This URL field offers some suggestions.</p>
  25870. <pre>&lt;label>Homepage: &lt;input name=hp type=url list=hpurls>&lt;/label>
  25871. &lt;datalist id=hpurls>
  25872. &lt;option value="http://www.google.com/" label="Google">
  25873. &lt;option value="http://www.reddit.com/" label="Reddit">
  25874. &lt;/datalist></pre>
  25875. <p>Other URLs from the user's history might show also; this is up to the user agent.</p>
  25876. </div>
  25877. <div class=example>
  25878. <p>This example demonstrates how to design a form that uses the autocompletion list feature while
  25879. still degrading usefully in legacy user agents.</p>
  25880. <p>If the autocompletion list is merely an aid, and is not important to the content, then simply
  25881. 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
  25882. prevent the values from being rendered in legacy user agents, they need to be placed inside the
  25883. <code id=the-list-attribute:attr-option-value><a href=#attr-option-value>value</a></code> attribute instead of inline.</p>
  25884. <pre>&lt;p>
  25885. &lt;label>
  25886. Enter a breed:
  25887. &lt;input type="text" name="breed" list="breeds">
  25888. &lt;datalist id="breeds">
  25889. &lt;option value="Abyssinian">
  25890. &lt;option value="Alpaca">
  25891. &lt;!-- ... -->
  25892. &lt;/datalist>
  25893. &lt;/label>
  25894. &lt;/p></pre>
  25895. <p>However, if the values need to be shown in legacy UAs, then fallback content can be placed
  25896. inside the <code id=the-list-attribute:the-datalist-element-5><a href=#the-datalist-element>datalist</a></code> element, as follows:</p>
  25897. <pre>&lt;p>
  25898. &lt;label>
  25899. Enter a breed:
  25900. &lt;input type="text" name="breed" list="breeds">
  25901. &lt;/label>
  25902. &lt;datalist id="breeds">
  25903. &lt;label>
  25904. or select one from the list:
  25905. &lt;select name="breed">
  25906. &lt;option value=""> (none selected)
  25907. &lt;option>Abyssinian
  25908. &lt;option>Alpaca
  25909. &lt;!-- ... -->
  25910. &lt;/select>
  25911. &lt;/label>
  25912. &lt;/datalist>
  25913. &lt;/p>
  25914. </pre>
  25915. <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
  25916. options, on the other hand, will be detected by all UAs, even though they are not children of the
  25917. <code id=the-list-attribute:the-datalist-element-7><a href=#the-datalist-element>datalist</a></code> element.</p>
  25918. <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
  25919. (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
  25920. <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>
  25921. </div>
  25922. <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>
  25923. <p>The <dfn id=attr-input-placeholder><code>placeholder</code></dfn> attribute represents a
  25924. <em>short</em> hint (a word or short phrase) intended to aid the user with data entry when the
  25925. control has no value. A hint could be a sample value or a brief description of the expected
  25926. format. The attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or
  25927. U+000D CARRIAGE RETURN (CR) characters.</p>
  25928. <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
  25929. 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>
  25930. <p class=note>These mechanisms are very similar but subtly different: the hint given by the
  25931. 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
  25932. 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
  25933. requests further help.</p>
  25934. <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>
  25935. <p>If a user agent normally doesn't show this hint to the user when the control is
  25936. <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
  25937. 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
  25938. in that case the user will not have had an opportunity to examine the control before focusing
  25939. it.</p>
  25940. <div class=example>
  25941. <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>
  25942. <pre>&lt;fieldset>
  25943. &lt;legend>Mail Account&lt;/legend>
  25944. &lt;p>&lt;label>Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger">&lt;/label>&lt;/p>
  25945. &lt;p>&lt;label>Address: &lt;input type="email" name="address" placeholder="john@example.net">&lt;/label>&lt;/p>
  25946. &lt;p>&lt;label>Password: &lt;input type="password" name="password">&lt;/label>&lt;/p>
  25947. &lt;p>&lt;label>Description: &lt;input type="text" name="desc" placeholder="My Email Account">&lt;/label>&lt;/p>
  25948. &lt;/fieldset></pre>
  25949. </div>
  25950. <div class=example>
  25951. <p>In situations where the control's content has one directionality but the placeholder needs to
  25952. have a different directionality, Unicode's bidirectional-algorithm formatting characters can be
  25953. used in the attribute value:</p>
  25954. <pre>&lt;input name=t1 type=tel placeholder="<strong>&amp;#x202B;</strong> <bdo dir=rtl>رقم الهاتف 1</bdo> <strong>&amp;#x202E;</strong>">
  25955. &lt;input name=t2 type=tel placeholder="<strong>&amp;#x202B;</strong> <bdo dir=rtl>رقم الهاتف 2</bdo> <strong>&amp;#x202E;</strong>"></pre>
  25956. <p>For slightly more clarity, here's the same example using numeric character references instead of inline Arabic:</p>
  25957. <pre>&lt;input name=t1 type=tel placeholder="<strong>&amp;#x202B;</strong>&amp;#1585;&amp;#1602;&amp;#1605; &amp;#1575;&amp;#1604;&amp;#1607;&amp;#1575;&amp;#1578;&amp;#1601; 1<strong>&amp;#x202E;</strong>">
  25958. &lt;input name=t2 type=tel placeholder="<strong>&amp;#x202B;</strong>&amp;#1585;&amp;#1602;&amp;#1605; &amp;#1575;&amp;#1604;&amp;#1607;&amp;#1575;&amp;#1578;&amp;#1601; 2<strong>&amp;#x202E;</strong>"></pre>
  25959. </div>
  25960. <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>
  25961. <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>
  25962. <p>Returns the current <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value>value</a> of the form control.</p>
  25963. <p>Can be set, to change the value.</p>
  25964. <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
  25965. empty string when the control is a file upload control.</p>
  25966. <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>
  25967. <p>Returns the current <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked>checkedness</a> of the form
  25968. control.</p>
  25969. <p>Can be set, to change the <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked-2>checkedness</a>.</p>
  25970. <dt><var>input</var> . <code id=common-input-element-apis:dom-input-files><a href=#dom-input-files>files</a></code> <dd>
  25971. <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>
  25972. <p>Returns null if the control isn't a file control.</p>
  25973. <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>
  25974. <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>
  25975. <p>Can be set, to change the value.</p>
  25976. <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
  25977. time-based.</p>
  25978. <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>
  25979. <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>,
  25980. if applicable; otherwise, returns NaN.</p>
  25981. <p>Can be set, to change the value. Setting this to NaN will set the underlying value to the
  25982. empty string.</p>
  25983. <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
  25984. time-based nor numeric.</p>
  25985. <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>
  25986. <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>
  25987. <p>Can be set, to change the value.</p>
  25988. <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
  25989. control.</p>
  25990. <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>
  25991. <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
  25992. the <code id=common-input-element-apis:attr-input-step><a href=#attr-input-step>step</a></code> attribute, multiplied by <var>n</var>.
  25993. The default value for <var>n</var> is 1.</p>
  25994. <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
  25995. 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>
  25996. <dt><var>input</var> . <code id=common-input-element-apis:dom-input-list><a href=#dom-input-list>list</a></code><dd>
  25997. <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>
  25998. </dl>
  25999. <p>The <dfn id=dom-input-value><code>value</code></dfn> IDL attribute allows scripts to
  26000. 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
  26001. attribute is in one of the following modes, which define its behavior:</p>
  26002. <dl><dt><dfn id=dom-input-value-value>value</dfn>
  26003. <dd>
  26004. <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
  26005. 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
  26006. 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
  26007. 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
  26008. <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
  26009. the element has a text entry cursor position, should move the text entry cursor position to the
  26010. end of the text field, unselecting any selected text and resetting the selection direction to
  26011. <i>none</i>.</p>
  26012. <dt><dfn id=dom-input-value-default>default</dfn>
  26013. <dd>
  26014. <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
  26015. must return that attribute's value; otherwise, it must return the empty string. On setting, it
  26016. 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
  26017. value.</p>
  26018. <dt><dfn id=dom-input-value-default-on>default/on</dfn>
  26019. <dd>
  26020. <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
  26021. 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>
  26022. <dt><dfn id=dom-input-value-filename>filename</dfn>
  26023. <dd id=fakepath-orly>
  26024. <p>On getting, it must return the string "<code>C:\fakepath\</code>" followed by the
  26025. 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
  26026. files</a>, if any, or the empty string if the list is empty. On setting, if the new value is
  26027. 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
  26028. <code id=common-input-element-apis:invalidstateerror-6><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
  26029. <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
  26030. information.</p>
  26031. <p class=note>Since <a href=#concept-input-file-path id=common-input-element-apis:concept-input-file-path>path components</a> are not
  26032. 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
  26033. files</a>, the "\fakepath\" cannot be mistaken for a path component.</p>
  26034. </dl>
  26035. <hr>
  26036. <p>The <dfn id=dom-input-checked><code>checked</code></dfn> IDL attribute allows scripts to
  26037. 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>
  26038. 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
  26039. 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
  26040. element's <a href=#concept-input-checked-dirty-flag id=common-input-element-apis:concept-input-checked-dirty-flag>dirty checkedness flag</a> to
  26041. true.</p>
  26042. <hr>
  26043. <p>The <dfn id=dom-input-files><code>files</code></dfn> IDL attribute allows scripts to
  26044. 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
  26045. getting, if the IDL attribute <a href=#concept-input-apply id=common-input-element-apis:concept-input-apply>applies</a>, it must return a
  26046. <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
  26047. 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
  26048. 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
  26049. null. <a href=#refsFILEAPI>[FILEAPI]</a></p>
  26050. <hr>
  26051. <p>The <dfn id=dom-input-valueasdate><code>valueAsDate</code></dfn> IDL attribute represents
  26052. 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>
  26053. <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
  26054. 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
  26055. <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
  26056. return it, otherwise, return null.</p>
  26057. <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
  26058. <code id=common-input-element-apis:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception; otherwise, if the new value is null or a
  26059. <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
  26060. <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
  26061. 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>
  26062. <hr>
  26063. <p>The <dfn id=dom-input-valueasnumber><code>valueAsNumber</code></dfn> IDL attribute
  26064. represents the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-13>value</a> of the element, interpreted as a
  26065. number.</p>
  26066. <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)
  26067. 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>
  26068. 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>
  26069. 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
  26070. return the <i>time value</i> of the object (the number of milliseconds from midnight UTC the
  26071. 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
  26072. 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>
  26073. 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
  26074. algorithm returned a number, then return it, otherwise, return a Not-a-Number (NaN) value.</p>
  26075. <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.
  26076. 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
  26077. <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)
  26078. 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
  26079. 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>
  26080. 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
  26081. 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
  26082. 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
  26083. 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
  26084. 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>
  26085. of the element to the resulting string.</p>
  26086. <hr>
  26087. <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
  26088. numbers.</p>
  26089. <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>
  26090. 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;
  26091. otherwise, run the following steps:</p>
  26092. <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
  26093. 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
  26094. 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>
  26095. 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
  26096. the lowest of the values in <var>values</var>; otherwise, return the highest of the
  26097. values in <var>values</var>.</ol>
  26098. <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>
  26099. 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
  26100. <code id=common-input-element-apis:invalidstateerror-9><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, run the following steps:</p>
  26101. <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
  26102. 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
  26103. 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>
  26104. 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
  26105. 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
  26106. the lower value in <var>values</var> with <var>new value</var>; otherwise,
  26107. replace the higher value in <var>values</var> with <var>new
  26108. 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
  26109. 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>
  26110. 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
  26111. 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
  26112. by a U+002C COMMA character (,).</ol>
  26113. <hr>
  26114. <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,
  26115. must run the following algorithm:</p>
  26116. <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
  26117. <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,
  26118. 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
  26119. 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>
  26120. 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>
  26121. <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
  26122. 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
  26123. <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>
  26124. <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
  26125. 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>
  26126. be zero.<li>
  26127. <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
  26128. 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
  26129. step</a>, then set <var>value</var> to the nearest value that, when subtracted from
  26130. 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>
  26131. otherwise.</p>
  26132. <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>
  26133. <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
  26134. 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,
  26135. negate <var>delta</var>.<li><p>Let <var>value</var> be the result of adding <var>delta</var> to <var>value</var>.</ol>
  26136. <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
  26137. <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
  26138. 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
  26139. 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>
  26140. 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
  26141. as string</var>.</ol>
  26142. <hr>
  26143. <p>The <dfn id=dom-input-list><code>list</code></dfn> IDL attribute must return the current
  26144. <a href=#concept-input-list id=common-input-element-apis:concept-input-list>suggestions source element</a>, if any, or null otherwise.</p>
  26145. <h5 id=common-input-element-events>4.10.5.5 Common event behaviors</h5>
  26146. <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>
  26147. (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
  26148. user has interacted with the control. The <dfn id=event-input-input><code>input</code></dfn>
  26149. 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
  26150. 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>
  26151. <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
  26152. for dispatching these events, if they <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-2>apply</a>, are given
  26153. 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
  26154. 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>
  26155. <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
  26156. which these events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-3>apply</a>, and for which the user
  26157. interface involves both interactive manipulation and an explicit commit action, then when the user
  26158. changes the element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value>value</a>, the user agent must
  26159. <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
  26160. 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
  26161. 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
  26162. <code id=common-input-element-events:the-input-element-6><a href=#the-input-element>input</a></code> element.</p>
  26163. <p class=example>An example of a user interface involving both interactive manipulation and a
  26164. 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
  26165. slider, when manipulated using a pointing device. While the user is dragging the control's knob,
  26166. <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,
  26167. 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
  26168. let go of the knob, committing to a specific value.</p>
  26169. <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
  26170. which these events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-4>apply</a>, and for which the user
  26171. interface involves an explicit commit action but no intermediate manipulation, then any time the
  26172. 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
  26173. 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
  26174. <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
  26175. <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>
  26176. <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
  26177. 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
  26178. is closed, then that would be the explicit commit action. On the other hand, if manipulating the
  26179. control changes the colour interactively, then there might be no commit action.</p>
  26180. <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
  26181. selection from a drop-down calendar: while text input might not have an explicit commit step,
  26182. selecting a date from the drop down calendar and then dismissing the drop down would be a commit
  26183. action.</p>
  26184. <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
  26185. 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
  26186. element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-4>value</a> to change without an explicit commit
  26187. 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
  26188. 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
  26189. 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
  26190. the control <a href=#unfocus-causes-change-event>loses focus</a>.</p>
  26191. <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
  26192. new value into the field, or undoing an edit in that field. Some user interactions do not cause
  26193. changes to the value, e.g. hitting the "delete" key in an empty text field, or replacing some text
  26194. in the field with text from the clipboard that happens to be exactly the same text.</p>
  26195. <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
  26196. 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
  26197. 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>
  26198. without a commit step.</p>
  26199. <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
  26200. 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
  26201. user agent could wait for the user to have not hit a key for 100ms, so as to only fire the event
  26202. when the user pauses, instead of continuously for each keystroke.
  26203. <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
  26204. 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
  26205. 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,
  26206. 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>
  26207. <p class=note>These events are not fired in response to changes made to the values of form
  26208. controls by scripts. (This is to make it easier to update the values of form controls in response
  26209. to the user manipulating the controls, without having to then filter out the script's own changes
  26210. to avoid an infinite loop.)</p>
  26211. <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
  26212. <a href=#user-interaction-task-source id=common-input-element-events:user-interaction-task-source>user interaction task source</a>.</p>
  26213. <h4 id=the-button-element>4.10.6 The <dfn><code>button</code></dfn> element</h4>
  26214. <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>
  26215. <pre class=idl>interface <dfn id=htmlbuttonelement>HTMLButtonElement</dfn> : <a href=#htmlelement id=the-button-element:htmlelement>HTMLElement</a> {
  26216. attribute boolean <a href=#dom-fe-autofocus id=the-button-element:dom-fe-autofocus>autofocus</a>;
  26217. attribute boolean <a href=#dom-fe-disabled id=the-button-element:dom-fe-disabled>disabled</a>;
  26218. 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>;
  26219. attribute DOMString <a href=#dom-fs-formaction id=the-button-element:dom-fs-formaction>formAction</a>;
  26220. attribute DOMString <a href=#dom-fs-formenctype id=the-button-element:dom-fs-formenctype>formEnctype</a>;
  26221. attribute DOMString <a href=#dom-fs-formmethod id=the-button-element:dom-fs-formmethod>formMethod</a>;
  26222. attribute boolean <a href=#dom-fs-formnovalidate id=the-button-element:dom-fs-formnovalidate>formNoValidate</a>;
  26223. attribute DOMString <a href=#dom-fs-formtarget id=the-button-element:dom-fs-formtarget>formTarget</a>;
  26224. attribute DOMString <a href=#dom-fe-name id=the-button-element:dom-fe-name>name</a>;
  26225. attribute DOMString <a href=#dom-button-type id=the-button-element:dom-button-type>type</a>;
  26226. attribute DOMString <a href=#dom-button-value id=the-button-element:dom-button-value>value</a>;
  26227. 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>;
  26228. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-button-element:dom-cva-willvalidate>willValidate</a>;
  26229. 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>;
  26230. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-button-element:dom-cva-validationmessage>validationMessage</a>;
  26231. boolean <a href=#dom-cva-checkvalidity id=the-button-element:dom-cva-checkvalidity>checkValidity</a>();
  26232. boolean <a href=#dom-cva-reportvalidity id=the-button-element:dom-cva-reportvalidity>reportValidity</a>();
  26233. void <a href=#dom-cva-setcustomvalidity id=the-button-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  26234. 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>;
  26235. };</pre>
  26236. </dl>
  26237. <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>
  26238. <p>The element is a <a href=#concept-button id=the-button-element:concept-button>button</a>.</p>
  26239. <p>The <dfn id=attr-button-type><code>type</code></dfn> attribute controls the behavior of
  26240. 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
  26241. lists the keywords and states for the attribute — the keywords in the left column map to the
  26242. states in the cell in the second column on the same row as the keyword.</p>
  26243. <table><thead><tr><th> Keyword
  26244. <th> State
  26245. <th> Brief description
  26246. <tbody><tr><td><dfn id=attr-button-type-submit><code>submit</code></dfn>
  26247. <td><a href=#attr-button-type-submit-state id=the-button-element:attr-button-type-submit-state>Submit Button</a>
  26248. <td>Submits the form.
  26249. <tr><td><dfn id=attr-button-type-reset><code>reset</code></dfn>
  26250. <td><a href=#attr-button-type-reset-state id=the-button-element:attr-button-type-reset-state>Reset Button</a>
  26251. <td>Resets the form.
  26252. <tr><td><dfn id=attr-button-type-button><code>button</code></dfn>
  26253. <td><a href=#attr-button-type-button-state id=the-button-element:attr-button-type-button-state>Button</a>
  26254. <td>Does nothing.
  26255. <tr><td><dfn id=attr-button-type-menu><code>menu</code></dfn>
  26256. <td><a href=#attr-button-type-menu-state id=the-button-element:attr-button-type-menu-state>Menu</a>
  26257. <td>Shows a menu.
  26258. </table>
  26259. <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
  26260. Button</a> state.</p>
  26261. <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
  26262. <a href=#concept-submit-button id=the-button-element:concept-submit-button>submit button</a>.</p>
  26263. <p><strong>Constraint validation</strong>: If the <code id=the-button-element:attr-button-type-3><a href=#attr-button-type>type</a></code>
  26264. 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
  26265. <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
  26266. validation</a>.</p>
  26267. <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>,
  26268. 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
  26269. 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>
  26270. <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
  26271. <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
  26272. <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
  26273. <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
  26274. <a href=#form-owner id=the-button-element:form-owner-4>form owner</a>.<dt> <dfn id=attr-button-type-button-state>Button</dfn>
  26275. <dd><p>Do nothing.<dt> <dfn id=attr-button-type-menu-state>Menu</dfn>
  26276. <dd>
  26277. <p>The element must follow these steps:</p>
  26278. <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
  26279. 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
  26280. 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
  26281. 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>
  26282. interface, with the <code id=the-button-element:dom-relatedevent-relatedtarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
  26283. 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
  26284. 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
  26285. subject.</ol>
  26286. </dl>
  26287. <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
  26288. <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
  26289. 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>
  26290. 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
  26291. submission</a>.</p>
  26292. <p class=note>The <code id=the-button-element:attr-fs-formnovalidate-3><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can be
  26293. used to make submit buttons that do not trigger the constraint validation.</p>
  26294. <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>
  26295. <p>The <dfn id=attr-button-value><code>value</code></dfn> attribute gives the element's value
  26296. for the purposes of form submission. The element's <a href=#concept-fe-value id=the-button-element:concept-fe-value>value</a> is
  26297. 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
  26298. one, or the empty string otherwise.</p>
  26299. <p class=note>A button (and its value) is only included in the form submission if the button
  26300. itself was used to initiate the form submission.</p>
  26301. <hr>
  26302. <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
  26303. 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
  26304. 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
  26305. the <a href=#popup-menu-state id=the-button-element:popup-menu-state>popup menu</a> state. The attribute must not be specified if
  26306. 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>
  26307. <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
  26308. <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>
  26309. 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
  26310. 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
  26311. menu</a>.</p>
  26312. <hr>
  26313. <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
  26314. content attributes of the same name.</p>
  26315. <p>The <dfn id=dom-button-type><code>type</code></dfn> IDL attribute must
  26316. <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
  26317. values</a>.</p>
  26318. <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
  26319. <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
  26320. 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
  26321. part of the element's forms API.</p>
  26322. <div class=example>
  26323. <p>The following button is labeled "Show hint" and pops up a dialog box when activated:</p>
  26324. <pre>&lt;button type=button
  26325. onclick="alert('This 15-20 minute piece was composed by George Gershwin.')">
  26326. Show hint
  26327. &lt;/button></pre>
  26328. </div>
  26329. <h4 id=the-select-element>4.10.7 The <dfn><code>select</code></dfn> element</h4>
  26330. <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>
  26331. <pre class=idl>interface <dfn id=htmlselectelement>HTMLSelectElement</dfn> : <a href=#htmlelement id=the-select-element:htmlelement>HTMLElement</a> {
  26332. attribute DOMString <a href=#dom-fe-autocomplete id=the-select-element:dom-fe-autocomplete>autocomplete</a>;
  26333. attribute boolean <a href=#dom-fe-autofocus id=the-select-element:dom-fe-autofocus>autofocus</a>;
  26334. attribute boolean <a href=#dom-fe-disabled id=the-select-element:dom-fe-disabled>disabled</a>;
  26335. 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>;
  26336. attribute boolean <a href=#dom-select-multiple id=the-select-element:dom-select-multiple>multiple</a>;
  26337. attribute DOMString <a href=#dom-fe-name id=the-select-element:dom-fe-name>name</a>;
  26338. attribute boolean <a href=#dom-select-required id=the-select-element:dom-select-required>required</a>;
  26339. attribute unsigned long <a href=#dom-select-size id=the-select-element:dom-select-size>size</a>;
  26340. readonly attribute DOMString <a href=#dom-select-type id=the-select-element:dom-select-type>type</a>;
  26341. 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>;
  26342. attribute unsigned long <a href=#dom-select-length id=the-select-element:dom-select-length>length</a>;
  26343. 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);
  26344. <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);
  26345. 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);
  26346. void <a href=#dom-select-remove id=the-select-element:dom-select-remove>remove</a>(); // ChildNode overload
  26347. void <a href=#dom-select-remove id=the-select-element:dom-select-remove-2>remove</a>(long index);
  26348. <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);
  26349. 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>;
  26350. attribute long <a href=#dom-select-selectedindex id=the-select-element:dom-select-selectedindex>selectedIndex</a>;
  26351. attribute DOMString <a href=#dom-select-value id=the-select-element:dom-select-value>value</a>;
  26352. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-select-element:dom-cva-willvalidate>willValidate</a>;
  26353. 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>;
  26354. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-select-element:dom-cva-validationmessage>validationMessage</a>;
  26355. boolean <a href=#dom-cva-checkvalidity id=the-select-element:dom-cva-checkvalidity>checkValidity</a>();
  26356. boolean <a href=#dom-cva-reportvalidity id=the-select-element:dom-cva-reportvalidity>reportValidity</a>();
  26357. void <a href=#dom-cva-setcustomvalidity id=the-select-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  26358. 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>;
  26359. };</pre>
  26360. </dl>
  26361. <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
  26362. options.</p>
  26363. <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
  26364. 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
  26365. <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
  26366. <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
  26367. the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-2>list of options</a>.</p>
  26368. <p>The <dfn id=attr-select-size><code>size</code></dfn> attribute gives the number of options
  26369. 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
  26370. 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>
  26371. <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
  26372. 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
  26373. 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
  26374. 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>
  26375. <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>
  26376. 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>
  26377. 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
  26378. 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>
  26379. <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
  26380. attribute</a>. When specified, the user will be required to select a value before submitting
  26381. the form.</p>
  26382. <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>
  26383. attribute specified, does not have a <code id=the-select-element:attr-select-multiple-3><a href=#attr-select-multiple>multiple</a></code> attribute
  26384. 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
  26385. <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
  26386. 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
  26387. <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
  26388. <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>
  26389. <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>
  26390. attribute specified, does not have a <code id=the-select-element:attr-select-multiple-4><a href=#attr-select-multiple>multiple</a></code> attribute
  26391. specified, and has a <a href=#concept-select-size id=the-select-element:concept-select-size-3>display size</a> of 1, then the
  26392. <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>
  26393. <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
  26394. <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
  26395. <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
  26396. 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>
  26397. <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
  26398. is not <a href=#concept-fe-disabled id=the-select-element:concept-fe-disabled>disabled</a>, then the user agent should allow the
  26399. 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
  26400. of options</a> that is itself not <a href=#concept-option-disabled id=the-select-element:concept-option-disabled>disabled</a>. Upon
  26401. 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
  26402. 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
  26403. relevant user interaction event is queued (e.g. before the
  26404. <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
  26405. to true, set its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness>dirtiness</a> to true, and then
  26406. <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications>send <code>select</code> update notifications</a>.</p>
  26407. <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
  26408. <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
  26409. <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
  26410. <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>,
  26411. the user agent must set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-6>selectedness</a> of all
  26412. 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
  26413. options</a> to false.</p>
  26414. <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
  26415. 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
  26416. 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
  26417. 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
  26418. false, set its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-2>dirtiness</a> to true, and then
  26419. <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications-2>send <code>select</code> update notifications</a>.</p>
  26420. <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
  26421. <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
  26422. 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
  26423. first applicable set of steps from the following list:</p>
  26424. <dl class=switch><dt>If the <code id=the-select-element:the-select-element-19><a href=#the-select-element>select</a></code>
  26425. 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>
  26426. 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
  26427. options</a> have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-9>selectedness</a> set to
  26428. true<dd><p>Set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-10>selectedness</a> of the first
  26429. <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
  26430. 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
  26431. <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
  26432. false.</dl>
  26433. <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
  26434. element is not <a href=#concept-fe-disabled id=the-select-element:concept-fe-disabled-2>disabled</a>, then the user agent should
  26435. 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
  26436. 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
  26437. 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
  26438. 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
  26439. 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>
  26440. <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
  26441. 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
  26442. event</a> that bubbles named <code id=the-select-element:event-change><a href=#event-change>change</a></code> at the
  26443. <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
  26444. 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
  26445. 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
  26446. <a href=#concept-events-trusted id=the-select-element:concept-events-trusted>trusted</a>.</p>
  26447. <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>
  26448. 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>
  26449. element has a <code id=the-select-element:attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise,
  26450. set their <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-4>dirtiness</a> to false, and then have the
  26451. <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>
  26452. <p>
  26453. 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>.
  26454. The <code id=the-select-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
  26455. 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.
  26456. The <code id=the-select-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
  26457. 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.
  26458. </p>
  26459. <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
  26460. <i id=the-select-element:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>
  26461. <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>
  26462. <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>"
  26463. otherwise.</p>
  26464. <dt><var>select</var> . <code id=the-select-element:dom-select-options-2><a href=#dom-select-options>options</a></code><dd>
  26465. <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>
  26466. <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>
  26467. <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
  26468. options</a>.</p>
  26469. <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
  26470. <code id=the-select-element:the-select-element-27><a href=#the-select-element>select</a></code>.</p>
  26471. <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
  26472. <code id=the-select-element:the-select-element-28><a href=#the-select-element>select</a></code>.</p>
  26473. <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>
  26474. <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
  26475. order</a>.</p>
  26476. <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>
  26477. <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>
  26478. <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>
  26479. <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>
  26480. <p>Inserts <var>element</var> before the node given by <var>before</var>.</p>
  26481. <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
  26482. <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>
  26483. <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>
  26484. <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>
  26485. <dt><var>select</var> . <code id=the-select-element:dom-select-selectedoptions-2><a href=#dom-select-selectedoptions>selectedOptions</a></code><dd>
  26486. <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
  26487. of options</a> that are selected.</p>
  26488. <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>
  26489. <p>Returns the index of the first selected item, if any, or −1 if there is no selected
  26490. item.</p>
  26491. <p>Can be set, to change the selection.</p>
  26492. <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>
  26493. <p>Returns the <a href=#concept-option-value id=the-select-element:concept-option-value-2>value</a> of the first selected item, if
  26494. any, or the empty string if there is no selected item.</p>
  26495. <p>Can be set, to change the selection.</p>
  26496. </dl>
  26497. <p>The <dfn id=dom-select-type><code>type</code></dfn> IDL attribute, on getting, must
  26498. 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>
  26499. attribute is present.</p>
  26500. <p>The <dfn id=dom-select-options><code>options</code></dfn> IDL attribute must return an
  26501. <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
  26502. the elements in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-24>list of options</a>.</p>
  26503. <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
  26504. <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
  26505. 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>
  26506. <p>The <dfn id=dom-select-length><code>length</code></dfn> IDL attribute must return the
  26507. 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
  26508. 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>
  26509. <p>The <dfn id=dom-select-item><code>item(<var>index</var>)</code></dfn> method
  26510. must return the value returned by <a href=#dom-htmlcollection-item id=the-select-element:dom-htmlcollection-item>the method of the same
  26511. 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
  26512. the same argument.</p>
  26513. <p>The <dfn id=dom-select-nameditem><code>namedItem(<var>name</var>)</code></dfn>
  26514. method must return the value returned by <a href=#dom-htmloptionscollection-nameditem id=the-select-element:dom-htmloptionscollection-nameditem>the
  26515. 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,
  26516. when invoked with the same argument.</p>
  26517. <p>When the user agent is to <dfn id=dom-select-setter>set the value of a new indexed
  26518. 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
  26519. value of a new indexed property</a> with the given property index <var>index</var> to
  26520. 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>
  26521. collection.</p>
  26522. <p>Similarly, the <dfn id=dom-select-add><code>add()</code></dfn> method must act like its
  26523. namesake method on that same <code id=the-select-element:dom-select-options-10><a href=#dom-select-options>options</a></code> collection.</p>
  26524. <p>The <dfn id=dom-select-remove><code>remove()</code></dfn> method must act like its
  26525. 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
  26526. has arguments, and like its namesake method on the <code id=the-select-element:childnode><a href=#childnode>ChildNode</a></code> interface implemented by
  26527. 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
  26528. arguments.</p>
  26529. <p>The <dfn id=dom-select-selectedoptions><code>selectedOptions</code></dfn> IDL attribute
  26530. 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
  26531. 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
  26532. have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-17>selectedness</a> set to true.</p>
  26533. <p>The <dfn id=dom-select-selectedindex><code>selectedIndex</code></dfn> IDL attribute, on
  26534. getting, must return the <a href=#concept-option-index id=the-select-element:concept-option-index>index</a> of the first
  26535. <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
  26536. 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,
  26537. then it must return −1.</p>
  26538. <p>On setting, the <code id=the-select-element:dom-select-selectedindex-3><a href=#dom-select-selectedindex>selectedIndex</a></code> attribute must set
  26539. 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>
  26540. 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
  26541. 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
  26542. options</a> whose <a href=#concept-option-index id=the-select-element:concept-option-index-2>index</a> is the given new value, if
  26543. any, must have its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-20>selectedness</a> set to true and
  26544. its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-5>dirtiness</a> set to true.</p>
  26545. <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
  26546. <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>
  26547. attribute and a <a href=#concept-select-size id=the-select-element:concept-select-size-6>display size</a> of 1.</p>
  26548. <p>The <dfn id=dom-select-value><code>value</code></dfn> IDL attribute, on getting, must
  26549. 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>
  26550. 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
  26551. order</a> that has its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-22>selectedness</a> set to
  26552. true, if any. If there isn't one, then it must return the empty string.</p>
  26553. <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
  26554. 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
  26555. 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
  26556. 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>
  26557. 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>
  26558. <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
  26559. <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>
  26560. attribute and a <a href=#concept-select-size id=the-select-element:concept-select-size-7>display size</a> of 1.</p>
  26561. <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
  26562. 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
  26563. attribute has a default value of zero.</p>
  26564. <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
  26565. 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
  26566. depending on the presence of the <code id=the-select-element:attr-select-multiple-15><a href=#attr-select-multiple>multiple</a></code>
  26567. attribute.</p>
  26568. <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
  26569. <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
  26570. 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
  26571. part of the element's forms API.</p>
  26572. <div class=example>
  26573. <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
  26574. with a set of options from which the user can select a single option. The default option is
  26575. preselected.</p>
  26576. <pre>&lt;p>
  26577. &lt;label for="unittype">Select unit type:&lt;/label>
  26578. &lt;select id="unittype" name="unittype">
  26579. &lt;option value="1"> Miner &lt;/option>
  26580. &lt;option value="2"> Puffer &lt;/option>
  26581. &lt;option value="3" selected> Snipey &lt;/option>
  26582. &lt;option value="4"> Max &lt;/option>
  26583. &lt;option value="5"> Firebot &lt;/option>
  26584. &lt;/select>
  26585. &lt;/p></pre>
  26586. <p>When there is no default option, a placeholder can be used instead:</p>
  26587. <pre>&lt;select name="unittype" <strong>required</strong>>
  26588. <strong>&lt;option value=""> Select unit type &lt;/option></strong>
  26589. &lt;option value="1"> Miner &lt;/option>
  26590. &lt;option value="2"> Puffer &lt;/option>
  26591. &lt;option value="3"> Snipey &lt;/option>
  26592. &lt;option value="4"> Max &lt;/option>
  26593. &lt;option value="5"> Firebot &lt;/option>
  26594. &lt;/select></pre>
  26595. </div>
  26596. <div class=example>
  26597. <p>Here, the user is offered a set of options from which he can select any number. By default,
  26598. all five options are selected.</p>
  26599. <pre>&lt;p>
  26600. &lt;label for="allowedunits">Select unit types to enable on this map:&lt;/label>
  26601. &lt;select id="allowedunits" name="allowedunits" multiple>
  26602. &lt;option value="1" selected> Miner &lt;/option>
  26603. &lt;option value="2" selected> Puffer &lt;/option>
  26604. &lt;option value="3" selected> Snipey &lt;/option>
  26605. &lt;option value="4" selected> Max &lt;/option>
  26606. &lt;option value="5" selected> Firebot &lt;/option>
  26607. &lt;/select>
  26608. &lt;/p></pre>
  26609. </div>
  26610. <div class=example>
  26611. <p>Sometimes, a user has to select one or more items. This example shows such an interface.</p>
  26612. <pre>&lt;p>Select the songs from that you would like on your Act II Mix Tape:&lt;/p>
  26613. &lt;select multiple required name="act2">
  26614. &lt;option value="s1">It Sucks to Be Me (Reprise)
  26615. &lt;option value="s2">There is Life Outside Your Apartment
  26616. &lt;option value="s3">The More You Ruv Someone
  26617. &lt;option value="s4">Schadenfreude
  26618. &lt;option value="s5">I Wish I Could Go Back to College
  26619. &lt;option value="s6">The Money Song
  26620. &lt;option value="s7">School for Monsters
  26621. &lt;option value="s8">The Money Song (Reprise)
  26622. &lt;option value="s9">There's a Fine, Fine Line (Reprise)
  26623. &lt;option value="s10">What Do You Do With a B.A. in English? (Reprise)
  26624. &lt;option value="s11">For Now
  26625. &lt;/select></pre>
  26626. </div>
  26627. <h4 id=the-datalist-element>4.10.8 The <dfn><code>datalist</code></dfn> element</h4>
  26628. <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>
  26629. <pre class=idl>interface <dfn id=htmldatalistelement>HTMLDataListElement</dfn> : <a href=#htmlelement id=the-datalist-element:htmlelement>HTMLElement</a> {
  26630. 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>;
  26631. };</pre>
  26632. </dl>
  26633. <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
  26634. 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>
  26635. element <a href=#represents id=the-datalist-element:represents>represents</a> nothing and it, along with its children, should
  26636. be hidden.</p>
  26637. <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
  26638. <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>
  26639. <div class=example>
  26640. <pre>&lt;label>
  26641. Sex:
  26642. &lt;input name=sex list=sexes>
  26643. &lt;datalist id=sexes>
  26644. &lt;option value="Female">
  26645. &lt;option value="Male">
  26646. &lt;/datalist>
  26647. &lt;/label></pre>
  26648. </div>
  26649. <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
  26650. 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
  26651. <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
  26652. <code id=the-datalist-element:the-datalist-element-7><a href=#the-datalist-element>datalist</a></code> element.</p>
  26653. <div class=example>
  26654. <pre>&lt;label>
  26655. Sex:
  26656. &lt;input name=sex list=sexes>
  26657. &lt;/label>
  26658. &lt;datalist id=sexes>
  26659. &lt;label>
  26660. or select from the list:
  26661. &lt;select name=sex>
  26662. &lt;option value="">
  26663. &lt;option>Female
  26664. &lt;option>Male
  26665. &lt;/select>
  26666. &lt;/label>
  26667. &lt;/datalist></pre>
  26668. </div>
  26669. <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>
  26670. <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,
  26671. 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
  26672. 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>.
  26673. <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>
  26674. <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
  26675. <code id=the-datalist-element:the-datalist-element-10><a href=#the-datalist-element>datalist</a></code> element.</p>
  26676. </dl>
  26677. <p>The <dfn id=dom-datalist-options><code>options</code></dfn> IDL attribute must return an
  26678. <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
  26679. <code id=the-datalist-element:the-option-element-7><a href=#the-option-element>option</a></code> elements.</p>
  26680. <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
  26681. ancestor, it is <a href=#barred-from-constraint-validation id=the-datalist-element:barred-from-constraint-validation>barred from constraint validation</a>.</p>
  26682. <h4 id=the-optgroup-element>4.10.9 The <dfn><code>optgroup</code></dfn> element</h4>
  26683. <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
  26684. if the <code id=the-optgroup-element:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element is
  26685. 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
  26686. 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>
  26687. <pre class=idl>interface <dfn id=htmloptgroupelement>HTMLOptGroupElement</dfn> : <a href=#htmlelement id=the-optgroup-element:htmlelement>HTMLElement</a> {
  26688. attribute boolean <a href=#dom-optgroup-disabled id=the-optgroup-element:dom-optgroup-disabled>disabled</a>;
  26689. attribute DOMString <a href=#dom-optgroup-label id=the-optgroup-element:dom-optgroup-label>label</a>;
  26690. };</pre>
  26691. </dl>
  26692. <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>
  26693. elements with a common label.</p>
  26694. <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>
  26695. 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>
  26696. <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
  26697. 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
  26698. from other <code id=the-optgroup-element:the-option-element-7><a href=#the-option-element>option</a></code> elements.</p>
  26699. <p>The <dfn id=attr-optgroup-disabled><code>disabled</code></dfn> attribute is a
  26700. <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
  26701. together.</p>
  26702. <p>The <dfn id=attr-optgroup-label><code>label</code></dfn> attribute must be specified. Its
  26703. value gives the name of the group, for the purposes of the user interface. User
  26704. 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
  26705. in a <code id=the-optgroup-element:the-select-element-3><a href=#the-select-element>select</a></code> element.</p>
  26706. <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
  26707. respective content attributes of the same name.</p>
  26708. <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
  26709. <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
  26710. label for a group of <code id=the-optgroup-element:the-option-element-11><a href=#the-option-element>option</a></code> elements.</p>
  26711. <div class=example>
  26712. <p>The following snippet shows how a set of lessons from three courses could be offered in a
  26713. <code id=the-optgroup-element:the-select-element-4><a href=#the-select-element>select</a></code> drop-down widget:</p>
  26714. <pre>&lt;form action="courseselector.dll" method="get">
  26715. &lt;p>Which course would you like to watch today?
  26716. &lt;p>&lt;label>Course:
  26717. &lt;select name="c">
  26718. &lt;optgroup label="8.01 Physics I: Classical Mechanics">
  26719. &lt;option value="8.01.1">Lecture 01: Powers of Ten
  26720. &lt;option value="8.01.2">Lecture 02: 1D Kinematics
  26721. &lt;option value="8.01.3">Lecture 03: Vectors
  26722. &lt;optgroup label="8.02 Electricity and Magnestism">
  26723. &lt;option value="8.02.1">Lecture 01: What holds our world together?
  26724. &lt;option value="8.02.2">Lecture 02: Electric Field
  26725. &lt;option value="8.02.3">Lecture 03: Electric Flux
  26726. &lt;optgroup label="8.03 Physics III: Vibrations and Waves">
  26727. &lt;option value="8.03.1">Lecture 01: Periodic Phenomenon
  26728. &lt;option value="8.03.2">Lecture 02: Beats
  26729. &lt;option value="8.03.3">Lecture 03: Forced Oscillations with Damping
  26730. &lt;/select>
  26731. &lt;/label>
  26732. &lt;p>&lt;input type=submit value="▶ Play">
  26733. &lt;/form></pre>
  26734. </div>
  26735. <h4 id=the-option-element>4.10.10 The <dfn><code>option</code></dfn> element</h4>
  26736. <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
  26737. 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
  26738. 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
  26739. 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>
  26740. <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)]
  26741. interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement id=the-option-element:htmlelement>HTMLElement</a> {
  26742. attribute boolean <a href=#dom-option-disabled id=the-option-element:dom-option-disabled>disabled</a>;
  26743. 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>;
  26744. attribute DOMString <a href=#dom-option-label id=the-option-element:dom-option-label>label</a>;
  26745. attribute boolean <a href=#dom-option-defaultselected id=the-option-element:dom-option-defaultselected>defaultSelected</a>;
  26746. attribute boolean <a href=#dom-option-selected id=the-option-element:dom-option-selected>selected</a>;
  26747. attribute DOMString <a href=#dom-option-value id=the-option-element:dom-option-value>value</a>;
  26748. attribute DOMString <a href=#dom-option-text id=the-option-element:dom-option-text>text</a>;
  26749. readonly attribute long <a href=#dom-option-index id=the-option-element:dom-option-index>index</a>;
  26750. };</pre>
  26751. </dl>
  26752. <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>
  26753. 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>
  26754. <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
  26755. <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
  26756. 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
  26757. 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>
  26758. <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
  26759. 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
  26760. <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
  26761. is present.</p>
  26762. <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
  26763. 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
  26764. element.</p>
  26765. <p>The <dfn id=attr-option-label><code>label</code></dfn> attribute provides a label for
  26766. 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
  26767. 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,
  26768. 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
  26769. attribute.</p>
  26770. <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
  26771. empty.</p>
  26772. <p>The <dfn id=attr-option-value><code>value</code></dfn> attribute provides a value for
  26773. 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
  26774. 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,
  26775. 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
  26776. attribute.</p>
  26777. <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
  26778. attribute</a>. It represents the default <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness>selectedness</a> of the element.</p>
  26779. <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
  26780. 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>
  26781. <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>
  26782. element is a boolean state, initially false. Except where otherwise specified, when the element is
  26783. created, its <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-2>selectedness</a> must be set to true if
  26784. the element has a <code id=the-option-element:attr-option-selected-3><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
  26785. <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
  26786. 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
  26787. <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
  26788. <em>removed</em>, if its <a href=#concept-option-dirtiness id=the-option-element:concept-option-dirtiness-2>dirtiness</a> is false, its
  26789. <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-4>selectedness</a> must be set to false.</p>
  26790. <p class=note>The <code id=the-option-element:dom-option-2><a href=#dom-option>Option()</a></code> constructor, when called with three
  26791. 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
  26792. 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
  26793. 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>
  26794. <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>
  26795. 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
  26796. its <code id=the-option-element:attr-option-selected-7><a href=#attr-option-selected>selected</a></code> attribute set.</p>
  26797. <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
  26798. <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
  26799. 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>
  26800. 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
  26801. <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>
  26802. <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>
  26803. <p>Returns true if the element is selected, and false otherwise.</p>
  26804. <p>Can be set, to override the current state of the element.</p>
  26805. <dt><var>option</var> . <code id=the-option-element:dom-option-index-2><a href=#dom-option-index>index</a></code><dd>
  26806. <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>
  26807. <dt><var>option</var> . <code id=the-option-element:dom-option-form-2><a href=#dom-option-form>form</a></code><dd>
  26808. <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>
  26809. <dt><var>option</var> . <code id=the-option-element:dom-option-text-4><a href=#dom-option-text>text</a></code><dd>
  26810. <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>
  26811. <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>
  26812. <p>Returns a new <code id=the-option-element:the-option-element-19><a href=#the-option-element>option</a></code> element.</p>
  26813. <p>The <var>text</var> argument sets the contents of the element.</p>
  26814. <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>
  26815. attribute.</p>
  26816. <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>
  26817. <p>The <var>selected</var> argument sets whether or not the element is selected. If it
  26818. is omitted, even if the <var>defaultSelected</var> argument is true, the element is not
  26819. selected.</p>
  26820. </dl>
  26821. <p>The <dfn id=dom-option-disabled><code>disabled</code></dfn> IDL attribute must
  26822. <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
  26823. <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>
  26824. <p>The <dfn id=dom-option-label><code>label</code></dfn> IDL attribute, on getting, must
  26825. return the element's <a href=#concept-option-label id=the-option-element:concept-option-label>label</a>. On setting, the element's
  26826. <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>
  26827. <p>The <dfn id=dom-option-value><code>value</code></dfn> IDL attribute, on getting, must
  26828. return the element's <a href=#concept-option-value id=the-option-element:concept-option-value>value</a>. On setting, the element's
  26829. <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>
  26830. <p>The <dfn id=dom-option-selected><code>selected</code></dfn> IDL attribute, on getting,
  26831. must return true if the element's <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-7>selectedness</a>
  26832. 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
  26833. <a href=#ask-for-a-reset id=the-option-element:ask-for-a-reset>ask for a reset</a>.</p>
  26834. <p>The <dfn id=dom-option-index><code>index</code></dfn> IDL attribute must return the
  26835. element's <a href=#concept-option-index id=the-option-element:concept-option-index-2>index</a>.</p>
  26836. <p>The <dfn id=dom-option-text><code>text</code></dfn> IDL attribute, on getting, must
  26837. return the result of <a href=#strip-and-collapse-whitespace id=the-option-element:strip-and-collapse-whitespace>stripping and collapsing
  26838. whitespace</a> from the concatenation of <a href=#concept-cd-data id=the-option-element:concept-cd-data>data</a> of all the
  26839. <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>,
  26840. 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
  26841. 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>
  26842. <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
  26843. <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>
  26844. <p>The <dfn id=dom-option-form><code>form</code></dfn> IDL attribute's behavior depends on
  26845. 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
  26846. <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
  26847. <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
  26848. <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
  26849. 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
  26850. 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>
  26851. <p>A constructor is provided for creating <code id=the-option-element:htmloptionelement><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in addition to
  26852. 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
  26853. 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>
  26854. element). If the first argument is not the empty string, the new object must have as its only
  26855. 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
  26856. no children. If the <var>value</var> argument is present, the new object must have a
  26857. <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
  26858. value. If the <var>defaultSelected</var> argument is true, the new object must have a
  26859. <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
  26860. 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
  26861. the interface object of the invoked constructor is found.</p>
  26862. <h4 id=the-textarea-element>4.10.11 The <dfn><code>textarea</code></dfn> element</h4>
  26863. <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>
  26864. <pre class=idl>interface <dfn id=htmltextareaelement>HTMLTextAreaElement</dfn> : <a href=#htmlelement id=the-textarea-element:htmlelement>HTMLElement</a> {
  26865. attribute DOMString <a href=#dom-fe-autocomplete id=the-textarea-element:dom-fe-autocomplete>autocomplete</a>;
  26866. attribute boolean <a href=#dom-fe-autofocus id=the-textarea-element:dom-fe-autofocus>autofocus</a>;
  26867. attribute unsigned long <a href=#dom-textarea-cols id=the-textarea-element:dom-textarea-cols>cols</a>;
  26868. attribute DOMString <a href=#dom-textarea-dirname id=the-textarea-element:dom-textarea-dirname>dirName</a>;
  26869. attribute boolean <a href=#dom-fe-disabled id=the-textarea-element:dom-fe-disabled>disabled</a>;
  26870. 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>;
  26871. attribute DOMString <a href=#dom-textarea-inputmode id=the-textarea-element:dom-textarea-inputmode>inputMode</a>;
  26872. attribute long <a href=#dom-textarea-maxlength id=the-textarea-element:dom-textarea-maxlength>maxLength</a>;
  26873. attribute long <a href=#dom-textarea-minlength id=the-textarea-element:dom-textarea-minlength>minLength</a>;
  26874. attribute DOMString <a href=#dom-fe-name id=the-textarea-element:dom-fe-name>name</a>;
  26875. attribute DOMString <a href=#dom-textarea-placeholder id=the-textarea-element:dom-textarea-placeholder>placeholder</a>;
  26876. attribute boolean <a href=#dom-textarea-readonly id=the-textarea-element:dom-textarea-readonly>readOnly</a>;
  26877. attribute boolean <a href=#dom-textarea-required id=the-textarea-element:dom-textarea-required>required</a>;
  26878. attribute unsigned long <a href=#dom-textarea-rows id=the-textarea-element:dom-textarea-rows>rows</a>;
  26879. attribute DOMString <a href=#dom-textarea-wrap id=the-textarea-element:dom-textarea-wrap>wrap</a>;
  26880. readonly attribute DOMString <a href=#dom-textarea-type id=the-textarea-element:dom-textarea-type>type</a>;
  26881. attribute DOMString <a href=#dom-textarea-defaultvalue id=the-textarea-element:dom-textarea-defaultvalue>defaultValue</a>;
  26882. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-textarea-value id=the-textarea-element:dom-textarea-value>value</a>;
  26883. readonly attribute unsigned long <a href=#dom-textarea-textlength id=the-textarea-element:dom-textarea-textlength>textLength</a>;
  26884. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-textarea-element:dom-cva-willvalidate>willValidate</a>;
  26885. 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>;
  26886. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-textarea-element:dom-cva-validationmessage>validationMessage</a>;
  26887. boolean <a href=#dom-cva-checkvalidity id=the-textarea-element:dom-cva-checkvalidity>checkValidity</a>();
  26888. boolean <a href=#dom-cva-reportvalidity id=the-textarea-element:dom-cva-reportvalidity>reportValidity</a>();
  26889. void <a href=#dom-cva-setcustomvalidity id=the-textarea-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  26890. 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>;
  26891. void <a href=#dom-textarea/input-select id=the-textarea-element:dom-textarea/input-select>select</a>();
  26892. attribute unsigned long <a href=#dom-textarea/input-selectionstart id=the-textarea-element:dom-textarea/input-selectionstart>selectionStart</a>;
  26893. attribute unsigned long <a href=#dom-textarea/input-selectionend id=the-textarea-element:dom-textarea/input-selectionend>selectionEnd</a>;
  26894. attribute DOMString <a href=#dom-textarea/input-selectiondirection id=the-textarea-element:dom-textarea/input-selectiondirection>selectionDirection</a>;
  26895. void <a href=#dom-textarea/input-setrangetext id=the-textarea-element:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
  26896. 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");
  26897. 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);
  26898. };</pre>
  26899. </dl>
  26900. <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
  26901. control for the element's <dfn id=concept-textarea-raw-value>raw
  26902. value</dfn>. The contents of the control represent the control's default value.</p>
  26903. <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>
  26904. control must be initially the empty string.</p>
  26905. <p class=note>This element <a href=#bidireq>has rendering requirements involving the
  26906. bidirectional algorithm</a>.</p>
  26907. <p>The <dfn id=attr-textarea-readonly><code>readonly</code></dfn> attribute is a
  26908. <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
  26909. not.</p>
  26910. <div class=example>
  26911. <p>In this example, a text field is marked read-only because it represents a read-only file:</p>
  26912. <pre>Filename: &lt;code>/etc/bash.bashrc&lt;/code>
  26913. &lt;textarea name="buffer" readonly>
  26914. # System-wide .bashrc file for interactive bash(1) shells.
  26915. # To enable the settings / commands in this file for login shells as well,
  26916. # this file has to be sourced in /etc/profile.
  26917. # If not running interactively, don't do anything
  26918. [ -z "$PS1" ] &amp;amp;&amp;amp; return
  26919. ...&lt;/textarea></pre>
  26920. </div>
  26921. <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>
  26922. element, the element is <a href=#barred-from-constraint-validation id=the-textarea-element:barred-from-constraint-validation>barred from constraint validation</a>.</p>
  26923. <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
  26924. 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>
  26925. <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
  26926. should allow the user to edit, insert, and remove text, and to insert and remove line breaks in
  26927. 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
  26928. 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
  26929. suitable break in the user's interaction before queuing the task; for example, a user agent could
  26930. wait for the user to have not hit a key for 100ms, so as to only fire the event when the user
  26931. pauses, instead of continuously for each keystroke.</p>
  26932. <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
  26933. flag</dfn>, which must be initially set to false, and must be set to true whenever the user
  26934. 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
  26935. value</a>.</p>
  26936. <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,
  26937. if the element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty>dirty value flag</a> is false, then the
  26938. 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
  26939. the element's <code id=the-textarea-element:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute.</p>
  26940. <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>
  26941. 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
  26942. value of the element's <code id=the-textarea-element:textcontent-3><a href=#textcontent>textContent</a></code> IDL attribute.</p>
  26943. <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
  26944. the user to change the writing direction of the element, setting it either to a left-to-right
  26945. writing direction or a right-to-left writing direction. If the user does so, the user agent must
  26946. then run the following steps:</p>
  26947. <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
  26948. "<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
  26949. 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>
  26950. <p>The <dfn id=attr-textarea-cols><code>cols</code></dfn> attribute specifies the expected
  26951. 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>
  26952. 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
  26953. 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
  26954. 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
  26955. 20.</p>
  26956. <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
  26957. characters the server prefers per line (e.g. for visual user agents by making the width of the
  26958. control be that many characters). In visual renderings, the user agent should wrap the user's
  26959. input in the rendering so that each line is no wider than this number of characters.</p>
  26960. <p>The <dfn id=attr-textarea-rows><code>rows</code></dfn> attribute specifies the number of
  26961. 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
  26962. 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
  26963. 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
  26964. in a number greater than zero, then the element's <dfn id=attr-textarea-rows-value>character
  26965. height</dfn> is that value; otherwise, it is 2.</p>
  26966. <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>
  26967. <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
  26968. 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
  26969. <a href=#attr-textarea-wrap-soft-state id=the-textarea-element:attr-textarea-wrap-soft-state-2>Soft</a> state.</p>
  26970. <p>The <dfn id=attr-textarea-wrap-soft-state>Soft</dfn> state indicates that the text in the
  26971. <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
  26972. the rendering).</p>
  26973. <p>The <dfn id=attr-textarea-wrap-hard-state>Hard</dfn> state indicates that the text in the
  26974. <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
  26975. it is submitted.</p>
  26976. <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>
  26977. <p>For historical reasons, the element's value is normalised in three different ways for three
  26978. 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
  26979. it was originally set. It is not normalized. The <a href=#concept-textarea-api-value id=the-textarea-element:concept-textarea-api-value>API
  26980. 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
  26981. attribute. It is normalised so that line breaks use U+000A LINE FEED (LF) characters. Finally,
  26982. there is the <a href=#concept-fe-value id=the-textarea-element:concept-fe-value>value</a>, as used in form submission and other
  26983. processing models in this specification. It is normalised so that line breaks use U+000D CARRIAGE
  26984. RETURN U+000A LINE FEED (CRLF) character pairs, and in addition, if necessary given the element's
  26985. <code id=the-textarea-element:attr-textarea-wrap-3><a href=#attr-textarea-wrap>wrap</a></code> attribute, additional line breaks are inserted to
  26986. wrap the text at the given width.</p>
  26987. <p>The element's <dfn id=concept-textarea-api-value>API value</dfn> is defined to be the
  26988. element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-8>raw value</a> with the following
  26989. transformation applied:</p>
  26990. <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)
  26991. 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)
  26992. character.</ol>
  26993. <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
  26994. transformation</a> applied. The <dfn id=textarea-wrapping-transformation>textarea wrapping transformation</dfn> is the following
  26995. algorithm, as applied to a string:</p>
  26996. <ol><li><p>Replace every occurrence of a U+000D CARRIAGE RETURN (CR) character not followed by a
  26997. U+000A LINE FEED (LF) character, and every occurrence of a U+000A LINE FEED (LF) character not
  26998. preceded by a U+000D CARRIAGE RETURN (CR) character, by a two-character string consisting of a
  26999. 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
  27000. LINE FEED (CRLF) character pairs into the string using a UA-defined algorithm so that each line
  27001. has no more than <a href=#attr-textarea-cols-value id=the-textarea-element:attr-textarea-cols-value-2>character width</a> characters. For
  27002. the purposes of this requirement, lines are delimited by the start of the string, the end of the
  27003. string, and U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs.</ol>
  27004. <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
  27005. 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
  27006. flag</a>.</p>
  27007. <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
  27008. 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
  27009. 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
  27010. 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
  27011. length</a>.</p>
  27012. <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>
  27013. 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
  27014. value flag</a>.</p>
  27015. <p>The <dfn id=attr-textarea-required><code>required</code></dfn> attribute is a
  27016. <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
  27017. submitting the form.</p>
  27018. <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
  27019. from being missing</a>.</p>
  27020. <p>The <dfn id=attr-textarea-placeholder><code>placeholder</code></dfn> attribute represents
  27021. a <em>short</em> hint (a word or short phrase) intended to aid the user with data entry when the
  27022. control has no value. A hint could be a sample value or a brief description of the expected
  27023. format.</p>
  27024. <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
  27025. 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>
  27026. <p class=note>These mechanisms are very similar but subtly different: the hint given by the
  27027. 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
  27028. 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
  27029. requests further help.</p>
  27030. <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
  27031. <a href=#focused id=the-textarea-element:focused>focused</a> (e.g. by displaying it inside a blank unfocused control). All U+000D CARRIAGE
  27032. RETURN U+000A LINE FEED character pairs (CRLF) in the hint, as well as all other U+000D CARRIAGE
  27033. RETURN (CR) and U+000A LINE FEED (LF) characters in the hint, must be treated as line breaks when
  27034. rendering the hint.
  27035. </p>
  27036. <p>
  27037. The <code id=the-textarea-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
  27038. 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.
  27039. 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
  27040. non-interactive and to prevent its value from being submitted.
  27041. 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
  27042. <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>.
  27043. The <code id=the-textarea-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
  27044. 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
  27045. modality for the control.
  27046. The <code id=the-textarea-element:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent
  27047. provides autofill behavior.
  27048. </p>
  27049. <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>
  27050. <p>Returns the string "<code>textarea</code>".</p>
  27051. <dt><var>textarea</var> . <code id=the-textarea-element:dom-textarea-value-3><a href=#dom-textarea-value>value</a></code><dd>
  27052. <p>Returns the current value of the element.</p>
  27053. <p>Can be set, to change the value.</p>
  27054. </dl>
  27055. <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
  27056. 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>
  27057. 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
  27058. 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
  27059. 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
  27060. 2. The <dfn id=dom-textarea-dirname><code>dirName</code></dfn> IDL attribute must
  27061. <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
  27062. <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,
  27063. <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
  27064. <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,
  27065. <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
  27066. <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,
  27067. <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>
  27068. the <code id=the-textarea-element:attr-textarea-readonly-4><a href=#attr-textarea-readonly>readonly</a></code> content attribute.</p>
  27069. <p>The <dfn id=dom-textarea-type><code>type</code></dfn> IDL attribute must return the value
  27070. "<code>textarea</code>".</p>
  27071. <p>The <dfn id=dom-textarea-defaultvalue><code>defaultValue</code></dfn> IDL attribute must
  27072. act like the element's <code id=the-textarea-element:textcontent-5><a href=#textcontent>textContent</a></code> IDL attribute.</p>
  27073. <p>The <dfn id=dom-textarea-value><code>value</code></dfn> attribute must, on getting, return
  27074. 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
  27075. 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
  27076. element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty-4>dirty value flag</a> to true, and should then
  27077. move the text entry cursor position to the end of the text field, unselecting any selected text
  27078. and resetting the selection direction to <i>none</i>.</p>
  27079. <p>The <dfn id=dom-textarea-textlength><code>textLength</code></dfn> IDL attribute must
  27080. 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>
  27081. <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
  27082. <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
  27083. 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
  27084. 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>
  27085. <div class=example>
  27086. <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
  27087. in a form:</p>
  27088. <pre>&lt;p>If you have any comments, please let us know: &lt;textarea cols=80 name=comments>&lt;/textarea>&lt;/p></pre>
  27089. <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>
  27090. <pre>&lt;p>If you have any short comments, please let us know: &lt;textarea cols=80 name=comments maxlength=200>&lt;/textarea>&lt;/p></pre>
  27091. <p>To give a default value, text can be included inside the element:</p>
  27092. <pre>&lt;p>If you have any comments, please let us know: &lt;textarea cols=80 name=comments>You rock!&lt;/textarea>&lt;/p></pre>
  27093. <p>You can also give a minimum length. Here, a letter needs to be filled out by the user; a
  27094. template (which is shorter than the minimum length) is provided, but is insufficient to submit
  27095. the form:</p>
  27096. <pre>&lt;textarea required minlength="500">Dear Madam Speaker,
  27097. Regarding your letter dated ...
  27098. ...
  27099. Yours Sincerely,
  27100. ...&lt;/textarea></pre>
  27101. <p>A placeholder can be given as well, to suggest the basic form to the user, without providing
  27102. an explicit template:</p>
  27103. <pre>&lt;textarea placeholder="Dear Francine,
  27104. They closed the parks this week, so we won't be able to
  27105. meet your there. Should we just have dinner?
  27106. Love,
  27107. Daddy">&lt;/textarea></pre>
  27108. <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
  27109. value, the <code id=the-textarea-element:attr-fe-dirname-4><a href=#attr-fe-dirname>dirname</a></code> attribute can be specified:</p>
  27110. <pre>&lt;p>If you have any comments, please let us know (you may use either English or Hebrew for your comments):
  27111. &lt;textarea cols=80 name=comments dirname=comments.dir>&lt;/textarea>&lt;/p></pre>
  27112. </div>
  27113. <h4 id=the-keygen-element>4.10.12 The <dfn><code>keygen</code></dfn> element</h4>
  27114. <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>
  27115. <pre class=idl>interface <dfn id=htmlkeygenelement>HTMLKeygenElement</dfn> : <a href=#htmlelement id=the-keygen-element:htmlelement>HTMLElement</a> {
  27116. attribute boolean <a href=#dom-fe-autofocus id=the-keygen-element:dom-fe-autofocus>autofocus</a>;
  27117. attribute DOMString <a href=#dom-keygen-challenge id=the-keygen-element:dom-keygen-challenge>challenge</a>;
  27118. attribute boolean <a href=#dom-fe-disabled id=the-keygen-element:dom-fe-disabled>disabled</a>;
  27119. 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>;
  27120. attribute DOMString <a href=#dom-keygen-keytype id=the-keygen-element:dom-keygen-keytype>keytype</a>;
  27121. attribute DOMString <a href=#dom-fe-name id=the-keygen-element:dom-fe-name>name</a>;
  27122. readonly attribute DOMString <a href=#dom-keygen-type id=the-keygen-element:dom-keygen-type>type</a>;
  27123. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-keygen-element:dom-cva-willvalidate>willValidate</a>;
  27124. 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>;
  27125. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-keygen-element:dom-cva-validationmessage>validationMessage</a>;
  27126. boolean <a href=#dom-cva-checkvalidity id=the-keygen-element:dom-cva-checkvalidity>checkValidity</a>();
  27127. boolean <a href=#dom-cva-reportvalidity id=the-keygen-element:dom-cva-reportvalidity>reportValidity</a>();
  27128. void <a href=#dom-cva-setcustomvalidity id=the-keygen-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  27129. 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>;
  27130. };</pre>
  27131. </dl>
  27132. <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
  27133. control's form is submitted, the private key is stored in the local keystore, and the public key
  27134. is packaged and sent to the server.</p>
  27135. <p>The <dfn id=attr-keygen-challenge><code>challenge</code></dfn> attribute may be specified.
  27136. Its value will be packaged with the submitted key.</p>
  27137. <p>The <dfn id=attr-keygen-keytype><code>keytype</code></dfn> attribute is an
  27138. <a href=#enumerated-attribute id=the-keygen-element:enumerated-attribute>enumerated attribute</a>. The following table lists the keywords and states for the
  27139. attribute — the keywords in the left column map to the states listed in the cell in the
  27140. second column on the same row as the keyword. User agents are not required to support these
  27141. values, and must only recognise values whose corresponding algorithms they support.</p>
  27142. <table><thead><tr><th> Keyword <th> State
  27143. <tbody><tr><td> <code>rsa</code>
  27144. <td> <i>RSA</i>
  27145. </table>
  27146. <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>
  27147. <p class=note>This specification does not specify what key types user agents are to support
  27148. — it is possible for a user agent to not support any key types at all.</p>
  27149. <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
  27150. user to configure settings of the element's key pair generator, e.g. the key length.</p>
  27151. <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>
  27152. elements is to set these various configuration settings back to their defaults.</p>
  27153. <p>The element's <a href=#concept-fe-value id=the-keygen-element:concept-fe-value>value</a> is the string returned from the
  27154. following algorithm:</p>
  27155. <ol><li>
  27156. <p>Use the appropriate step from the following list:</p>
  27157. <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>
  27158. <p>Generate an RSA key pair using the settings given by the user, if appropriate, using the
  27159. <code>md5WithRSAEncryption</code> RSA signature algorithm (the signature algorithm
  27160. with MD5 and the RSA encryption algorithm) referenced in section 2.2.1 ("RSA Signature
  27161. Algorithm") of RFC 3279, and defined in RFC 2313. <a href=#refsRFC3279>[RFC3279]</a> <a href=#refsRFC2313>[RFC2313]</a></p>
  27162. <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>
  27163. <p>The given key type is not supported. Return the empty string and abort this algorithm.</p>
  27164. </dl>
  27165. <p>Let <var>private key</var> be the generated private key.</p>
  27166. <p>Let <var>public key</var> be the generated public key.</p>
  27167. <p>Let <var>signature algorithm</var> be the selected signature algorithm.</p>
  27168. <li>
  27169. <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
  27170. <var>challenge</var> be that attribute's value. Otherwise, let <var>challenge</var> be the empty string.</p>
  27171. <li>
  27172. <p>Let <var>algorithm</var> be an ASN.1 <code>AlgorithmIdentifier</code>
  27173. structure as defined by RFC 5280, with the <code>algorithm</code> field giving the
  27174. ASN.1 OID used to identify <var>signature algorithm</var>, using the OIDs defined in
  27175. section 2.2 ("Signature Algorithms") of RFC 3279, and the <code>parameters</code> field
  27176. set up as required by RFC 3279 for <code>AlgorithmIdentifier</code> structures for that
  27177. algorithm. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a> <a href=#refsRFC3279>[RFC3279]</a></p>
  27178. <li>
  27179. <p>Let <var>spki</var> be an ASN.1 <code>SubjectPublicKeyInfo</code> structure
  27180. 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
  27181. encoding the <var>public key</var>. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a></p>
  27182. <li>
  27183. <p>Let <var>publicKeyAndChallenge</var> be an ASN.1 <code id=the-keygen-element:publickeyandchallenge><a href=#publickeyandchallenge>PublicKeyAndChallenge</a></code>
  27184. 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>
  27185. field set to the string <var>challenge</var> obtained earlier. <a href=#refsX690>[X690]</a></p>
  27186. <li>
  27187. <p>Let <var>signature</var> be the BIT STRING value resulting from ASN.1 DER encoding
  27188. the signature generated by applying the <var>signature algorithm</var> to the byte
  27189. string obtained by ASN.1 DER encoding the <var>publicKeyAndChallenge</var> structure,
  27190. using <var>private key</var> as the signing key. <a href=#refsX690>[X690]</a></p>
  27191. <li>
  27192. <p>Let <var>signedPublicKeyAndChallenge</var> be an ASN.1
  27193. <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>
  27194. structure, the <code>signatureAlgorithm</code> field set to the <var>algorithm</var> structure, and the <code>signature</code> field set to the BIT
  27195. STRING <var>signature</var> from the previous step. <a href=#refsX690>[X690]</a></p>
  27196. <li>
  27197. <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>
  27198. </ol>
  27199. <p>The data objects used by the above algorithm are defined as follows. These definitions use the
  27200. same "ASN.1-like" syntax defined by RFC 5280. <a href=#refsRFC5280>[RFC5280]</a></p>
  27201. <pre class=asn><dfn id=publickeyandchallenge>PublicKeyAndChallenge</dfn> ::= SEQUENCE {
  27202. spki <span>SubjectPublicKeyInfo</span>,
  27203. challenge IA5STRING
  27204. }
  27205. <dfn id=signedpublickeyandchallenge>SignedPublicKeyAndChallenge</dfn> ::= SEQUENCE {
  27206. publicKeyAndChallenge <a href=#publickeyandchallenge id=the-keygen-element:publickeyandchallenge-2>PublicKeyAndChallenge</a>,
  27207. signatureAlgorithm <span>AlgorithmIdentifier</span>,
  27208. signature BIT STRING
  27209. }</pre>
  27210. <hr>
  27211. <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
  27212. constraint validation</a>.</p>
  27213. <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
  27214. <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
  27215. 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>
  27216. attribute controls focus.</p>
  27217. <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>
  27218. <p>Returns the string "<code>keygen</code>".</p>
  27219. </dl>
  27220. <p>The <dfn id=dom-keygen-challenge><code>challenge</code></dfn> IDL attribute must
  27221. <a href=#reflect id=the-keygen-element:reflect>reflect</a> the content attribute of the same name.</p>
  27222. <p>The <dfn id=dom-keygen-keytype><code>keytype</code></dfn> IDL attribute must
  27223. <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
  27224. values</a>.</p>
  27225. <p>The <dfn id=dom-keygen-type><code>type</code></dfn> IDL attribute must return the value
  27226. "<code>keygen</code>".</p>
  27227. <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
  27228. <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
  27229. 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
  27230. part of the element's forms API.</p>
  27231. <p class=note>This specification does not specify how the private key generated is to be used.
  27232. It is expected that after receiving the <code id=the-keygen-element:signedpublickeyandchallenge-2><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> (SPKAC)
  27233. structure, the server will generate a client certificate and offer it back to the user for
  27234. download; this certificate, once downloaded and stored in the key store along with the private
  27235. key, can then be used to authenticate to services that use TLS and certificate authentication. For
  27236. more information, see e.g. <a href=https://wiki.mozilla.org/CA:Certificate_Download_Specification>this MDN article</a>.</p>
  27237. <div class=example>
  27238. <p>To generate a key pair, add the private key to the user's key store, and submit the public key
  27239. to the server, markup such as the following can be used:</p>
  27240. <pre>&lt;form action="processkey.cgi" method="post" enctype="multipart/form-data">
  27241. &lt;p>&lt;keygen name="key">&lt;/p>
  27242. &lt;p>&lt;input type=submit value="Submit key...">&lt;/p>
  27243. &lt;/form></pre>
  27244. <p>The server will then receive a form submission with a packaged RSA public key as the value of
  27245. "<code>key</code>". This can then be used for various purposes, such as generating a
  27246. client certificate, as mentioned above.</p>
  27247. </div>
  27248. <h4 id=the-output-element>4.10.13 The <dfn><code>output</code></dfn> element</h4>
  27249. <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>
  27250. <pre class=idl>interface <dfn id=htmloutputelement>HTMLOutputElement</dfn> : <a href=#htmlelement id=the-output-element:htmlelement>HTMLElement</a> {
  27251. [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>;
  27252. 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>;
  27253. attribute DOMString <a href=#dom-fe-name id=the-output-element:dom-fe-name>name</a>;
  27254. readonly attribute DOMString <a href=#dom-output-type id=the-output-element:dom-output-type>type</a>;
  27255. attribute DOMString <a href=#dom-output-defaultvalue id=the-output-element:dom-output-defaultvalue>defaultValue</a>;
  27256. attribute DOMString <a href=#dom-output-value id=the-output-element:dom-output-value>value</a>;
  27257. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-output-element:dom-cva-willvalidate>willValidate</a>;
  27258. 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>;
  27259. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-output-element:dom-cva-validationmessage>validationMessage</a>;
  27260. boolean <a href=#dom-cva-checkvalidity id=the-output-element:dom-cva-checkvalidity>checkValidity</a>();
  27261. boolean <a href=#dom-cva-reportvalidity id=the-output-element:dom-cva-reportvalidity>reportValidity</a>();
  27262. void <a href=#dom-cva-setcustomvalidity id=the-output-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  27263. 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>;
  27264. };</pre>
  27265. </dl>
  27266. <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
  27267. by the application, or the result of a user action.</p>
  27268. <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
  27269. appropriate element for quoting the output of other programs run previously.</p>
  27270. <p>The <dfn id=attr-output-for><code>for</code></dfn> content attribute allows an explicit
  27271. relationship to be made between the result of a calculation and the elements that represent the
  27272. 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
  27273. 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
  27274. <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>
  27275. <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
  27276. <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>
  27277. <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>
  27278. <p>The element also has a <dfn id=concept-output-defaultvalue>default value</dfn>.
  27279. Initially, the <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue>default value</a> must be the empty
  27280. string.</p>
  27281. <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
  27282. the value of the element and its <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-2>default value</a>.
  27283. 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
  27284. value of the element only, and the <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-3>default value</a>
  27285. is only accessible using the <code id=the-output-element:dom-output-defaultvalue-2><a href=#dom-output-defaultvalue>defaultValue</a></code> IDL
  27286. attribute.</p>
  27287. <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
  27288. element's <code id=the-output-element:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
  27289. <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>
  27290. 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
  27291. <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
  27292. nodes).</p>
  27293. <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>
  27294. <p>Returns the element's current value.</p>
  27295. <p>Can be set, to change the value.</p>
  27296. <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>
  27297. <p>Returns the element's current default value.</p>
  27298. <p>Can be set, to change the default value.</p>
  27299. <dt><var>output</var> . <code id=the-output-element:dom-output-type-2><a href=#dom-output-type>type</a></code><dd>
  27300. <p>Returns the string "<code>output</code>".</p>
  27301. </dl>
  27302. <p>The <dfn id=dom-output-value><code>value</code></dfn> IDL attribute must act like the
  27303. 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
  27304. child nodes are changed, the element's <a href=#concept-output-mode id=the-output-element:concept-output-mode-6>value mode flag</a>
  27305. must be set to <i id=the-output-element:concept-output-mode-value-2><a href=#concept-output-mode-value>value</a></i>.</p>
  27306. <p>The <dfn id=dom-output-defaultvalue><code>defaultValue</code></dfn> IDL attribute, on
  27307. getting, must return the element's <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-6>default
  27308. 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
  27309. attribute as well.</p>
  27310. <p>The <dfn id=dom-output-type><code>type</code></dfn> attribute must return the string
  27311. "<code>output</code>".</p>
  27312. <p>The <dfn id=dom-output-htmlfor><code>htmlFor</code></dfn> IDL attribute must
  27313. <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>
  27314. <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
  27315. <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
  27316. 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
  27317. part of the element's forms API.</p>
  27318. <div class=example>
  27319. <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>
  27320. <pre>&lt;form onsubmit="return false" oninput="o.value = a.valueAsNumber + b.valueAsNumber">
  27321. &lt;input name=a type=number step=any> +
  27322. &lt;input name=b type=number step=any> =
  27323. &lt;output name=o for="a b">&lt;/output>
  27324. &lt;/form></pre>
  27325. </div>
  27326. <div class=example>
  27327. <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
  27328. server, as they come in:</p>
  27329. <pre>&lt;output id="result">&lt;/output>
  27330. &lt;script>
  27331. var primeSource = new WebSocket('ws://primes.example.net/');
  27332. primeSource.onmessage = function (event) {
  27333. document.getElementById('result').value = event.data;
  27334. }
  27335. &lt;/script></pre>
  27336. </div>
  27337. <h4 id=the-progress-element>4.10.14 The <dfn><code>progress</code></dfn> element</h4>
  27338. <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>
  27339. <pre class=idl>interface <dfn id=htmlprogresselement>HTMLProgressElement</dfn> : <a href=#htmlelement id=the-progress-element:htmlelement>HTMLElement</a> {
  27340. attribute double <a href=#dom-progress-value id=the-progress-element:dom-progress-value>value</a>;
  27341. attribute double <a href=#dom-progress-max id=the-progress-element:dom-progress-max>max</a>;
  27342. readonly attribute double <a href=#dom-progress-position id=the-progress-element:dom-progress-position>position</a>;
  27343. 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>;
  27344. };</pre>
  27345. </dl>
  27346. <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.
  27347. The progress is either indeterminate, indicating that progress is being made but that it is not
  27348. clear how much more work remains to be done before the task is complete (e.g. because the task is
  27349. waiting for a remote host to respond), or the progress is a number in the range zero to a maximum,
  27350. giving the fraction of work that has so far been completed.</p>
  27351. <p>There are two attributes that determine the current task completion represented by the element.
  27352. The <dfn id=attr-progress-value><code>value</code></dfn> attribute specifies how much of the
  27353. task has been completed, and the <dfn id=attr-progress-max><code>max</code></dfn> attribute
  27354. specifies how much work the task requires in total. The units are arbitrary and not specified.</p>
  27355. <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
  27356. 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
  27357. 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
  27358. indeterminate progress bar, remove the <code id=the-progress-element:attr-progress-value-3><a href=#attr-progress-value>value</a></code>
  27359. attribute.</p>
  27360. <p>Authors are encouraged to also include the current value and the maximum value inline as text
  27361. inside the element, so that the progress is made available to users of legacy user agents.</p>
  27362. <div class=example>
  27363. <p>Here is a snippet of a Web application that shows the progress of some automated task:</p>
  27364. <pre>&lt;section>
  27365. &lt;h2>Task Progress&lt;/h2>
  27366. &lt;p>Progress: &lt;progress id="p" max=100>&lt;span>0&lt;/span>%&lt;/progress>&lt;/p>
  27367. &lt;script>
  27368. var progressBar = document.getElementById('p');
  27369. function updateProgress(newValue) {
  27370. progressBar.value = newValue;
  27371. progressBar.getElementsByTagName('span')[0].textContent = newValue;
  27372. }
  27373. &lt;/script>
  27374. &lt;/section></pre>
  27375. <p>(The <code>updateProgress()</code> method in this example would be called by some
  27376. other code on the page to update the actual progress bar as the task progressed.)</p>
  27377. </div>
  27378. <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
  27379. 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
  27380. zero.</p>
  27381. <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
  27382. is just a gauge, as opposed to task progress. For instance, indicating disk space usage using
  27383. <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
  27384. for such use cases.</p>
  27385. <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>
  27386. attribute is omitted, then the progress bar is an indeterminate progress bar. Otherwise, it is a
  27387. determinate progress bar.</p>
  27388. <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
  27389. floating-point number values</a>. If this does not result in an error, and if the parsed value
  27390. is greater than zero, then the <dfn id=concept-progress-maximum>maximum value</dfn> of the
  27391. 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
  27392. 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>
  27393. <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
  27394. parsing floating-point number values</a>. If this does not result in an error, and if the
  27395. parsed value is less than the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-2>maximum value</a> and
  27396. greater than zero, then the <dfn id=concept-progress-value>current value</dfn> of the
  27397. progress bar is that parsed value. Otherwise, if the parsed value was greater than or equal to the
  27398. <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
  27399. 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
  27400. number less than or equal to zero, then the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-2>current
  27401. value</a> of the progress bar is zero.</p>
  27402. <p><strong>UA requirements for showing the progress bar</strong>: When representing a
  27403. <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
  27404. indeterminate progress bar, and in the former case, should indicate the relative position of the
  27405. <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>
  27406. <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>
  27407. <p>For a determinate progress bar (one with known current and maximum values), returns the
  27408. result of dividing the current value by the maximum value.</p>
  27409. <p>For an indeterminate progress bar, returns −1.</p>
  27410. </dl>
  27411. <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.
  27412. Otherwise, it must return the result of dividing the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-4>current
  27413. value</a> by the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-6>maximum value</a>.</p>
  27414. <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.
  27415. Otherwise, it must return the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-5>current value</a>. On
  27416. 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
  27417. 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
  27418. attribute must be set to that string.</p>
  27419. <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
  27420. when the corresponding content attribute is absent would change the progress bar from an
  27421. indeterminate progress bar to a determinate progress bar with no progress.</p>
  27422. <p>The <dfn id=dom-progress-max><code>max</code></dfn> IDL attribute must
  27423. <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
  27424. 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>
  27425. <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
  27426. <code id=the-progress-element:the-label-element><a href=#the-label-element>label</a></code>s.</p>
  27427. <h4 id=the-meter-element>4.10.15 The <dfn><code>meter</code></dfn> element</h4>
  27428. <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>
  27429. <pre class=idl>interface <dfn id=htmlmeterelement>HTMLMeterElement</dfn> : <a href=#htmlelement id=the-meter-element:htmlelement>HTMLElement</a> {
  27430. attribute double <a href=#dom-meter-value id=the-meter-element:dom-meter-value>value</a>;
  27431. attribute double <a href=#dom-meter-min id=the-meter-element:dom-meter-min>min</a>;
  27432. attribute double <a href=#dom-meter-max id=the-meter-element:dom-meter-max>max</a>;
  27433. attribute double <a href=#dom-meter-low id=the-meter-element:dom-meter-low>low</a>;
  27434. attribute double <a href=#dom-meter-high id=the-meter-element:dom-meter-high>high</a>;
  27435. attribute double <a href=#dom-meter-optimum id=the-meter-element:dom-meter-optimum>optimum</a>;
  27436. 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>;
  27437. };</pre>
  27438. </dl>
  27439. <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
  27440. range, or a fractional value; for example disk usage, the relevance of a query result, or the
  27441. fraction of a voting population to have selected a particular candidate.</p>
  27442. <p>This is also known as a gauge.</p>
  27443. <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
  27444. 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>
  27445. <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
  27446. range — for example, it would be wrong to use this to report a weight, or height, unless
  27447. there is a known maximum value.</p>
  27448. <p>There are six attributes that determine the semantics of the gauge represented by the
  27449. element.</p>
  27450. <p>The <dfn id=attr-meter-min><code>min</code></dfn> attribute specifies the lower bound of
  27451. the range, and the <dfn id=attr-meter-max><code>max</code></dfn> attribute specifies the
  27452. upper bound. The <dfn id=attr-meter-value><code>value</code></dfn> attribute specifies the
  27453. value to have the gauge indicate as the "measured" value.</p>
  27454. <p>The other three attributes can be used to segment the gauge's range into "low", "medium", and
  27455. "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
  27456. be the "low" part, and the <dfn id=attr-meter-high><code>high</code></dfn> attribute
  27457. 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
  27458. "optimum"; if that is higher than the "high" value then this indicates that the higher the value,
  27459. the better; if it's lower than the "low" mark then it indicates that lower values are better, and
  27460. naturally if it is in between then it indicates that neither high nor low values are good.</p>
  27461. <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,
  27462. when present, must have values that are <a href=#valid-floating-point-number id=the-meter-element:valid-floating-point-number>valid
  27463. floating-point numbers</a>.</p>
  27464. <p>In addition, the attributes' values are further constrained:</p>
  27465. <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
  27466. number.</p>
  27467. <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>
  27468. <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>
  27469. <p>The following inequalities must hold, as applicable:</p>
  27470. <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
  27471. 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
  27472. specified)</ul>
  27473. <p class=note>If no minimum or maximum is specified, then the range is assumed to be 0..1, and
  27474. the value thus has to be within that range.</p>
  27475. <p>Authors are encouraged to include a textual representation of the gauge's state in the
  27476. 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>
  27477. element.</p>
  27478. <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>
  27479. <div class=example>
  27480. <p>The following examples show three gauges that would all be three-quarters full:</p>
  27481. <pre>Storage space usage: &lt;meter value=6 max=8>6 blocks used (out of 8 total)&lt;/meter>
  27482. Voter turnout: &lt;meter value=0.75>&lt;img alt="75%" src="graph75.png">&lt;/meter>
  27483. Tickets sold: &lt;meter min="0" max="100" value="75">&lt;/meter></pre>
  27484. <p>The following example is incorrect use of the element, because it doesn't give a range (and
  27485. since the default maximum is 1, both of the gauges would end up looking maxed out):</p>
  27486. <pre class=bad>&lt;p>The grapefruit pie had a radius of &lt;meter value=12>12cm&lt;/meter>
  27487. and a height of &lt;meter value=2>2cm&lt;/meter>.&lt;/p> &lt;!-- <strong>BAD!</strong> --></pre>
  27488. <p>Instead, one would either not include the meter element, or use the meter element with a
  27489. defined range to give the dimensions in context compared to other pies:</p>
  27490. <pre>&lt;p>The grapefruit pie had a radius of 12cm and a height of
  27491. 2cm.&lt;/p>
  27492. &lt;dl>
  27493. &lt;dt>Radius: &lt;dd> &lt;meter min=0 max=20 value=12>12cm&lt;/meter>
  27494. &lt;dt>Height: &lt;dd> &lt;meter min=0 max=10 value=2>2cm&lt;/meter>
  27495. &lt;/dl></pre>
  27496. </div>
  27497. <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
  27498. be specified in the <code id=the-meter-element:attr-title><a href=#attr-title>title</a></code> attribute in free-form text.</p>
  27499. <div class=example>
  27500. <p>The example above could be extended to mention the units:</p>
  27501. <pre>&lt;dl>
  27502. &lt;dt>Radius: &lt;dd> &lt;meter min=0 max=20 value=12 title="centimeters">12cm&lt;/meter>
  27503. &lt;dt>Height: &lt;dd> &lt;meter min=0 max=10 value=2 title="centimeters">2cm&lt;/meter>
  27504. &lt;/dl></pre>
  27505. </div>
  27506. <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>
  27507. 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>
  27508. <p>User agents must then use all these numbers to obtain values for six points on the gauge, as
  27509. follows. (The order in which these are evaluated is important, as some of the values refer to
  27510. earlier ones.)</p>
  27511. <dl><dt>The <dfn id=concept-meter-minimum>minimum value</dfn><dd>
  27512. <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
  27513. parsed out of it, then the minimum value is that value. Otherwise, the minimum value is
  27514. zero.</p>
  27515. <dt>The <dfn id=concept-meter-maximum>maximum value</dfn><dd>
  27516. <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
  27517. parsed out of it, then the candidate maximum value is that value. Otherwise, the candidate
  27518. maximum value is 1.0.</p>
  27519. <p>If the candidate maximum value is greater than or equal to the minimum value, then the
  27520. maximum value is the candidate maximum value. Otherwise, the maximum value is the same as the
  27521. minimum value.</p>
  27522. <dt>The <dfn id=concept-meter-actual>actual value</dfn><dd>
  27523. <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
  27524. be parsed out of it, then that value is the candidate actual value. Otherwise, the candidate
  27525. actual value is zero.</p>
  27526. <p>If the candidate actual value is less than the minimum value, then the actual value is the
  27527. minimum value.</p>
  27528. <p>Otherwise, if the candidate actual value is greater than the maximum value, then the actual
  27529. value is the maximum value.</p>
  27530. <p>Otherwise, the actual value is the candidate actual value.</p>
  27531. <dt>The <dfn id=concept-meter-low>low boundary</dfn><dd>
  27532. <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
  27533. parsed out of it, then the candidate low boundary is that value. Otherwise, the candidate low
  27534. boundary is the same as the minimum value.</p>
  27535. <p>If the candidate low boundary is less than the minimum value, then the low boundary is the
  27536. minimum value.</p>
  27537. <p>Otherwise, if the candidate low boundary is greater than the maximum value, then the low
  27538. boundary is the maximum value.</p>
  27539. <p>Otherwise, the low boundary is the candidate low boundary.</p>
  27540. <dt>The <dfn id=concept-meter-high>high boundary</dfn><dd>
  27541. <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
  27542. parsed out of it, then the candidate high boundary is that value. Otherwise, the candidate high
  27543. boundary is the same as the maximum value.</p>
  27544. <p>If the candidate high boundary is less than the low boundary, then the high boundary is the
  27545. low boundary.</p>
  27546. <p>Otherwise, if the candidate high boundary is greater than the maximum value, then the high
  27547. boundary is the maximum value.</p>
  27548. <p>Otherwise, the high boundary is the candidate high boundary.</p>
  27549. <dt>The <dfn id=concept-meter-optimum>optimum point</dfn><dd>
  27550. <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
  27551. could be parsed out of it, then the candidate optimum point is that value. Otherwise, the
  27552. candidate optimum point is the midpoint between the minimum value and the maximum value.</p>
  27553. <p>If the candidate optimum point is less than the minimum value, then the optimum point is the
  27554. minimum value.</p>
  27555. <p>Otherwise, if the candidate optimum point is greater than the maximum value, then the optimum
  27556. point is the maximum value.</p>
  27557. <p>Otherwise, the optimum point is the candidate optimum point.</p>
  27558. </dl>
  27559. <p>All of which will result in the following inequalities all being true:</p>
  27560. <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>
  27561. <p><strong>UA requirements for regions of the gauge</strong>: If the optimum point is equal to the
  27562. low boundary or the high boundary, or anywhere in between them, then the region between the low
  27563. and high boundaries of the gauge must be treated as the optimum region, and the low and high
  27564. parts, if any, must be treated as suboptimal. Otherwise, if the optimum point is less than the low
  27565. boundary, then the region between the minimum value and the low boundary must be treated as the
  27566. optimum region, the region from the low boundary up to the high boundary must be treated as a
  27567. suboptimal region, and the remaining region must be treated as an even less good region. Finally,
  27568. if the optimum point is higher than the high boundary, then the situation is reversed; the region
  27569. between the high boundary and the maximum value must be treated as the optimum region, the region
  27570. from the high boundary down to the low boundary must be treated as a suboptimal region, and the
  27571. remaining region must be treated as an even less good region.</p>
  27572. <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>
  27573. element to the user, the UA should indicate the relative position of the actual value to the
  27574. minimum and maximum values, and the relationship between the actual value and the three regions of
  27575. the gauge.</p>
  27576. <div class=example>
  27577. <p>The following markup:</p>
  27578. <pre>&lt;h3>Suggested groups&lt;/h3>
  27579. &lt;menu type="toolbar">
  27580. &lt;a href="?cmd=hsg" onclick="hideSuggestedGroups()">Hide suggested groups&lt;/a>
  27581. &lt;/menu>
  27582. &lt;ul>
  27583. &lt;li>
  27584. &lt;p>&lt;a href="/group/comp.infosystems.www.authoring.stylesheets/view">comp.infosystems.www.authoring.stylesheets&lt;/a> -
  27585. &lt;a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe">join&lt;/a>&lt;/p>
  27586. &lt;p>Group description: &lt;strong>Layout/presentation on the WWW.&lt;/strong>&lt;/p>
  27587. &lt;p><strong>&lt;meter value="0.5">Moderate activity,&lt;/meter></strong> Usenet, 618 subscribers&lt;/p>
  27588. &lt;/li>
  27589. &lt;li>
  27590. &lt;p>&lt;a href="/group/netscape.public.mozilla.xpinstall/view">netscape.public.mozilla.xpinstall&lt;/a> -
  27591. &lt;a href="/group/netscape.public.mozilla.xpinstall/subscribe">join&lt;/a>&lt;/p>
  27592. &lt;p>Group description: &lt;strong>Mozilla XPInstall discussion.&lt;/strong>&lt;/p>
  27593. &lt;p><strong>&lt;meter value="0.25">Low activity,&lt;/meter></strong> Usenet, 22 subscribers&lt;/p>
  27594. &lt;/li>
  27595. &lt;li>
  27596. &lt;p>&lt;a href="/group/mozilla.dev.general/view">mozilla.dev.general&lt;/a> -
  27597. &lt;a href="/group/mozilla.dev.general/subscribe">join&lt;/a>&lt;/p>
  27598. &lt;p><strong>&lt;meter value="0.25">Low activity,&lt;/meter></strong> Usenet, 66 subscribers&lt;/p>
  27599. &lt;/li>
  27600. &lt;/ul></pre>
  27601. <p>Might be rendered as follows:</p>
  27602. <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>
  27603. </div>
  27604. <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
  27605. help or inline text detailing the actual values.</p>
  27606. <div class=example>
  27607. <p>For example, the following snippet:</p>
  27608. <pre>&lt;meter min=0 max=60 value=23.2 title=seconds>&lt;/meter></pre>
  27609. <p>...might cause the user agent to display a gauge with a tooltip
  27610. saying "Value: 23.2 out of 60." on one line and "seconds" on a
  27611. second line.</p>
  27612. </div>
  27613. <p>The <dfn id=dom-meter-value><code>value</code></dfn> IDL attribute, on getting, must
  27614. return the <a href=#concept-meter-actual id=the-meter-element:concept-meter-actual>actual value</a>. On setting, the given value
  27615. 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>
  27616. 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
  27617. string.</p>
  27618. <p>The <dfn id=dom-meter-min><code>min</code></dfn> IDL attribute, on getting, must return
  27619. the <a href=#concept-meter-minimum id=the-meter-element:concept-meter-minimum>minimum value</a>. On setting, the given value must be
  27620. 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
  27621. 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>
  27622. <p>The <dfn id=dom-meter-max><code>max</code></dfn> IDL attribute, on getting, must return
  27623. the <a href=#concept-meter-maximum id=the-meter-element:concept-meter-maximum>maximum value</a>. On setting, the given value must be
  27624. 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
  27625. 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>
  27626. <p>The <dfn id=dom-meter-low><code>low</code></dfn> IDL attribute, on getting, must return
  27627. the <a href=#concept-meter-low id=the-meter-element:concept-meter-low>low boundary</a>. On setting, the given value must be
  27628. 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
  27629. 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>
  27630. <p>The <dfn id=dom-meter-high><code>high</code></dfn> IDL attribute, on getting, must return
  27631. the <a href=#concept-meter-high id=the-meter-element:concept-meter-high>high boundary</a>. On setting, the given value must be
  27632. 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
  27633. 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
  27634. string.</p>
  27635. <p>The <dfn id=dom-meter-optimum><code>optimum</code></dfn> IDL attribute, on getting, must
  27636. return the <a href=#concept-meter-optimum id=the-meter-element:concept-meter-optimum>optimum value</a>. On setting, the given value
  27637. 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>
  27638. 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
  27639. string.</p>
  27640. <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
  27641. <code id=the-meter-element:the-label-element><a href=#the-label-element>label</a></code>s.</p>
  27642. <div class=example>
  27643. <p>The following example shows how a gauge could fall back to localised or pretty-printed
  27644. text.</p>
  27645. <pre>&lt;p>Disk usage: &lt;meter min=0 value=170261928 max=233257824>170 261 928 bytes used
  27646. out of 233 257 824 bytes available&lt;/meter>&lt;/p></pre>
  27647. </div>
  27648. <h4 id=the-fieldset-element>4.10.16 The <dfn><code>fieldset</code></dfn> element</h4>
  27649. <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>
  27650. <pre class=idl>interface <dfn id=htmlfieldsetelement>HTMLFieldSetElement</dfn> : <a href=#htmlelement id=the-fieldset-element:htmlelement>HTMLElement</a> {
  27651. attribute boolean <a href=#dom-fieldset-disabled id=the-fieldset-element:dom-fieldset-disabled>disabled</a>;
  27652. 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>;
  27653. attribute DOMString <a href=#dom-fe-name id=the-fieldset-element:dom-fe-name>name</a>;
  27654. readonly attribute DOMString <a href=#dom-fieldset-type id=the-fieldset-element:dom-fieldset-type>type</a>;
  27655. 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>;
  27656. readonly attribute boolean <a href=#dom-cva-willvalidate id=the-fieldset-element:dom-cva-willvalidate>willValidate</a>;
  27657. 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>;
  27658. readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-fieldset-element:dom-cva-validationmessage>validationMessage</a>;
  27659. boolean <a href=#dom-cva-checkvalidity id=the-fieldset-element:dom-cva-checkvalidity>checkValidity</a>();
  27660. boolean <a href=#dom-cva-reportvalidity id=the-fieldset-element:dom-cva-reportvalidity>reportValidity</a>();
  27661. void <a href=#dom-cva-setcustomvalidity id=the-fieldset-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
  27662. };</pre>
  27663. </dl>
  27664. <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
  27665. grouped under a common name.</p>
  27666. <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
  27667. <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>
  27668. <p>The <dfn id=attr-fieldset-disabled><code>disabled</code></dfn> attribute, when specified,
  27669. 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
  27670. 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
  27671. any, to be <a href=#concept-fe-disabled id=the-fieldset-element:concept-fe-disabled>disabled</a>.</p>
  27672. <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
  27673. fieldset</dfn> if it matches any of the following conditions:</p>
  27674. <ul><li>Its <code id=the-fieldset-element:attr-fieldset-disabled-2><a href=#attr-fieldset-disabled>disabled</a></code> attribute is specified
  27675. <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
  27676. 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
  27677. any.</ul>
  27678. <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
  27679. <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>
  27680. <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>
  27681. <p>Returns the string "fieldset".</p>
  27682. <dt><var>fieldset</var> . <code id=the-fieldset-element:dom-fieldset-elements-2><a href=#dom-fieldset-elements>elements</a></code><dd>
  27683. <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>
  27684. </dl>
  27685. <p>The <dfn id=dom-fieldset-disabled><code>disabled</code></dfn> IDL attribute must
  27686. <a href=#reflect id=the-fieldset-element:reflect>reflect</a> the content attribute of the same name.</p>
  27687. <p>The <dfn id=dom-fieldset-type><code>type</code></dfn> IDL attribute must return the string
  27688. "<code>fieldset</code>".</p>
  27689. <p>The <dfn id=dom-fieldset-elements><code>elements</code></dfn> IDL attribute must return an
  27690. <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
  27691. matches <a href=#category-listed id=the-fieldset-element:category-listed-2>listed elements</a>.</p>
  27692. <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
  27693. <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>
  27694. <div class=example>
  27695. <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
  27696. controls:</p>
  27697. <pre>&lt;fieldset>
  27698. &lt;legend>Display&lt;/legend>
  27699. &lt;p>&lt;label>&lt;input type=radio name=c value=0 checked> Black on White&lt;/label>
  27700. &lt;p>&lt;label>&lt;input type=radio name=c value=1> White on Black&lt;/label>
  27701. &lt;p>&lt;label>&lt;input type=checkbox name=g> Use grayscale&lt;/label>
  27702. &lt;p>&lt;label>Enhance contrast &lt;input type=range name=e list=contrast min=0 max=100 value=0 step=1>&lt;/label>
  27703. &lt;datalist id=contrast>
  27704. &lt;option label=Normal value=0>
  27705. &lt;option label=Maximum value=100>
  27706. &lt;/datalist>
  27707. &lt;/fieldset></pre>
  27708. </div>
  27709. <div class=example>
  27710. <p>The following snippet shows a fieldset with a checkbox in the legend that controls whether or
  27711. not the fieldset is enabled. The contents of the fieldset consist of two required text fields and
  27712. an optional year/month control.</p>
  27713. <pre>&lt;fieldset name="clubfields" disabled>
  27714. &lt;legend> &lt;label>
  27715. &lt;input type=checkbox name=club onchange="form.clubfields.disabled = !checked">
  27716. Use Club Card
  27717. &lt;/label> &lt;/legend>
  27718. &lt;p>&lt;label>Name on card: &lt;input name=clubname required>&lt;/label>&lt;/p>
  27719. &lt;p>&lt;label>Card number: &lt;input name=clubnum required pattern="[-0-9]+">&lt;/label>&lt;/p>
  27720. &lt;p>&lt;label>Expiry date: &lt;input name=clubexp type=month>&lt;/label>&lt;/p>
  27721. &lt;/fieldset></pre>
  27722. </div>
  27723. <div class=example>
  27724. <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
  27725. one that does so:</p>
  27726. <pre>&lt;fieldset name="clubfields" disabled>
  27727. &lt;legend> &lt;label>
  27728. &lt;input type=checkbox name=club onchange="form.clubfields.disabled = !checked">
  27729. Use Club Card
  27730. &lt;/label> &lt;/legend>
  27731. &lt;p>&lt;label>Name on card: &lt;input name=clubname required>&lt;/label>&lt;/p>
  27732. &lt;fieldset name="numfields">
  27733. &lt;legend> &lt;label>
  27734. &lt;input type=radio checked name=clubtype onchange="form.numfields.disabled = !checked">
  27735. My card has numbers on it
  27736. &lt;/label> &lt;/legend>
  27737. &lt;p>&lt;label>Card number: &lt;input name=clubnum required pattern="[-0-9]+">&lt;/label>&lt;/p>
  27738. &lt;/fieldset>
  27739. &lt;fieldset name="letfields" disabled>
  27740. &lt;legend> &lt;label>
  27741. &lt;input type=radio name=clubtype onchange="form.letfields.disabled = !checked">
  27742. My card has letters on it
  27743. &lt;/label> &lt;/legend>
  27744. &lt;p>&lt;label>Card code: &lt;input name=clublet required pattern="[A-Za-z]+">&lt;/label>&lt;/p>
  27745. &lt;/fieldset>
  27746. &lt;/fieldset></pre>
  27747. <p>In this example, if the outer "Use Club Card" checkbox is not checked, everything inside the
  27748. 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
  27749. <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
  27750. buttons will both be enabled and will let you select which of the two inner
  27751. <code id=the-fieldset-element:the-fieldset-element-14><a href=#the-fieldset-element>fieldset</a></code>s is to be enabled.</p>
  27752. </div>
  27753. <h4 id=the-legend-element>4.10.17 The <dfn><code>legend</code></dfn> element</h4>
  27754. <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>
  27755. <pre class=idl>interface <dfn id=htmllegendelement>HTMLLegendElement</dfn> : <a href=#htmlelement id=the-legend-element:htmlelement>HTMLElement</a> {
  27756. 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>;
  27757. // <a href="#HTMLLegendElement-partial">also has obsolete members</a>
  27758. };</pre>
  27759. </dl>
  27760. <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
  27761. 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
  27762. any.</p>
  27763. <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>
  27764. <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>
  27765. </dl>
  27766. <p>The <dfn id=dom-legend-form><code>form</code></dfn> IDL attribute's behavior depends on
  27767. 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
  27768. <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,
  27769. it must return null.</p>
  27770. <h4 id=form-control-infrastructure>4.10.18 Form control infrastructure</h4>
  27771. <h5 id="a-form-control's-value">4.10.18.1 A form control's value</h5>
  27772. <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>
  27773. elements.) These are used to describe how the user interacts with the control.</p>
  27774. <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
  27775. might not match the user's current input.</p>
  27776. <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
  27777. 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
  27778. unchanged.</p>
  27779. <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>
  27780. 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
  27781. can also have separately defined <dfn id=concept-fe-values>value<em>s</em></dfn>.</p>
  27782. <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>;
  27783. 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>
  27784. elements is what is used instead.</p>
  27785. <h5 id=mutability>4.10.18.2 Mutability</h5>
  27786. <p>A form control can be designated as <dfn id=concept-fe-mutable><i>mutable</i></dfn>.</p>
  27787. <p class=note>This determines (by means of definitions and requirements in this specification
  27788. 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
  27789. form control, or whether or not a control can be automatically prefilled.</p>
  27790. <h5 id=association-of-controls-and-forms>4.10.18.3 Association of controls and forms</h5>
  27791. <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>
  27792. 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
  27793. 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
  27794. said to be null.</p>
  27795. <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
  27796. below), but, if it is <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr>reassociateable</a>, may have a
  27797. <dfn id=attr-fae-form><code>form</code></dfn> attribute specified to override this.</p>
  27798. <p class=note>This feature allows authors to work around the lack of support for nested
  27799. <code id=association-of-controls-and-forms:the-form-element-4><a href=#the-form-element>form</a></code> elements.</p>
  27800. <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
  27801. 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
  27802. 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
  27803. in the element's owner <code id=association-of-controls-and-forms:document><a href=#document>Document</a></code>.</p>
  27804. <p class=note>The rules in this section are complicated by the fact that although conforming
  27805. 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
  27806. script that performs DOM manipulation) to generate documents that have such nested elements. They
  27807. are also complicated by rules in the HTML parser that, for historical reasons, can result in a
  27808. <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
  27809. its ancestor.</p>
  27810. <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
  27811. initialised to null (no owner).</p>
  27812. <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
  27813. be set to that form.</p>
  27814. <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
  27815. <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
  27816. controls.</span></p>
  27817. <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
  27818. 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
  27819. 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
  27820. element</a>.</p>
  27821. <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
  27822. 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,
  27823. 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>
  27824. <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
  27825. 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
  27826. 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
  27827. element</a>.</p>
  27828. <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
  27829. 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
  27830. <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
  27831. 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
  27832. <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
  27833. <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-16>form-associated element</a>.</p>
  27834. <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
  27835. element</a>, it must run the following steps:</p>
  27836. <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
  27837. 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
  27838. 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>
  27839. <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>
  27840. <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
  27841. 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,
  27842. 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
  27843. 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>
  27844. <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
  27845. <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
  27846. <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>
  27847. element.<li><p>Otherwise, the element is left unassociated.</ol>
  27848. <div class=example>
  27849. <p>In the following non-conforming snippet:</p>
  27850. <pre class=bad>...
  27851. &lt;form id="a">
  27852. &lt;div id="b">&lt;/div>
  27853. &lt;/form>
  27854. &lt;script>
  27855. document.getElementById('b').innerHTML =
  27856. '&lt;table>&lt;tr>&lt;td>&lt;form id="c">&lt;input id="d">&lt;/table>' +
  27857. '&lt;input id="e">';
  27858. &lt;/script>
  27859. ...</pre>
  27860. <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
  27861. owner</a> of "e" would be the outer form "a".</p>
  27862. <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
  27863. parser</a>. Then, the <code id=association-of-controls-and-forms:dom-innerhtml><a href=#dom-innerhtml>innerHTML</a></code> algorithm moves the nodes
  27864. from the temporary document to the "b" element. At this point, the nodes see their ancestor chain
  27865. change, and thus all the "magic" associations done by the parser are reset to normal ancestor
  27866. associations.</p>
  27867. <p>This example is a non-conforming document, though, as it is a violation of the content models
  27868. to nest <code id=association-of-controls-and-forms:the-form-element-13><a href=#the-form-element>form</a></code> elements.</p>
  27869. </div>
  27870. <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>
  27871. <p>Returns the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-10>form owner</a>.</p>
  27872. <p>Returns null if there isn't one.</p>
  27873. </dl>
  27874. <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>
  27875. 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
  27876. there isn't one.</p>
  27877. <h4 id=attributes-common-to-form-controls>4.10.19 Attributes common to form controls</h4>
  27878. <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>
  27879. <p>The <dfn id=attr-fe-name><code>name</code></dfn> content attribute gives the name of the
  27880. 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
  27881. not be the empty string.</p>
  27882. <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
  27883. "<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>
  27884. <dl><dt><dfn id=attr-fe-name-isindex><code>isindex</code></dfn><dd>
  27885. <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
  27886. 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
  27887. the submission to only include the value of this control, with no name.</p>
  27888. <dt><dfn id=attr-fe-name-charset><code>_charset_</code></dfn><dd>
  27889. <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>
  27890. 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
  27891. value during submission consisting of the submission character encoding.</p>
  27892. </dl>
  27893. <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>
  27894. the <code id=naming-form-controls:-the-name-attribute:attr-fe-name-2><a href=#attr-fe-name>name</a></code> content attribute.</p>
  27895. <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>
  27896. <p>The <dfn id=attr-fe-dirname><code>dirname</code></dfn> attribute on a form control element
  27897. 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
  27898. 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
  27899. specified, its value must not be the empty string.</p>
  27900. <div class=example>
  27901. <p>In this example, a form contains a text field and a submission button:</p>
  27902. <pre>&lt;form action="addcomment.cgi" method=post>
  27903. &lt;p>&lt;label>Comment: &lt;input type=text name="comment" dirname="comment.dir" required>&lt;/label>&lt;/p>
  27904. &lt;p>&lt;button name="mode" type=submit value="add">Post Comment&lt;/button>&lt;/p>
  27905. &lt;/form></pre>
  27906. <p>When the user submits the form, the user agent includes three fields, one called "comment",
  27907. one called "comment.dir", and one called "mode"; so if the user types "Hello", the submission
  27908. body might be something like:</p>
  27909. <pre>comment=Hello&amp;<strong>comment.dir=ltr</strong>&amp;mode=add</pre>
  27910. <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
  27911. something like:</p>
  27912. <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7&amp;<strong>comment.dir=rtl</strong>&amp;mode=add</pre>
  27913. </div>
  27914. <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>
  27915. <p>A <dfn id=attr-fe-maxlength>form control <code>maxlength</code> attribute</dfn>,
  27916. controlled by a <var>dirty value flag</var>, declares a limit on the number of characters
  27917. a user can input.</p>
  27918. <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
  27919. 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
  27920. parsing non-negative integers</a> to its value results in a number, then that number is the
  27921. element's <dfn id=maximum-allowed-value-length>maximum allowed value length</dfn>. If the attribute is omitted or parsing its
  27922. 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>
  27923. <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
  27924. 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
  27925. 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
  27926. 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>
  27927. <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
  27928. 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>
  27929. <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
  27930. 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
  27931. <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>
  27932. <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>
  27933. <p>A <dfn id=attr-fe-minlength>form control <code>minlength</code> attribute</dfn>,
  27934. controlled by a <var>dirty value flag</var>, declares a lower bound on the number of
  27935. characters a user can input.</p>
  27936. <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
  27937. <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
  27938. <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
  27939. a value at all. If the empty string is not allowed, then the <code>required</code>
  27940. attribute also needs to be set.</p>
  27941. <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
  27942. 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
  27943. parsing non-negative integers</a> to its value results in a number, then that number is the
  27944. element's <dfn id=minimum-allowed-value-length>minimum allowed value length</dfn>. If the attribute is omitted or parsing its
  27945. 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>
  27946. <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
  27947. 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
  27948. 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>
  27949. <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
  27950. 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
  27951. <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
  27952. 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
  27953. from being too short</a>.</p>
  27954. <div class=example>
  27955. <p>In this example, there are four text fields. The first is required, and has to be at least 5
  27956. characters long. The other three are optional, but if the user fills one in, the user has to
  27957. enter at least 10 characters.</p>
  27958. <pre>&lt;form action="/events/menu.cgi" method="post">
  27959. &lt;p>&lt;label>Name of Event: &lt;input required minlength=5 maxlength=50 name=event>&lt;/label>&lt;/p>
  27960. &lt;p>&lt;label>Describe what you would like for breakfast, if anything:
  27961. &lt;textarea name="breakfast" minlength="10">&lt;/textarea>&lt;/label>&lt;/p>
  27962. &lt;p>&lt;label>Describe what you would like for lunch, if anything:
  27963. &lt;textarea name="lunch" minlength="10">&lt;/textarea>&lt;/label>&lt;/p>
  27964. &lt;p>&lt;label>Describe what you would like for dinner, if anything:
  27965. &lt;textarea name="dinner" minlength="10">&lt;/textarea>&lt;/label>&lt;/p>
  27966. &lt;p>&lt;input type=submit value="Submit Request">&lt;/p>
  27967. &lt;/form></pre>
  27968. </div>
  27969. <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>
  27970. <p>The <dfn id=attr-fe-disabled><code>disabled</code></dfn> content attribute is a
  27971. <a href=#boolean-attribute id=enabling-and-disabling-form-controls:-the-disabled-attribute:boolean-attribute>boolean attribute</a>.</p>
  27972. <p>A form control is <dfn id=concept-fe-disabled>disabled</dfn> if any of the following
  27973. conditions are met:</p>
  27974. <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
  27975. <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
  27976. 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
  27977. 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
  27978. any.</ol>
  27979. <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
  27980. <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>
  27981. <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
  27982. validation</a>.</p>
  27983. <p>The <dfn id=dom-fe-disabled><code>disabled</code></dfn> IDL attribute must
  27984. <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>
  27985. <h5 id=form-submission>4.10.19.6 Form submission</h5>
  27986. <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
  27987. and on <a href=#concept-submit-button id=form-submission:concept-submit-button>submit buttons</a> (elements that represent buttons
  27988. 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).
  27989. <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>
  27990. 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>
  27991. <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
  27992. the corresponding attributes on the <code id=form-submission:the-form-element-3><a href=#the-form-element>form</a></code> element.</p>
  27993. <hr>
  27994. <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
  27995. 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>
  27996. <p>The <dfn id=concept-fs-action>action</dfn> of an element is the value of the element's
  27997. <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
  27998. <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
  27999. one, or else the empty string.</p>
  28000. <hr>
  28001. <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
  28002. states:</p>
  28003. <ul><li>The keyword <dfn id=attr-fs-method-get-keyword><code>get</code></dfn>, mapping to the
  28004. 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
  28005. 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
  28006. the state <dfn id=attr-fs-method-dialog>dialog</dfn>, indicating that submitting the
  28007. <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
  28008. itself, if any, and otherwise not submit.</ul>
  28009. <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
  28010. <code id=form-submission:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code> attribute.)</p>
  28011. <p>The <dfn id=concept-fs-method>method</dfn> of an element is one of those states. If the
  28012. 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
  28013. owner</a>'s <code id=form-submission:attr-fs-method-3><a href=#attr-fs-method>method</a></code> attribute's state.</p>
  28014. <div class=example>
  28015. <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
  28016. 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
  28017. query is submitted in the URL:</p>
  28018. <pre>&lt;form method="get" action="/search.cgi">
  28019. &lt;p>&lt;label>Search terms: &lt;input type=search name=q>&lt;/label>&lt;/p>
  28020. &lt;p>&lt;input type=submit>&lt;/p>
  28021. &lt;/form></pre>
  28022. </div>
  28023. <div class=example>
  28024. <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
  28025. 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
  28026. message is submitted in the HTTP request's body:</p>
  28027. <pre>&lt;form method="post" action="/post-message.cgi">
  28028. &lt;p>&lt;label>Message: &lt;input type=text name=m>&lt;/label>&lt;/p>
  28029. &lt;p>&lt;input type=submit value="Submit message">&lt;/p>
  28030. &lt;/form></pre>
  28031. </div>
  28032. <div class=example>
  28033. <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
  28034. automatically close when the form is submitted.</p>
  28035. <pre lang=en-GB>&lt;dialog id="ship">
  28036. &lt;form method=dialog>
  28037. &lt;p>A ship has arrived in the harbour.&lt;/p>
  28038. &lt;button type=submit value="board">Board the ship&lt;/button>
  28039. &lt;button type=submit value="call">Call to the captain&lt;/button>
  28040. &lt;/form>
  28041. &lt;/dialog>
  28042. &lt;script>
  28043. var ship = document.getElementById('ship');
  28044. ship.showModal();
  28045. ship.onclose = function (event) {
  28046. if (ship.returnValue == 'board') {
  28047. // ...
  28048. } else {
  28049. // ...
  28050. }
  28051. };
  28052. &lt;/script></pre>
  28053. </div>
  28054. <hr>
  28055. <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
  28056. states:</p>
  28057. <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>
  28058. <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
  28059. <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>
  28060. attribute.)</p>
  28061. <p>The <dfn id=concept-fs-enctype>enctype</dfn> of an element is one of those three states.
  28062. 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
  28063. <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>
  28064. <hr>
  28065. <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
  28066. have values that are <a href=#valid-browsing-context-name-or-keyword id=form-submission:valid-browsing-context-name-or-keyword>valid browsing context
  28067. names or keywords</a>.</p>
  28068. <p>The <dfn id=concept-fs-target>target</dfn> of an element is the value of the element's
  28069. <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
  28070. <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
  28071. 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
  28072. <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,
  28073. if there is no such element, the empty string.</p>
  28074. <hr>
  28075. <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
  28076. not to be validated during submission.</p>
  28077. <p>The <dfn id=concept-fs-novalidate>no-validate state</dfn> of an element is true if the
  28078. 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
  28079. <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,
  28080. and false otherwise.</p>
  28081. <div class=example>
  28082. <p>This attribute is useful to include "save" buttons on forms that have validation constraints,
  28083. to allow users to save their progress even though they haven't fully entered the data in the
  28084. form. The following example shows a simple form that has two required fields. There are three
  28085. buttons: one to submit the form, which requires both fields to be filled in; one to save the form
  28086. so that the user can come back and fill it in later; and one to cancel the form altogether.</p>
  28087. <pre>&lt;form action="editor.cgi" method="post">
  28088. &lt;p>&lt;label>Name: &lt;input required name=fn>&lt;/label>&lt;/p>
  28089. &lt;p>&lt;label>Essay: &lt;textarea required name=essay>&lt;/textarea>&lt;/label>&lt;/p>
  28090. &lt;p>&lt;input type=submit name=submit value="Submit essay">&lt;/p>
  28091. &lt;p>&lt;input type=submit formnovalidate name=save value="Save essay">&lt;/p>
  28092. &lt;p>&lt;input type=submit formnovalidate name=cancel value="Cancel">&lt;/p>
  28093. &lt;/form></pre>
  28094. </div>
  28095. <hr>
  28096. <p>The <dfn id=dom-fs-action><code>action</code></dfn> IDL attribute must
  28097. <a href=#reflect id=form-submission:reflect>reflect</a> the content attribute of the same name, except that on getting, when the
  28098. 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>
  28099. must be returned instead. The <dfn id=dom-fs-target><code>target</code></dfn> IDL attribute
  28100. 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
  28101. 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
  28102. <dfn id=dom-fs-encoding><code>encoding</code></dfn> IDL attribute must <a href=#reflect id=form-submission:reflect-4>reflect</a>
  28103. 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
  28104. values</a>. The <dfn id=dom-fs-novalidate><code>noValidate</code></dfn> IDL attribute must
  28105. <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
  28106. <dfn id=dom-fs-formaction><code>formAction</code></dfn> IDL attribute must
  28107. <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,
  28108. except that on getting, when the content attribute is missing or its value is the empty string,
  28109. <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>
  28110. 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
  28111. known values</a>. The <dfn id=dom-fs-formmethod><code>formMethod</code></dfn> IDL
  28112. 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
  28113. 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
  28114. <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
  28115. attribute. The <dfn id=dom-fs-formtarget><code>formTarget</code></dfn> IDL attribute must
  28116. <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.
  28117. </p>
  28118. <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>
  28119. <p>The <dfn id=attr-fe-autofocus><code>autofocus</code></dfn> content attribute allows the
  28120. author to indicate that a control is to be focused as soon as the page is loaded or as soon as the
  28121. <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
  28122. without having to manually focus the main control.</p>
  28123. <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
  28124. attribute</a>.</p>
  28125. <p>An element's <dfn id=nearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root element</dfn> is the element itself
  28126. 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
  28127. <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>
  28128. <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
  28129. 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
  28130. specified.</p>
  28131. <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
  28132. 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
  28133. should run the following steps:</p>
  28134. <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
  28135. 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
  28136. 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
  28137. 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
  28138. <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
  28139. 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
  28140. 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
  28141. 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
  28142. <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
  28143. 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
  28144. 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
  28145. 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
  28146. agents may also change the scrolling position of the document, or perform some other action that
  28147. 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
  28148. <a href=#user-interaction-task-source id=autofocusing-a-form-control:-the-autofocus-attribute:user-interaction-task-source>user interaction task source</a>.</ol>
  28149. <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>
  28150. 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>
  28151. <p class=note>Focusing the control does not imply that the user agent must focus the browser
  28152. window if it has lost focus.</p>
  28153. <p>The <dfn id=dom-fe-autofocus><code>autofocus</code></dfn> IDL attribute must
  28154. <a href=#reflect id=autofocusing-a-form-control:-the-autofocus-attribute:reflect>reflect</a> the content attribute of the same name.</p>
  28155. <div class=example>
  28156. <p>In the following snippet, the text control would be focused when
  28157. the document was loaded.</p>
  28158. <pre>&lt;input maxlength="256" name="q" value="" autofocus>
  28159. &lt;input type="submit" value="Search"></pre>
  28160. </div>
  28161. <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>
  28162. <p>The <dfn id=attr-fe-inputmode><code>inputmode</code></dfn> content attribute is an
  28163. <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
  28164. helpful for users entering content into the form control.</p>
  28165. <p>User agents must recognise all the keywords and corresponding states given below, but need not
  28166. support all of the corresponding states. If a keyword's state is not supported, the user agent
  28167. must act as if the keyword instead mapped to the given state's fallback state, as defined below.
  28168. This fallback behaviour is transitive.</p>
  28169. <p class=note>For example, if a user agent with a QWERTY keyboard layout does not support text
  28170. 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
  28171. <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
  28172. <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>
  28173. <p>The possible keywords and states for the attributes are listed in the following table. The
  28174. keywords are listed in the first column. Each maps to the state given in the cell in the second
  28175. column of that keyword's row, and that state has the fallback state given in the cell in the third
  28176. column of that row.</p>
  28177. <table class=three-column-nowrap><thead><tr><th> Keyword
  28178. <th> State
  28179. <th> Fallback state
  28180. <th> Description
  28181. <tbody><tr><td> <dfn id=attr-fe-inputmode-keyword-verbatim><code>verbatim</code></dfn>
  28182. <td> <dfn id=attr-fe-inputmode-state-verbatim>Latin Verbatim</dfn>
  28183. <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default>Default</a>
  28184. <td> Alphanumeric Latin-script input of non-prose content, e.g. usernames, passwords, product codes.
  28185. <tr><td> <dfn id=attr-fe-inputmode-keyword-latin><code>latin</code></dfn>
  28186. <td> <dfn id=attr-fe-inputmode-state-latin>Latin Text</dfn>
  28187. <td> <a href=#attr-fe-inputmode-state-verbatim id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-verbatim-2>Latin Verbatim</a>
  28188. <td> Latin-script input in the user's preferred language(s), with some typing aids enabled
  28189. (e.g. text prediction). Intended for human-to-computer communications, e.g. free-form text
  28190. search fields.
  28191. <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-name><code>latin-name</code></dfn>
  28192. <td> <dfn id=attr-fe-inputmode-state-latin-name>Latin Name</dfn>
  28193. <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-2>Latin Text</a>
  28194. <td> Latin-script input in the user's preferred language(s), with typing aids intended for
  28195. entering human names enabled (e.g. text prediction from the user's contact list and automatic
  28196. capitalisation at every word). Intended for situations such as customer name fields.
  28197. <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-prose><code>latin-prose</code></dfn>
  28198. <td> <dfn id=attr-fe-inputmode-state-latin-prose>Latin Prose</dfn>
  28199. <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-3>Latin Text</a>
  28200. <td> Latin-script input in the user's preferred language(s), with aggressive typing aids
  28201. intended for human-to-human communications enabled (e.g. text prediction and automatic
  28202. capitalisation at the start of sentences). Intended for situations such as e-mails and instant
  28203. messaging.
  28204. <tr><td> <dfn id=attr-fe-inputmode-keyword-full-width-latin><code>full-width-latin</code></dfn>
  28205. <td> <dfn id=attr-fe-inputmode-state-full-width-latin>Full-width Latin</dfn>
  28206. <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-4>Latin Prose</a>
  28207. <td> Latin-script input in the user's secondary language(s), using full-width characters, with
  28208. aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction
  28209. and automatic capitalisation at the start of sentences). Intended for latin text embedded
  28210. inside CJK text.
  28211. <tr><td> <dfn id=attr-fe-inputmode-keyword-kana><code>kana</code></dfn>
  28212. <td> <dfn id=attr-fe-inputmode-state-kana>Kana</dfn>
  28213. <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-2>Default</a>
  28214. <td> Kana or romaji input, typically hiragana input, using full-width characters, with support
  28215. for converting to kanji. Intended for Japanese text input.
  28216. <tr><td> <dfn id=attr-fe-inputmode-keyword-kana-name><code>kana-name</code></dfn>
  28217. <td> <dfn id=attr-fe-inputmode-state-kana-name>Kana Name</dfn>
  28218. <td> <a href=#attr-fe-inputmode-state-kana id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana>Kana</a>
  28219. <td> Kana or romaji input, typically hiragana input, using full-width characters, with support
  28220. for converting to kanji, and with typing aids intended for entering human names enabled (e.g.
  28221. text prediction from the user's contact list). Intended for situations such as customer name
  28222. fields.
  28223. <tr><td> <dfn id=attr-fe-inputmode-keyword-katakana><code>katakana</code></dfn>
  28224. <td> <dfn id=attr-fe-inputmode-state-katakana>Katakana</dfn>
  28225. <td> <a href=#attr-fe-inputmode-state-kana id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana-2>Kana</a>
  28226. <td> Katakana input, using full-width characters, with support for converting to kanji.
  28227. Intended for Japanese text input.
  28228. <tr><td> <dfn id=attr-fe-inputmode-keyword-numeric><code>numeric</code></dfn>
  28229. <td> <dfn id=attr-fe-inputmode-state-numeric>Numeric</dfn>
  28230. <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-3>Default</a>
  28231. <td> Numeric input, including keys for the digits 0 to 9, the user's preferred thousands
  28232. separator character, and the character for indicating negative numbers. Intended for numeric
  28233. 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)">&lt;input type=number></a></code>".)
  28234. <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-tel><code>tel</code></dfn>
  28235. <td> <dfn id=attr-fe-inputmode-state-telephone>Telephone</dfn>
  28236. <td> <a href=#attr-fe-inputmode-state-numeric id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-numeric>Numeric</a>
  28237. <td> Telephone number input, including keys for the digits 0 to 9, the "#" character, and the
  28238. "*" character. In some locales, this can also include alphabetic mnemonic labels (e.g. in the
  28239. 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)">&lt;input
  28240. type=tel></a></code>" instead.
  28241. <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-email><code>email</code></dfn>
  28242. <td> <dfn id=attr-fe-inputmode-state-email>E-mail</dfn>
  28243. <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-4>Default</a>
  28244. <td> Text input in the user's locale, with keys for aiding in the input of e-mail addresses,
  28245. such as that for the "@" character and the "." character. <a href=#avoid-inputmode>Rarely
  28246. necessary</a>; use "<code id="input-modalities:-the-inputmode-attribute:e-mail-state-(type=email)"><a href="#e-mail-state-(type=email)">&lt;input type=email></a></code>" instead.
  28247. <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-url><code>url</code></dfn>
  28248. <td> <dfn id=attr-fe-inputmode-state-url>URL</dfn>
  28249. <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-5>Default</a>
  28250. <td> Text input in the user's locale, with keys for aiding in the input of Web addresses, such
  28251. as that for the "/" and "." characters and for quick input of strings commonly found in domain
  28252. 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)">&lt;input type=url></a></code>" instead.
  28253. </table>
  28254. <p id=avoid-inputmode>The last three keywords listed above are only provided for completeness,
  28255. and are rarely necessary, as dedicated input controls exist for their usual use cases (as
  28256. described in the table above).</p>
  28257. <p>User agents must all support the <dfn id=attr-fe-inputmode-state-default>Default</dfn> input mode state, which corresponds to the
  28258. user agent's default input modality. This specification does not define how the
  28259. 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>
  28260. <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
  28261. 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
  28262. designed to fit the description of the state in the table above. This value can change
  28263. dynamically; user agents should update their interface as the attribute changes state, unless that
  28264. would go against the user's wishes.</p>
  28265. <h5 id=autofill>4.10.19.8 Autofill</h5>
  28266. <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>
  28267. <p>User agents sometimes have features for helping users fill forms in, for example prefilling the
  28268. 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
  28269. to the user agent how to, or indeed whether to, provide such a feature.</p>
  28270. <p>There are two ways this attribute is used. When wearing the <dfn id=autofill-expectation-mantle>autofill expectation
  28271. 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
  28272. 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
  28273. value.</p>
  28274. <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
  28275. 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
  28276. 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>
  28277. <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
  28278. 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
  28279. 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
  28280. 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>",
  28281. or <a href=#autofill-detail-tokens id=autofilling-form-controls:-the-autocomplete-attribute:autofill-detail-tokens>autofill detail tokens</a>.</p>
  28282. <p>When wearing the <a href=#autofill-anchor-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-2>autofill anchor
  28283. 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
  28284. 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
  28285. "<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>
  28286. <p><dfn id=autofill-detail-tokens>Autofill detail tokens</dfn> are the following, in the order given below:</p>
  28287. <ol><li>
  28288. <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>
  28289. match for the string "<dfn id=attr-fe-autocomplete-section><code>section-</code></dfn>",
  28290. meaning that the field belongs to the named group.</p>
  28291. <div class=example>
  28292. <p>For example, if there are two shipping addresses in the form, then they could be marked up
  28293. as:</p>
  28294. <pre>&lt;fieldset>
  28295. &lt;legend>Ship the blue gift to...&lt;/legend>
  28296. &lt;p> &lt;label> Address: &lt;input name=ba autocomplete="section-blue shipping street-address"> &lt;/label>
  28297. &lt;p> &lt;label> City: &lt;input name=bc autocomplete="section-blue shipping address-level1"> &lt;/label>
  28298. &lt;p> &lt;label> Postal Code: &lt;input name=bp autocomplete="section-blue shipping postal-code"> &lt;/label>
  28299. &lt;/fieldset>
  28300. &lt;fieldset>
  28301. &lt;legend>Ship the red gift to...&lt;/legend>
  28302. &lt;p> &lt;label> Address: &lt;input name=ra autocomplete="section-red shipping street-address"> &lt;/label>
  28303. &lt;p> &lt;label> City: &lt;input name=rc autocomplete="section-red shipping address-level1"> &lt;/label>
  28304. &lt;p> &lt;label> Postal Code: &lt;input name=rp autocomplete="section-red shipping postal-code"> &lt;/label>
  28305. &lt;/fieldset></pre>
  28306. </div>
  28307. <li>
  28308. <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
  28309. following strings:</p>
  28310. <ul class=brief><li>"<dfn id=attr-fe-autocomplete-shipping><code>shipping</code></dfn>", meaning the field
  28311. is part of the shipping address or contact information
  28312. <li>"<dfn id=attr-fe-autocomplete-billing><code>billing</code></dfn>", meaning the field
  28313. is part of the billing address or contact information
  28314. </ul>
  28315. <li>
  28316. <p>Either of the following two options:</p>
  28317. <ul><li>
  28318. <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
  28319. <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
  28320. control</a>:</p>
  28321. <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>"
  28322. <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>"
  28323. <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>"
  28324. <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>"
  28325. <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>"
  28326. <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>"
  28327. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
  28328. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-username><a href=#attr-fe-autocomplete-username>username</a></code>"
  28329. <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>"
  28330. <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>"
  28331. <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>"
  28332. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
  28333. <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>"
  28334. <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>"
  28335. <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>"
  28336. <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>"
  28337. <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>"
  28338. <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>"
  28339. <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>"
  28340. <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>"
  28341. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
  28342. <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>"
  28343. <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>"
  28344. <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>"
  28345. <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>"
  28346. <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>"
  28347. <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>"
  28348. <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>"
  28349. <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>"
  28350. <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>"
  28351. <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>"
  28352. <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>"
  28353. <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>"
  28354. <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>"
  28355. <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>"
  28356. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
  28357. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
  28358. <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>"
  28359. <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>"
  28360. <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>"
  28361. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
  28362. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
  28363. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-photo><a href=#attr-fe-autocomplete-photo>photo</a></code>"
  28364. </ul>
  28365. <p>(See the table below for descriptions of these values.)</p>
  28366. <li>
  28367. <p>The following, in the given order:</p>
  28368. <ol><li>
  28369. <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
  28370. following strings:</p>
  28371. <ul class=brief><li>"<dfn id=attr-fe-autocomplete-home><code>home</code></dfn>", meaning the field is
  28372. for contacting someone at their residence
  28373. <li>"<dfn id=attr-fe-autocomplete-work><code>work</code></dfn>", meaning the field is
  28374. for contacting someone at their workplace
  28375. <li>"<dfn id=attr-fe-autocomplete-mobile><code>mobile</code></dfn>", meaning the field is for contacting someone regardless of location
  28376. <li>"<dfn id=attr-fe-autocomplete-fax><code>fax</code></dfn>", meaning the field
  28377. describes a fax machine's contact details
  28378. <li>"<dfn id=attr-fe-autocomplete-pager><code>pager</code></dfn>", meaning the field
  28379. describes a pager's or beeper's contact details
  28380. </ul>
  28381. <li>
  28382. <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
  28383. <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
  28384. control</a>:</p>
  28385. <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>"
  28386. <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>"
  28387. <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>"
  28388. <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>"
  28389. <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>"
  28390. <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>"
  28391. <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>"
  28392. <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>"
  28393. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
  28394. <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-impp><a href=#attr-fe-autocomplete-impp>impp</a></code>"
  28395. </ul>
  28396. <p>(See the table below for descriptions of these values.)</p>
  28397. </ol>
  28398. </ul>
  28399. </ol>
  28400. <p>As noted earlier, the meaning of the attribute and its keywords depends on the mantle that the
  28401. attribute is wearing.</p>
  28402. <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>...
  28403. <dd>
  28404. <p>The "<dfn id=attr-fe-autocomplete-off><code>off</code></dfn>" keyword indicates either
  28405. that the control's input data is particularly sensitive (for example the activation code for a
  28406. nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a
  28407. bank login) and the user will therefore have to explicitly enter the data each time, instead of
  28408. being able to rely on the UA to prefill the value for him; or that the document provides its own
  28409. autocomplete mechanism and does not want the user agent to provide autocompletion values.</p>
  28410. <p>The "<dfn id=attr-fe-autocomplete-on><code>on</code></dfn>" keyword indicates that the
  28411. user agent is allowed to provide the user with autocompletion values, but does not provide any
  28412. further information about what kind of data the user might be expected to enter. User agents would
  28413. have to use heuristics to decide what autocompletion values to suggest.</p>
  28414. <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
  28415. provide the user with autocompletion values, and specifies what kind of value is expected. The
  28416. meaning of each such keyword is described in the table below.</p>
  28417. <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
  28418. 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
  28419. 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>
  28420. <dt>When wearing the <a href=#autofill-anchor-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-3>autofill anchor mantle</a>...
  28421. <dd>
  28422. <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
  28423. of value specified is that value provided for this element. The meaning of each such keyword is
  28424. described in the table below.</p>
  28425. <div class=example>
  28426. <p>In this example the page has explicitly specified the currency and amount of the
  28427. transaction. The form requests a credit card and other billing details. The user agent could
  28428. use this information to suggest a credit card that it knows has sufficient balance and that
  28429. supports the relevant currency.</p>
  28430. <pre>&lt;form method=post action="step2.cgi">
  28431. &lt;input type=hidden autocomplete=transaction-currency value="CHF">
  28432. &lt;input type=hidden autocomplete=transaction-amount value="15.00">
  28433. &lt;p>&lt;label>Credit card number: &lt;input type=text inputmode=numeric autocomplete=cc-number>&lt;/label>
  28434. &lt;p>&lt;label>Expiry Date: &lt;input type=month autocomplete=cc-exp>&lt;/label>
  28435. &lt;p>&lt;input type=submit value="Continue...">
  28436. &lt;/form></pre>
  28437. </div>
  28438. </dl>
  28439. <p>The <dfn id=autofill-field>autofill field</dfn> keywords relate to each other as described in the table below. Each field name
  28440. listed on a row of this table corresponds to the meaning given in the cell for that row in the
  28441. column labeled "Meaning". Some fields correspond to subparts of other fields; for example, a
  28442. credit card expiry date can be expressed as one field giving both the month and year of expiry
  28443. ("<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
  28444. 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
  28445. ("<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
  28446. the broader fields cover multiple rows, in which the narrower fields are defined.</p>
  28447. <p class=note>Generally, authors are encouraged to use the broader fields rather than the
  28448. narrower fields, as the narrower fields tend to expose Western biases. For example, while it is
  28449. common in some Western cultures to have a given name and a family name, in that order (and thus
  28450. often referred to as a <i>first name</i> and a <i>surname</i>), many cultures put the family name
  28451. first and the given name second, and many others simply have one name (a <i>mononym</i>). Having a
  28452. single field is therefore more flexible.</p>
  28453. <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
  28454. is <dfn id=inappropriate-for-the-control>inappropriate for a control</dfn> if the control
  28455. 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
  28456. 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
  28457. into each group is described below the table.</p>
  28458. <table><thead><tr><th colspan=4> Field name
  28459. <th> Meaning
  28460. <th> Canonical Format
  28461. <th> Canonical Format Example
  28462. <th> Control group
  28463. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-name><code>name</code></dfn>"
  28464. <td>Full name
  28465. <td>Free-form text, no newlines
  28466. <td>Sir Timothy John Berners-Lee, OM, KBE, FRS, FREng, FRSA
  28467. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text>Text</a>
  28468. <tr><td class=non-rectangular-cell-indentation rowspan=5>
  28469. <td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-prefix><code>honorific-prefix</code></dfn>"
  28470. <td>Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "<span lang=fr>M<sup>lle</sup></span>")
  28471. <td>Free-form text, no newlines
  28472. <td>Sir
  28473. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-2>Text</a>
  28474. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-given-name><code>given-name</code></dfn>"
  28475. <td>Given name (in some Western cultures, also known as the <i>first name</i>)
  28476. <td>Free-form text, no newlines
  28477. <td>Timothy
  28478. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-3>Text</a>
  28479. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-additional-name><code>additional-name</code></dfn>"
  28480. <td>Additional names (in some Western cultures, also known as <i>middle names</i>, forenames other than the first name)
  28481. <td>Free-form text, no newlines
  28482. <td>John
  28483. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-4>Text</a>
  28484. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-family-name><code>family-name</code></dfn>"
  28485. <td>Family name (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
  28486. <td>Free-form text, no newlines
  28487. <td>Berners-Lee
  28488. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-5>Text</a>
  28489. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-suffix><code>honorific-suffix</code></dfn>"
  28490. <td>Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II")
  28491. <td>Free-form text, no newlines
  28492. <td>OM, KBE, FRS, FREng, FRSA
  28493. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-6>Text</a>
  28494. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-nickname><code>nickname</code></dfn>"
  28495. <td>Nickname, screen name, handle: a typically short name used instead of the full name
  28496. <td>Free-form text, no newlines
  28497. <td>Tim
  28498. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-7>Text</a>
  28499. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization-title><code>organization-title</code></dfn>"
  28500. <td>Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy Managing Director")
  28501. <td>Free-form text, no newlines
  28502. <td>Professor
  28503. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-8>Text</a>
  28504. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-username><code>username</code></dfn>"
  28505. <td>A username
  28506. <td>Free-form text, no newlines
  28507. <td>timbl
  28508. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-9>Text</a>
  28509. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-new-password><code>new-password</code></dfn>"
  28510. <td>A new password (e.g. when creating an account or changing a password)
  28511. <td>Free-form text, no newlines
  28512. <td>GUMFXbadyrS3
  28513. <td><a href=#control-group-password id=autofilling-form-controls:-the-autocomplete-attribute:control-group-password>Password</a>
  28514. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-current-password><code>current-password</code></dfn>"
  28515. <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)
  28516. <td>Free-form text, no newlines
  28517. <td>qwerty
  28518. <td><a href=#control-group-password id=autofilling-form-controls:-the-autocomplete-attribute:control-group-password-2>Password</a>
  28519. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization><code>organization</code></dfn>"
  28520. <td>Company name corresponding to the person, address, or contact information in the other fields associated with this field
  28521. <td>Free-form text, no newlines
  28522. <td>World Wide Web Consortium
  28523. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-10>Text</a>
  28524. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-street-address><code>street-address</code></dfn>"
  28525. <td>Street address (multiple lines, newlines preserved)
  28526. <td>Free-form text
  28527. <td>32 Vassar Street<br>
  28528. MIT Room 32-G524
  28529. <td><a href=#control-group-multiline id=autofilling-form-controls:-the-autocomplete-attribute:control-group-multiline>Multiline</a>
  28530. <tr><td class=non-rectangular-cell-indentation rowspan=3>
  28531. <td colspan=3>"<dfn id=attr-fe-autocomplete-address-line1><code>address-line1</code></dfn>"
  28532. <td rowspan=3>Street address (one line per field)
  28533. <td>Free-form text, no newlines
  28534. <td>32 Vassar Street
  28535. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-11>Text</a>
  28536. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line2><code>address-line2</code></dfn>"
  28537. <td>Free-form text, no newlines
  28538. <td>MIT Room 32-G524
  28539. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-12>Text</a>
  28540. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line3><code>address-line3</code></dfn>"
  28541. <td>Free-form text, no newlines
  28542. <td>
  28543. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-13>Text</a>
  28544. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level4><code>address-level4</code></dfn>"
  28545. <td>The most fine-grained <a href=#more-on-address-levels>administrative level</a>, in
  28546. addresses with four administrative levels
  28547. <td>Free-form text, no newlines
  28548. <td>
  28549. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-14>Text</a>
  28550. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level3><code>address-level3</code></dfn>"
  28551. <td>The <a href=#more-on-address-levels>third administrative level</a>, in addresses with
  28552. three or more administrative levels
  28553. <td>Free-form text, no newlines
  28554. <td>
  28555. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-15>Text</a>
  28556. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level2><code>address-level2</code></dfn>"
  28557. <td>The <a href=#more-on-address-levels>second administrative level</a>, in addresses with
  28558. two or more administrative levels; in the countries with two administrative levels, this would
  28559. typically be the city, town, village, or other locality within which the relevant street
  28560. address is found
  28561. <td>Free-form text, no newlines
  28562. <td>Cambridge
  28563. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-16>Text</a>
  28564. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level1><code>address-level1</code></dfn>"
  28565. <td>The broadest <a href=#more-on-address-levels>administrative level</a> in the address,
  28566. i.e. the province within which the locality is found; for example, in the US, this would be the
  28567. state; in Switzerland it would be the canton; in the UK, the post town
  28568. <td>Free-form text, no newlines
  28569. <td>MA
  28570. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-17>Text</a>
  28571. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country><code>country</code></dfn>"
  28572. <td>Country code
  28573. <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>
  28574. <td>US
  28575. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-18>Text</a>
  28576. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country-name><code>country-name</code></dfn>"
  28577. <td>Country name
  28578. <td>Free-form text, no newlines; <a href=#autofill-country>derived from <code>country</code> in some cases</a>
  28579. <td>US
  28580. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-19>Text</a>
  28581. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-postal-code><code>postal-code</code></dfn>"
  28582. <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)
  28583. <td>Free-form text, no newlines
  28584. <td>02139
  28585. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-20>Text</a>
  28586. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-name><code>cc-name</code></dfn>"
  28587. <td>Full name as given on the payment instrument
  28588. <td>Free-form text, no newlines
  28589. <td>Tim Berners-Lee
  28590. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-21>Text</a>
  28591. <tr><td class=non-rectangular-cell-indentation rowspan=3>
  28592. <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-given-name><code>cc-given-name</code></dfn>"
  28593. <td>Given name as given on the payment instrument (in some Western cultures, also known as the <i>first name</i>)
  28594. <td>Free-form text, no newlines
  28595. <td>Tim
  28596. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-22>Text</a>
  28597. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-additional-name><code>cc-additional-name</code></dfn>"
  28598. <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)
  28599. <td>Free-form text, no newlines
  28600. <td>
  28601. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-23>Text</a>
  28602. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-family-name><code>cc-family-name</code></dfn>"
  28603. <td>Family name given on the payment instrument (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
  28604. <td>Free-form text, no newlines
  28605. <td>Berners-Lee
  28606. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-24>Text</a>
  28607. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-number><code>cc-number</code></dfn>"
  28608. <td>Code identifying the payment instrument (e.g. the credit card number, bank account number)
  28609. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits>ASCII digits</a>
  28610. <td>4114360123456785
  28611. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-25>Text</a>
  28612. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-exp><code>cc-exp</code></dfn>"
  28613. <td>Expiration date of the payment instrument
  28614. <td><a href=#valid-month-string id=autofilling-form-controls:-the-autocomplete-attribute:valid-month-string>Valid month string</a>
  28615. <td>2014-12
  28616. <td><a href=#control-group-month id=autofilling-form-controls:-the-autocomplete-attribute:control-group-month>Month</a>
  28617. <tr><td class=non-rectangular-cell-indentation rowspan=2>
  28618. <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-month><code>cc-exp-month</code></dfn>"
  28619. <td>Month component of the expiration date of the payment instrument
  28620. <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer>Valid integer</a> in the range 1..12
  28621. <td>12
  28622. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric>Numeric</a>
  28623. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-year><code>cc-exp-year</code></dfn>"
  28624. <td>Year component of the expiration date of the payment instrument
  28625. <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-2>Valid integer</a> greater than zero
  28626. <td>2014
  28627. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-2>Numeric</a>
  28628. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-csc><code>cc-csc</code></dfn>"
  28629. <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)
  28630. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-2>ASCII digits</a>
  28631. <td>419
  28632. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-26>Text</a>
  28633. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-type><code>cc-type</code></dfn>"
  28634. <td>Type of payment instrument
  28635. <td>Free-form text, no newlines
  28636. <td>Visa
  28637. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-27>Text</a>
  28638. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-transaction-currency><code>transaction-currency</code></dfn>"
  28639. <td>The currency that the user would prefer the transaction to use
  28640. <td>ISO 4217 currency code <a href=#refsISO4217>[ISO4217]</a>
  28641. <td>GBP
  28642. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-28>Text</a>
  28643. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-transaction-amount><code>transaction-amount</code></dfn>"
  28644. <td>The amount that the user would like for the transaction (e.g. when entering a bid or sale price)
  28645. <td><a href=#valid-floating-point-number id=autofilling-form-controls:-the-autocomplete-attribute:valid-floating-point-number>Valid floating-point number</a>
  28646. <td>401.00
  28647. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-3>Numeric</a>
  28648. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-language><code>language</code></dfn>"
  28649. <td>Preferred language
  28650. <td>Valid BCP 47 language tag <a href=#refsBCP47>[BCP47]</a>
  28651. <td>en
  28652. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-29>Text</a>
  28653. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-bday><code>bday</code></dfn>"
  28654. <td>Birthday
  28655. <td><a href=#valid-date-string id=autofilling-form-controls:-the-autocomplete-attribute:valid-date-string>Valid date string</a>
  28656. <td>1955-06-08
  28657. <td><a href=#control-group-date id=autofilling-form-controls:-the-autocomplete-attribute:control-group-date>Date</a>
  28658. <tr><td class=non-rectangular-cell-indentation rowspan=3>
  28659. <td colspan=3>"<dfn id=attr-fe-autocomplete-bday-day><code>bday-day</code></dfn>"
  28660. <td>Day component of birthday
  28661. <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-3>Valid integer</a> in the range 1..31
  28662. <td>8
  28663. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-4>Numeric</a>
  28664. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-month><code>bday-month</code></dfn>"
  28665. <td>Month component of birthday
  28666. <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-4>Valid integer</a> in the range 1..12
  28667. <td>6
  28668. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-5>Numeric</a>
  28669. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-year><code>bday-year</code></dfn>"
  28670. <td>Year component of birthday
  28671. <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-5>Valid integer</a> greater than zero
  28672. <td>1955
  28673. <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-6>Numeric</a>
  28674. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-sex><code>sex</code></dfn>"
  28675. <td>Gender identity (e.g. Female, Fa'afafine)
  28676. <td>Free-form text, no newlines
  28677. <td>Male
  28678. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-30>Text</a>
  28679. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-url><code>url</code></dfn>"
  28680. <td>Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field
  28681. <td><a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url>Valid URL</a>
  28682. <td>http://www.w3.org/People/Berners-Lee/
  28683. <td><a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url>URL</a>
  28684. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-photo><code>photo</code></dfn>"
  28685. <td>Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field
  28686. <td> <a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url-2>Valid URL</a>
  28687. <td>http://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg
  28688. <td> <a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url-2>URL</a>
  28689. <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel><code>tel</code></dfn>"
  28690. <td>Full telephone number, including country code
  28691. <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 (+)
  28692. <td>+1 617 253 5702
  28693. <td><a href=#control-group-tel id=autofilling-form-controls:-the-autocomplete-attribute:control-group-tel>Tel</a>
  28694. <tr><td class=non-rectangular-cell-indentation rowspan=6>
  28695. <td colspan=3>"<dfn id=attr-fe-autocomplete-tel-country-code><code>tel-country-code</code></dfn>"
  28696. <td>Country code component of the telephone number
  28697. <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 (+)
  28698. <td>+1
  28699. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-31>Text</a>
  28700. <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-tel-national><code>tel-national</code></dfn>"
  28701. <td>Telephone number without the county code component, with a country-internal prefix applied if applicable
  28702. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-5>ASCII digits</a> and U+0020 SPACE characters
  28703. <td>617 253 5702
  28704. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-32>Text</a>
  28705. <tr><td class=non-rectangular-cell-indentation rowspan=4>
  28706. <td colspan=2>"<dfn id=attr-fe-autocomplete-tel-area-code><code>tel-area-code</code></dfn>"
  28707. <td>Area code component of the telephone number, with a country-internal prefix applied if applicable
  28708. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-6>ASCII digits</a>
  28709. <td>617
  28710. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-33>Text</a>
  28711. <tr><td colspan=2>"<dfn id=attr-fe-autocomplete-tel-local><code>tel-local</code></dfn>"
  28712. <td>Telephone number without the country code and area code components
  28713. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-7>ASCII digits</a>
  28714. <td>2535702
  28715. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-34>Text</a>
  28716. <tr><td class=non-rectangular-cell-indentation rowspan=2>
  28717. <td>"<dfn id=attr-fe-autocomplete-tel-local-prefix><code>tel-local-prefix</code></dfn>"
  28718. <td>First part of the component of the telephone number that follows the area code, when that component is split into two components
  28719. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-8>ASCII digits</a>
  28720. <td>253
  28721. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-35>Text</a>
  28722. <tr><td>"<dfn id=attr-fe-autocomplete-tel-local-suffix><code>tel-local-suffix</code></dfn>"
  28723. <td>Second part of the component of the telephone number that follows the area code, when that component is split into two components
  28724. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-9>ASCII digits</a>
  28725. <td>5702
  28726. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-36>Text</a>
  28727. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel-extension><code>tel-extension</code></dfn>"
  28728. <td>Telephone number internal extension code
  28729. <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-10>ASCII digits</a>
  28730. <td>1000
  28731. <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-37>Text</a>
  28732. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-email><code>email</code></dfn>"
  28733. <td>E-mail address
  28734. <td><a href=#valid-e-mail-address id=autofilling-form-controls:-the-autocomplete-attribute:valid-e-mail-address>Valid e-mail address</a>
  28735. <td>timbl@w3.org
  28736. <td><a href=#control-group-e-mail id=autofilling-form-controls:-the-autocomplete-attribute:control-group-e-mail>E-mail</a>
  28737. <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-impp><code>impp</code></dfn>"
  28738. <td>URL representing an instant messaging protocol endpoint (for example, "<code>aim:goim?screenname=example</code>" or "<code>xmpp:fred@example.net</code>")
  28739. <td><a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url-3>Valid URL</a>
  28740. <td>irc://example.org/timbl,isuser
  28741. <td><a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url-3>URL</a>
  28742. </table>
  28743. <p>The groups correspond to controls as follows:</p>
  28744. <dl><dt><dfn id=control-group-text>Text</dfn>
  28745. <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
  28746. <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
  28747. <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
  28748. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements
  28749. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element><a href=#the-select-element>select</a></code> elements
  28750. <dt><dfn id=control-group-multiline>Multiline</dfn>
  28751. <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
  28752. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements
  28753. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-2><a href=#the-select-element>select</a></code> elements
  28754. <dt><dfn id=control-group-password>Password</dfn>
  28755. <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
  28756. <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
  28757. <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
  28758. <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
  28759. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> elements
  28760. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-3><a href=#the-select-element>select</a></code> elements
  28761. <dt><dfn id=control-group-url>URL</dfn>
  28762. <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
  28763. <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
  28764. <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
  28765. <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
  28766. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> elements
  28767. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-4><a href=#the-select-element>select</a></code> elements
  28768. <dt><dfn id=control-group-e-mail>E-mail</dfn>
  28769. <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
  28770. <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
  28771. <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
  28772. <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
  28773. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code> elements
  28774. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-5><a href=#the-select-element>select</a></code> elements
  28775. <dt><dfn id=control-group-tel>Tel</dfn>
  28776. <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
  28777. <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
  28778. <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
  28779. <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
  28780. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code> elements
  28781. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-6><a href=#the-select-element>select</a></code> elements
  28782. <dt><dfn id=control-group-numeric>Numeric</dfn>
  28783. <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
  28784. <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
  28785. <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
  28786. <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
  28787. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code> elements
  28788. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-7><a href=#the-select-element>select</a></code> elements
  28789. <dt><dfn id=control-group-month>Month</dfn>
  28790. <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
  28791. <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
  28792. <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
  28793. <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
  28794. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-8><a href=#the-textarea-element>textarea</a></code> elements
  28795. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-8><a href=#the-select-element>select</a></code> elements
  28796. <dt><dfn id=control-group-date>Date</dfn>
  28797. <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
  28798. <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
  28799. <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
  28800. <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
  28801. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-9><a href=#the-textarea-element>textarea</a></code> elements
  28802. <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-9><a href=#the-select-element>select</a></code> elements
  28803. </dl>
  28804. <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
  28805. the locality of the street address. Different locales have different numbers of levels. For
  28806. example, the US uses two levels (state and town), the UK uses one or two depending on the address
  28807. (the post town, and in some cases the locality), and China can use three (province, city,
  28808. 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
  28809. represents the widest administrative division. Different locales order the fields in different
  28810. ways; for example, in the US the town (level 2) precedes the state (level 1); while in Japan the
  28811. prefecture (level 1) precedes the city (level 2) which precedes the district (level 3). Authors
  28812. are encouraged to provide forms that are presented in a way that matches the country's conventions
  28813. (hiding, showing, and rearranging fields accordingly as the user changes the country).</p>
  28814. <h6 id=processing-model-4>4.10.19.8.2 Processing model</h6>
  28815. <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
  28816. <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
  28817. an <dfn id=idl-exposed-autofill-value>IDL-exposed autofill value</dfn>.</p>
  28818. <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,
  28819. 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>
  28820. <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
  28821. 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>
  28822. <p>The <a href=#autofill-scope id=processing-model-4:autofill-scope>autofill scope</a> identifies the group of fields whose information concerns the
  28823. 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
  28824. applicable, the "<code>section-*</code>" prefix, e.g. "<code>billing</code>",
  28825. "<code>section-parent shipping</code>", or "<code>section-child shipping
  28826. home</code>".</p>
  28827. <p>These values are defined as the result of running the following algorithm:</p>
  28828. <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,
  28829. 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
  28830. <i>default</i>.<li><p>Let <var>index</var> be the index of the last token in <var>tokens</var>.<li>
  28831. <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
  28832. case-insensitive</a> match for one of the tokens given in the first column of the following
  28833. table, or if the number of tokens in <var>tokens</var> is greater than the maximum
  28834. number given in the cell in the second column of that token's row, then jump to the step labeled
  28835. <i>default</i>. Otherwise, let <var>field</var> be the string given in the cell of the
  28836. first column of the matching row, and let <var>category</var> be the value of the cell
  28837. in the third column of that same row.</p>
  28838. <table><thead><tr><th>Token
  28839. <th>Maximum number of tokens
  28840. <th>Category
  28841. <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"
  28842. <td>1
  28843. <td>Off
  28844. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>"
  28845. <td>1
  28846. <td>Automatic
  28847. <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>"
  28848. <td>3
  28849. <td>Normal
  28850. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-honorific-prefix><a href=#attr-fe-autocomplete-honorific-prefix>honorific-prefix</a></code>"
  28851. <td>3
  28852. <td>Normal
  28853. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>"
  28854. <td>3
  28855. <td>Normal
  28856. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-additional-name><a href=#attr-fe-autocomplete-additional-name>additional-name</a></code>"
  28857. <td>3
  28858. <td>Normal
  28859. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-family-name><a href=#attr-fe-autocomplete-family-name>family-name</a></code>"
  28860. <td>3
  28861. <td>Normal
  28862. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-honorific-suffix><a href=#attr-fe-autocomplete-honorific-suffix>honorific-suffix</a></code>"
  28863. <td>3
  28864. <td>Normal
  28865. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
  28866. <td>3
  28867. <td>Normal
  28868. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-organization-title><a href=#attr-fe-autocomplete-organization-title>organization-title</a></code>"
  28869. <td>3
  28870. <td>Normal
  28871. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-username><a href=#attr-fe-autocomplete-username>username</a></code>"
  28872. <td>3
  28873. <td>Normal
  28874. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-new-password><a href=#attr-fe-autocomplete-new-password>new-password</a></code>"
  28875. <td>3
  28876. <td>Normal
  28877. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-current-password><a href=#attr-fe-autocomplete-current-password>current-password</a></code>"
  28878. <td>3
  28879. <td>Normal
  28880. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
  28881. <td>3
  28882. <td>Normal
  28883. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-street-address-2><a href=#attr-fe-autocomplete-street-address>street-address</a></code>"
  28884. <td>3
  28885. <td>Normal
  28886. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line1><a href=#attr-fe-autocomplete-address-line1>address-line1</a></code>"
  28887. <td>3
  28888. <td>Normal
  28889. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line2><a href=#attr-fe-autocomplete-address-line2>address-line2</a></code>"
  28890. <td>3
  28891. <td>Normal
  28892. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line3><a href=#attr-fe-autocomplete-address-line3>address-line3</a></code>"
  28893. <td>3
  28894. <td>Normal
  28895. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level4><a href=#attr-fe-autocomplete-address-level4>address-level4</a></code>"
  28896. <td>3
  28897. <td>Normal
  28898. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level3><a href=#attr-fe-autocomplete-address-level3>address-level3</a></code>"
  28899. <td>3
  28900. <td>Normal
  28901. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level2><a href=#attr-fe-autocomplete-address-level2>address-level2</a></code>"
  28902. <td>3
  28903. <td>Normal
  28904. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level1><a href=#attr-fe-autocomplete-address-level1>address-level1</a></code>"
  28905. <td>3
  28906. <td>Normal
  28907. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
  28908. <td>3
  28909. <td>Normal
  28910. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>"
  28911. <td>3
  28912. <td>Normal
  28913. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-postal-code><a href=#attr-fe-autocomplete-postal-code>postal-code</a></code>"
  28914. <td>3
  28915. <td>Normal
  28916. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-name><a href=#attr-fe-autocomplete-cc-name>cc-name</a></code>"
  28917. <td>3
  28918. <td>Normal
  28919. <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>"
  28920. <td>3
  28921. <td>Normal
  28922. <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>"
  28923. <td>3
  28924. <td>Normal
  28925. <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>"
  28926. <td>3
  28927. <td>Normal
  28928. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-number><a href=#attr-fe-autocomplete-cc-number>cc-number</a></code>"
  28929. <td>3
  28930. <td>Normal
  28931. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-exp-2><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
  28932. <td>3
  28933. <td>Normal
  28934. <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>"
  28935. <td>3
  28936. <td>Normal
  28937. <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>"
  28938. <td>3
  28939. <td>Normal
  28940. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-csc><a href=#attr-fe-autocomplete-cc-csc>cc-csc</a></code>"
  28941. <td>3
  28942. <td>Normal
  28943. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-type><a href=#attr-fe-autocomplete-cc-type>cc-type</a></code>"
  28944. <td>3
  28945. <td>Normal
  28946. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-transaction-currency><a href=#attr-fe-autocomplete-transaction-currency>transaction-currency</a></code>"
  28947. <td>3
  28948. <td>Normal
  28949. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-transaction-amount><a href=#attr-fe-autocomplete-transaction-amount>transaction-amount</a></code>"
  28950. <td>3
  28951. <td>Normal
  28952. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
  28953. <td>3
  28954. <td>Normal
  28955. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
  28956. <td>3
  28957. <td>Normal
  28958. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-day><a href=#attr-fe-autocomplete-bday-day>bday-day</a></code>"
  28959. <td>3
  28960. <td>Normal
  28961. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-month><a href=#attr-fe-autocomplete-bday-month>bday-month</a></code>"
  28962. <td>3
  28963. <td>Normal
  28964. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-year><a href=#attr-fe-autocomplete-bday-year>bday-year</a></code>"
  28965. <td>3
  28966. <td>Normal
  28967. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
  28968. <td>3
  28969. <td>Normal
  28970. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
  28971. <td>3
  28972. <td>Normal
  28973. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-photo><a href=#attr-fe-autocomplete-photo>photo</a></code>"
  28974. <td>3
  28975. <td>Normal
  28976. <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>"
  28977. <td>4
  28978. <td>Contact
  28979. <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>"
  28980. <td>4
  28981. <td>Contact
  28982. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code>"
  28983. <td>4
  28984. <td>Contact
  28985. <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>"
  28986. <td>4
  28987. <td>Contact
  28988. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-local><a href=#attr-fe-autocomplete-tel-local>tel-local</a></code>"
  28989. <td>4
  28990. <td>Contact
  28991. <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>"
  28992. <td>4
  28993. <td>Contact
  28994. <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>"
  28995. <td>4
  28996. <td>Contact
  28997. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-extension><a href=#attr-fe-autocomplete-tel-extension>tel-extension</a></code>"
  28998. <td>4
  28999. <td>Contact
  29000. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
  29001. <td>4
  29002. <td>Contact
  29003. <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-impp><a href=#attr-fe-autocomplete-impp>impp</a></code>"
  29004. <td>4
  29005. <td>Contact
  29006. </table>
  29007. <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
  29008. 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>
  29009. 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
  29010. 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,
  29011. abort these steps.</p>
  29012. <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
  29013. 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
  29014. 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>
  29015. <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,
  29016. then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.<li>
  29017. <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
  29018. the following list, then run the substeps that follow:</p>
  29019. <ul class=brief><li>"<code id=processing-model-4:attr-fe-autocomplete-home><a href=#attr-fe-autocomplete-home>home</a></code>"
  29020. <li>"<code id=processing-model-4:attr-fe-autocomplete-work><a href=#attr-fe-autocomplete-work>work</a></code>"
  29021. <li>"<code id=processing-model-4:attr-fe-autocomplete-mobile><a href=#attr-fe-autocomplete-mobile>mobile</a></code>"
  29022. <li>"<code id=processing-model-4:attr-fe-autocomplete-fax-2><a href=#attr-fe-autocomplete-fax>fax</a></code>"
  29023. <li>"<code id=processing-model-4:attr-fe-autocomplete-pager><a href=#attr-fe-autocomplete-pager>pager</a></code>"
  29024. </ul>
  29025. <p>The substeps are:</p>
  29026. <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
  29027. 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
  29028. U+0020 SPACE character, and the previous value of <var>IDL value</var> (which at this
  29029. point will always be <var>field</var>).<li><p>If the <var>index</var>th entry in <var>tokens</var> is the first
  29030. entry, then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.</ol>
  29031. <li>
  29032. <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
  29033. case-insensitive</a> match for one of the strings in the following list, then run the
  29034. substeps that follow:</p>
  29035. <ul class=brief><li>"<code id=processing-model-4:attr-fe-autocomplete-shipping-2><a href=#attr-fe-autocomplete-shipping>shipping</a></code>"
  29036. <li>"<code id=processing-model-4:attr-fe-autocomplete-billing-2><a href=#attr-fe-autocomplete-billing>billing</a></code>"
  29037. </ul>
  29038. <p>The substeps are:</p>
  29039. <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
  29040. 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
  29041. U+0020 SPACE character, and the previous value of <var>IDL value</var> (which at this
  29042. 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
  29043. entry, then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.</ol>
  29044. <li><p>If the <var>index</var>th entry in <var>tokens</var> is not the first entry, then jump to
  29045. 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
  29046. 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
  29047. <i>default</i>.<li><p>Let <var>section</var> be the <var>index</var>th token in <var>tokens</var>,
  29048. <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
  29049. 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
  29050. tokens</var>.</p>
  29051. <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>
  29052. <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>
  29053. <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>
  29054. <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
  29055. 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
  29056. 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
  29057. 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
  29058. otherwise.<li>
  29059. <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
  29060. <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>
  29061. <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>
  29062. </ol>
  29063. <hr>
  29064. <p>For the purposes of autofill, a <dfn id="control's-data">control's data</dfn> depends on the kind of control:</p>
  29065. <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
  29066. 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>
  29067. 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>
  29068. <hr>
  29069. <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
  29070. <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>
  29071. <dl class=switch><dt>When wearing the <a href=#autofill-expectation-mantle id=processing-model-4:autofill-expectation-mantle>autofill expectation mantle</a>...
  29072. <dd>
  29073. <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
  29074. data</a>, and should not offer past values to the user.</p>
  29075. <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>
  29076. when <a href=#traverse-the-history id=processing-model-4:traverse-the-history>traversing the history</a>.</p>
  29077. <div class=example>
  29078. <p>Banks frequently do not want UAs to prefill login information:</p>
  29079. <pre>&lt;p>&lt;label>Account: &lt;input type="text" name="ac" autocomplete="off">&lt;/label>&lt;/p>
  29080. &lt;p>&lt;label>PIN: &lt;input type="password" name="pin" autocomplete="off">&lt;/label>&lt;/p></pre>
  29081. </div>
  29082. <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
  29083. data</a>, and may offer previously stored values to the user.</p>
  29084. <div class=example>
  29085. <p>For example, suppose a user visits a page with this control:</p>
  29086. <pre>&lt;select name="country">
  29087. &lt;option>Afghanistan
  29088. &lt;option>Albania
  29089. &lt;option>Algeria
  29090. &lt;option>Andorra
  29091. &lt;option>Angola
  29092. &lt;option>Antigua and Barbuda
  29093. &lt;option>Argentina
  29094. &lt;option>Armenia
  29095. &lt;!-- <em>...</em> -->
  29096. &lt;option>Yemen
  29097. &lt;option>Zambia
  29098. &lt;option>Zimbabwe
  29099. &lt;/select></pre>
  29100. <p>This might render as follows:</p>
  29101. <p><img src=http://images.whatwg.org/select-country-1.png alt="A drop-down control with a long alphabetical list of countries."></p>
  29102. <p>Suppose that on the first visit to this page, the user selects "Zambia". On the second visit,
  29103. the user agent could duplicate the entry for Zambia at the top of the list, so that the interface
  29104. instead looks like this:</p>
  29105. <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>
  29106. </div>
  29107. <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
  29108. 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
  29109. other fields exist in the form, and so forth.</p>
  29110. <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
  29111. match the meaning of the field name as given in the table earlier in this section. The
  29112. <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>
  29113. <p class=example>For example, if a user once entered one address into fields that used the
  29114. "<code id=processing-model-4:attr-fe-autocomplete-shipping-3><a href=#attr-fe-autocomplete-shipping>shipping</a></code>" keyword, and another address into
  29115. 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
  29116. 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
  29117. 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,
  29118. 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
  29119. either keyword.</p>
  29120. <dt>When wearing the <a href=#autofill-anchor-mantle id=processing-model-4:autofill-anchor-mantle-3>autofill anchor mantle</a>...
  29121. <dd>
  29122. <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
  29123. 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
  29124. 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>
  29125. combination.</p>
  29126. </dl>
  29127. <p>When the user agent <dfn id=concept-fe-autofill>autofills form controls</dfn>, elements
  29128. 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
  29129. 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
  29130. 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
  29131. human-readable name for the same country.</span> When a user agent fills in multiple fields at
  29132. 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
  29133. <a href=#autofill-scope id=processing-model-4:autofill-scope-8>autofill scope</a> must be filled with the same value.</p>
  29134. <p class=example>Suppose a user agent knows of two phone numbers, +1 555 123 1234 and +1 555 666
  29135. 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
  29136. in the same form with <code>autocomplete="shipping tel-local-suffix"</code> with the
  29137. value "7777". The only valid prefilled values given the aforementioned information would be "123"
  29138. and "1234", or "666" and "7777", respectively.</p>
  29139. <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
  29140. prefilled the form, then the month component of the former would have to match the latter.</p>
  29141. <div class=example>
  29142. <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
  29143. following markup snippet:</p>
  29144. <pre>&lt;form>
  29145. &lt;input type=hidden autocomplete="nickname" value="TreePlate">
  29146. &lt;input type=text autocomplete="nickname">
  29147. &lt;/form></pre>
  29148. <p>The only value that a conforming user agent could suggest in the text field is
  29149. "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>
  29150. </div>
  29151. <p>The "<code>section-*</code>" tokens in the <a href=#autofill-scope id=processing-model-4:autofill-scope-9>autofill scope</a> are opaque;
  29152. user agents must not attempt to derive meaning from the precise values of these tokens.</p>
  29153. <p class=example>For example, it would not be conforming if the user agent decided that it
  29154. 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
  29155. "<code>section-spouse</code>".</p>
  29156. <p>The autocompletion mechanism must be implemented by the user agent acting as if the user had
  29157. 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
  29158. document, or when the user agent <a href=#stop-parsing id=processing-model-4:stop-parsing>stops parsing</a>). User agents
  29159. must only prefill controls using values that the user could have entered.</p>
  29160. <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>
  29161. 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
  29162. 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
  29163. agent's only idea for what to prefill the field with is "Evan", then the user agent cannot prefill
  29164. 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
  29165. "Evan", since the user could not have done so themselves.</p>
  29166. <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
  29167. cause that control to <a href=#suffering-from-a-type-mismatch id=processing-model-4:suffering-from-a-type-mismatch>suffer from a type
  29168. mismatch</a>, <a href=#suffering-from-being-too-long id=processing-model-4:suffering-from-being-too-long>suffer from being too long</a>,
  29169. <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
  29170. 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
  29171. possible given the control's constraints, user agents must use the format given as canonical in
  29172. the aforementioned table. Where it's not possible for the canonical format to be used, user agents
  29173. should use heuristics to attempt to convert values so that they can be used.</p>
  29174. <div class=example>
  29175. <p>For example, if the user agent knows that the user's middle name is "Ines", and attempts to
  29176. prefill a form control that looks like this:</p>
  29177. <pre>&lt;input name=middle-initial maxlength=1 autocomplete="additional-name"></pre>
  29178. <p>...then the user agent could convert "Ines" to "I" and prefill it that way.</p>
  29179. </div>
  29180. <div class=example>
  29181. <p>A more elaborate example would be with month values. If the user agent knows that the user's
  29182. birthday is the 27th of July 2012, then it might try to prefill all of the following controls
  29183. with slightly different values, all driven from this information:</p>
  29184. <table><tr><td>
  29185. <pre>&lt;input name=b type=month autocomplete="bday"></pre>
  29186. <td>
  29187. 2012-07
  29188. <td>
  29189. 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
  29190. month/year combination.
  29191. <tr><td>
  29192. <pre>&lt;select name=c autocomplete="bday">
  29193. &lt;option>Jan
  29194. &lt;option>Feb
  29195. <em>...</em>
  29196. &lt;option>Jul
  29197. &lt;option>Aug
  29198. <em>...</em>
  29199. &lt;/select></pre>
  29200. <td>
  29201. July
  29202. <td>
  29203. The user agent picks the month from the listed options, either by noticing there are twelve
  29204. options and picking the 7th, or by recognising that one of the strings (three characters "Jul"
  29205. followed by a newline and a space) is a close match for the name of the month (July) in one of
  29206. the user agent's supported languages, or through some other similar mechanism.
  29207. <tr><td>
  29208. <pre>&lt;input name=a type=number min=1 max=12 autocomplete="bday-month"></pre>
  29209. <td>
  29210. 7
  29211. <td>
  29212. User agent converts "July" to a month number in the range 1..12, like the field.
  29213. <tr><td>
  29214. <pre>&lt;input name=a type=number min=0 max=11 autocomplete="bday-month"></pre>
  29215. <td>
  29216. 6
  29217. <td>
  29218. User agent converts "July" to a month number in the range 0..11, like the field.
  29219. <tr><td>
  29220. <pre>&lt;input name=a type=number min=1 max=11 autocomplete="bday-month"></pre>
  29221. <td>
  29222. <td>
  29223. User agent doesn't fill in the field, since it can't make a good guess as to what the form expects.
  29224. </table>
  29225. </div>
  29226. <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.
  29227. 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
  29228. 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>",
  29229. never remembering values. However, user agents should not allow users to trivially override the
  29230. <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
  29231. "<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
  29232. security implications for the user if all values are always remembered, regardless of the site's
  29233. preferences.</p>
  29234. <p>The <dfn id=dom-fe-autocomplete><code>autocomplete</code></dfn> IDL attribute, on getting,
  29235. 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
  29236. <a href=#reflect id=processing-model-4:reflect>reflect</a> the content attribute of the same name.</p>
  29237. <h6 id=user-interface-for-bulk-autofill>4.10.19.8.3 User interface for bulk autofill</h6>
  29238. <p>When the <dfn id=dom-form-requestautocomplete><code>requestAutocomplete()</code></dfn>
  29239. 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>
  29240. <ol><li><p>Let <var>form</var> be the element on which the method was invoked.<li>
  29241. <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
  29242. 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>
  29243. <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
  29244. 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>
  29245. 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
  29246. <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
  29247. 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
  29248. does not support autofill in such situations<li><p>another instance of this algorithm is already being run for <var>form</var></ul>
  29249. <p class=note>User agents are encouraged to log the precise cause in a developer console, to
  29250. aid debugging.</p>
  29251. <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
  29252. <i>original autocomplete value</i>.<li>
  29253. <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
  29254. the value of the element's <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
  29255. attribute:</p>
  29256. <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>
  29257. 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
  29258. 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>
  29259. <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
  29260. in <var>pending autofills</var>. Await the user's input. The user agent may include additional
  29261. (immutable) information, e.g. <a href="#control's-data" id="user-interface-for-bulk-autofill:control's-data">data</a> obtained from elements
  29262. with an <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute wearing the
  29263. <a href=#autofill-anchor-mantle id=user-interface-for-bulk-autofill:autofill-anchor-mantle>autofill anchor mantle</a>.<li>
  29264. <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>
  29265. <ol><li>
  29266. <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
  29267. <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>
  29268. <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
  29269. 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>
  29270. 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>
  29271. state</ul>
  29272. <p class=note>Again, user agents are encouraged to log the precise cause in a developer
  29273. console, to aid debugging.</p>
  29274. <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>
  29275. <p>For each element in <var>pending autofills</var>, run the following steps:</p>
  29276. <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
  29277. value</i> annotation associated with <var>candidate</var> in <var>pending
  29278. autofills</var>.<li>
  29279. <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>
  29280. <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
  29281. <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>
  29282. 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
  29283. 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
  29284. <var>old autocomplete value</var><li><p>the user provided a value to autofill <var>candidate</var></ul>
  29285. </ol>
  29286. <li>
  29287. <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
  29288. 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>
  29289. with the reason "<code id=user-interface-for-bulk-autofill:dom-autocompleteerrorreason-invalid><a href=#dom-autocompleteerrorreason-invalid>invalid</a></code>", and abort
  29290. these steps.</p>
  29291. <p class=note><a href=#statically-validate-the-constraints id=user-interface-for-bulk-autofill:statically-validate-the-constraints-2>Statically validating the
  29292. 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>
  29293. <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>
  29294. </ol>
  29295. <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>
  29296. element <var>target</var> with a reason <var>reason</var>, the user agent must
  29297. 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
  29298. <code>autocompleteerror</code>, which bubbles, is not cancelable, has no default action,
  29299. 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>
  29300. <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
  29301. 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>
  29302. <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>
  29303. <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>" };
  29304. [Constructor(DOMString type, optional <a href=#autocompleteerroreventinit id=the-autocompleteerrorevent-interface:autocompleteerroreventinit>AutocompleteErrorEventInit</a> eventInitDict)]
  29305. interface <dfn id=autocompleteerrorevent>AutocompleteErrorEvent</dfn> : <a href=#event id=the-autocompleteerrorevent-interface:event>Event</a> {
  29306. 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>;
  29307. };
  29308. dictionary <dfn id=autocompleteerroreventinit>AutocompleteErrorEventInit</dfn> : <a href=#eventinit id=the-autocompleteerrorevent-interface:eventinit>EventInit</a> {
  29309. <a href=#autocompleteerrorreason id=the-autocompleteerrorevent-interface:autocompleteerrorreason-2>AutocompleteErrorReason</a> reason;
  29310. };</pre>
  29311. <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>
  29312. <p>For the <code id=the-autocompleteerrorevent-interface:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> event, returns the
  29313. 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
  29314. below.</p>
  29315. </dl>
  29316. <p>The defined reason codes are:
  29317. <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>
  29318. <p>The autofill interface is disabled for this form.</p>
  29319. <p>There are many reasons why this might be the case; the precise reason is not given, to
  29320. protect the user's privacy. Amongst these reasons are such factors as:</p>
  29321. <ul class=brief><li><p>The page being delivered over an unencrypted connection (susceptible to
  29322. man-in-the-middle attacks), when the user agent does not want to risk the user's information
  29323. being provided to an attacker.<li><p>The form having a combination of fields for which the user agent does not have a
  29324. 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
  29325. 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>
  29326. <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
  29327. <a href=#concept-fv-valid id=the-autocompleteerrorevent-interface:concept-fv-valid>satisfy its constraints</a>.</dl>
  29328. <p>The <dfn id=dom-autocompleteerrorevent-reason><code>reason</code></dfn> attribute must
  29329. return the value it was initialised to. When the object is created, this attribute must be
  29330. initialised to the <a href=#dom-autocompleteerrorreason-none id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-none-2>empty string</a>. It
  29331. represents the context information for the event.</p>
  29332. <h4 id=textFieldSelection>4.10.20 APIs for the text field selections</h4>
  29333. <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
  29334. DOM interfaces for handling their selection:</p>
  29335. <pre class="idl extract"> void <a href=#dom-textarea/input-select id=textFieldSelection:dom-textarea/input-select>select</a>();
  29336. attribute unsigned long <a href=#dom-textarea/input-selectionstart id=textFieldSelection:dom-textarea/input-selectionstart>selectionStart</a>;
  29337. attribute unsigned long <a href=#dom-textarea/input-selectionend id=textFieldSelection:dom-textarea/input-selectionend>selectionEnd</a>;
  29338. attribute DOMString <a href=#dom-textarea/input-selectiondirection id=textFieldSelection:dom-textarea/input-selectiondirection>selectionDirection</a>;
  29339. void <a href=#dom-textarea/input-setrangetext id=textFieldSelection:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
  29340. 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");
  29341. 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>
  29342. <p>The <code id=textFieldSelection:dom-textarea/input-setrangetext-3><a href=#dom-textarea/input-setrangetext>setRangeText</a></code> method uses the following
  29343. enumeration:</p>
  29344. <pre class=idl>enum <dfn id=selectionmode>SelectionMode</dfn> {
  29345. "<a href=#dom-selectionmode-select id=textFieldSelection:dom-selectionmode-select>select</a>",
  29346. "<a href=#dom-selectionmode-start id=textFieldSelection:dom-selectionmode-start>start</a>",
  29347. "<a href=#dom-selectionmode-end id=textFieldSelection:dom-selectionmode-end>end</a>",
  29348. "<a href=#dom-selectionmode-preserve id=textFieldSelection:dom-selectionmode-preserve>preserve</a>", // default
  29349. };</pre>
  29350. <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
  29351. <code id=textFieldSelection:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> text fields.</p>
  29352. <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>
  29353. <p>Selects everything in the text field.</p>
  29354. <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>
  29355. <p>Returns the offset to the start of the selection.</p>
  29356. <p>Can be set, to change the start of the selection.</p>
  29357. <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>
  29358. <p>Returns the offset to the end of the selection.</p>
  29359. <p>Can be set, to change the end of the selection.</p>
  29360. <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>
  29361. <p>Returns the current direction of the selection.</p>
  29362. <p>Can be set, to change the direction of the selection.</p>
  29363. <p>The possible values are "<code>forward</code>", "<code>backward</code>", and "<code>none</code>".</p>
  29364. <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>
  29365. <p>Changes the selection to cover the given substring in the given direction. If the direction
  29366. is omitted, it will be reset to be the platform default (none or forward).</p>
  29367. <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>
  29368. <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>
  29369. <p>The final argument determines how the selection should be set after the text has been
  29370. replaced. The possible values are:</p>
  29371. <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>
  29372. </dl>
  29373. <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
  29374. must act as described below.</p>
  29375. <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
  29376. <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
  29377. attributes must operate on the element's <a href=#concept-textarea-raw-value id=textFieldSelection:concept-textarea-raw-value>raw
  29378. value</a>.</p>
  29379. <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>
  29380. 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
  29381. section, so that, e.g., all the same events fire.</p>
  29382. <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
  29383. <i>direction</i>, which is either <i>forward</i>, <i>backward</i>, or <i>none</i>. This direction
  29384. is set when the user manipulates the selection. The exact meaning of the selection direction
  29385. depends on the platform.</p>
  29386. <p class=note>On Windows, the direction indicates the position of the caret relative to the
  29387. selection: a <i>forward</i> selection has the caret at the end of the selection and a
  29388. <i>backward</i> selection has the caret at the start of the selection. Windows has no <i>none</i>
  29389. direction. On Mac, the direction indicates which end of the selection is affected when the user
  29390. adjusts the size of the selection using the arrow keys with the Shift modifier: the forward
  29391. direction means the end of the selection is modified, and the backwards direction means the start
  29392. of the selection is modified. The none direction is the default on Mac, it indicates that no
  29393. particular direction has yet been selected. The user sets the direction implicitly when first
  29394. adjusting the selection, based on which directional arrow key was used.</p>
  29395. <p>The <dfn id=dom-textarea/input-select><code>select()</code></dfn> method must cause the
  29396. contents of the text field to be fully selected, with the selection direction being none, if the
  29397. platform support selections with the direction <i>none</i>, or otherwise <i>forward</i>. The user
  29398. 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
  29399. <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
  29400. source</a> as the task source.</p>
  29401. <p>The <dfn id=dom-textarea/input-selectionstart><code>selectionStart</code></dfn> attribute
  29402. must, on getting, return the offset (in logical order) to the character that immediately follows
  29403. the start of the selection. If there is no selection, then it must return the offset (in logical
  29404. order) to the character that immediately follows the text entry cursor.</p>
  29405. <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,
  29406. 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,
  29407. unless the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-4><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
  29408. is less than the new value, in which case the second argument must also be the new value; and the
  29409. current value of the <code id=textFieldSelection:dom-textarea/input-selectiondirection-3><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
  29410. as the third argument.</p>
  29411. <p>The <dfn id=dom-textarea/input-selectionend><code>selectionEnd</code></dfn> attribute
  29412. must, on getting, return the offset (in logical order) to the character that immediately follows
  29413. the end of the selection. If there is no selection, then it must return the offset (in logical
  29414. order) to the character that immediately follows the text entry cursor.</p>
  29415. <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,
  29416. 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,
  29417. 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>
  29418. <p>The <dfn id=dom-textarea/input-selectiondirection><code>selectionDirection</code></dfn>
  29419. attribute must, on getting, return the string corresponding to the current selection direction: if
  29420. the direction is <i>forward</i>, "<code>forward</code>"; if the direction is
  29421. <i>backward</i>, "<code>backward</code>"; and otherwise, "<code>none</code>".</p>
  29422. <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,
  29423. 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,
  29424. the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-5><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
  29425. attribute as the second argument, and the new value as the third argument.</p>
  29426. <p>The <dfn id=dom-textarea/input-setselectionrange><code>setSelectionRange(<var>start</var>, <var>end</var>, <var>direction</var>)</code></dfn> method
  29427. must set the selection of the text field to the sequence of characters starting with the character
  29428. at the <var>start</var>th position (in logical order) and ending with the character at
  29429. the <span>(<var>end</var>-1)</span>th position. Arguments greater than the
  29430. length of the value of the text field must be treated as pointing at the end of the text field. If
  29431. <var>end</var> is less than or equal to <var>start</var> then the start of the
  29432. selection and the end of the selection must both be placed immediately before the character with
  29433. offset <var>end</var>. In UAs where there is no concept of an empty selection, this must
  29434. set the cursor to be just before the character with offset <var>end</var>. The direction
  29435. of the selection must be set to <i>backward</i> if <var>direction</var> is a
  29436. <a href=#case-sensitive id=textFieldSelection:case-sensitive>case-sensitive</a> match for the string "<code>backward</code>", <i>forward</i>
  29437. 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
  29438. <i>none</i>, and <i>none</i> otherwise (including if the argument is omitted). The user agent must
  29439. 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
  29440. source</a> as the task source.</p>
  29441. <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>
  29442. <ol><li>
  29443. <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>
  29444. <p>Otherwise, let <var>start</var>, <var>end</var> have the values of the
  29445. second and third arguments respectively.</p>
  29446. <li><p>If <var>start</var> is greater than <var>end</var>, then throw an
  29447. <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,
  29448. 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,
  29449. 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
  29450. characters starting with the character at the <var>start</var>th position (in logical
  29451. order) and ending with the character at the <span>(<var>end</var>-1)</span>th
  29452. position.<li><p>Insert the value of the first argument into the text of the value of the text field,
  29453. 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>
  29454. <p>Run the appropriate set of substeps from the following list:</p>
  29455. <dl class=switch><dt>If the fourth argument's value is "<dfn id=dom-selectionmode-select><code>select</code></dfn>"<dd>
  29456. <p>Let <var>selection start</var> be <var>start</var>.</p>
  29457. <p>Let <var>selection end</var> be <var>new end</var>.</p>
  29458. <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-start><code>start</code></dfn>"<dd>
  29459. <p>Let <var>selection start</var> and <var>selection end</var> be <var>start</var>.</p>
  29460. <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-end><code>end</code></dfn>"<dd>
  29461. <p>Let <var>selection start</var> and <var>selection end</var> be <var>new end</var>.</p>
  29462. <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-preserve><code>preserve</code></dfn>" (the default)<dd>
  29463. <ol><li><p>Let <var>old length</var> be <var>end</var> minus <var>start</var>.</p>
  29464. <li><p>Let <var>delta</var> be <var>new length</var> minus <var>old length</var>.</p>
  29465. <li>
  29466. <p>If <var>selection start</var> is greater than <var>end</var>, then
  29467. increment it by <var>delta</var>. (If <var>delta</var> is negative, i.e.
  29468. the new text is shorter than the old text, then this will <em>decrease</em> the value of
  29469. <var>selection start</var>.)</p>
  29470. <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
  29471. selection to the start of the new text if it was in the middle of the text that it
  29472. replaced.)</p>
  29473. <li>
  29474. <p>If <var>selection end</var> is greater than <var>end</var>, then
  29475. increment it by <var>delta</var> in the same way.</p>
  29476. <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
  29477. selection to the end of the new text if it was in the middle of the text that it
  29478. replaced.)</p>
  29479. </ol>
  29480. </dl>
  29481. <li>
  29482. <p>Set the selection of the text field to the sequence of characters starting with the character
  29483. at the <var>selection start</var>th position (in logical order) and ending with the
  29484. character at the <span>(<var>selection end</var>-1)</span>th position. In UAs
  29485. where there is no concept of an empty selection, this must set the cursor to be just before the
  29486. character with offset <var>end</var>. The direction of the selection must be set to
  29487. <i>forward</i> if the platform does not support selections with the direction <i>none</i>, and
  29488. <i>none</i> otherwise.</p>
  29489. <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
  29490. source</a> as the task source.</ol>
  29491. <p>All elements to which this API <a href=#concept-input-apply id=textFieldSelection:concept-input-apply>applies</a> have either a
  29492. 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
  29493. rendered</a>). User agents should follow platform conventions to determine their initial
  29494. state.</p>
  29495. <p>Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as
  29496. characters. Thus, for instance, the selection can include just an invisible character, and the
  29497. text insertion cursor can be placed to one side or another of such a character.</p>
  29498. <div class=example>
  29499. <p>To obtain the currently selected text, the following JavaScript suffices:</p>
  29500. <pre>var selectionText = control.value.substring(control.selectionStart, control.selectionEnd);</pre>
  29501. <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>
  29502. element.</p>
  29503. </div>
  29504. <div class=example>
  29505. <p>To add some text at the start of a text control, while maintaining the text selection, the
  29506. three attributes must be preserved:</p>
  29507. <pre>var oldStart = control.selectionStart;
  29508. var oldEnd = control.selectionEnd;
  29509. var oldDirection = control.selectionDirection;
  29510. var prefix = "http://";
  29511. control.value = prefix + control.value;
  29512. control.setSelectionRange(oldStart + prefix.length, oldEnd + prefix.length, oldDirection);</pre>
  29513. <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>
  29514. element.</p>
  29515. </div>
  29516. <h4 id=constraints>4.10.21 Constraints</h4>
  29517. <h5 id=definitions>4.10.21.1 Definitions</h5>
  29518. <p>A <a href=#category-submit id=definitions:category-submit>submittable element</a> is a <dfn id=candidate-for-constraint-validation>candidate for constraint
  29519. validation</dfn> except when a condition has <dfn id=barred-from-constraint-validation>barred
  29520. 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
  29521. constraint validation</a> if it is an <code id=definitions:the-object-element><a href=#the-object-element>object</a></code> element.)</p>
  29522. <p>An element can have a <dfn id=custom-validity-error-message>custom validity error message</dfn> defined. Initially, an element
  29523. 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
  29524. 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
  29525. using the <code id=definitions:dom-cva-setcustomvalidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method. The user
  29526. 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
  29527. problem with the control.</p>
  29528. <p>An element can be constrained in various ways. The following is the list of <dfn id=validity-states>validity
  29529. states</dfn> that a form control can be in, making the control invalid for the purposes of
  29530. constraint validation. (The definitions below are non-normative; other parts of this specification
  29531. define more precisely when each state applies or does not.)</p>
  29532. <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
  29533. <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>
  29534. 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>).
  29535. <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
  29536. <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
  29537. <a href=#attr-fe-maxlength id=definitions:attr-fe-maxlength>form control <code>maxlength</code> attribute</a>
  29538. (<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>
  29539. <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
  29540. <a href=#attr-fe-minlength id=definitions:attr-fe-minlength>form control <code>minlength</code> attribute</a>
  29541. (<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>
  29542. <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
  29543. <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
  29544. <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
  29545. 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
  29546. 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
  29547. <code id=definitions:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method) is not the empty
  29548. string.</p> </dl>
  29549. <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
  29550. if validating the form during submission wouldn't indicate a problem to the user.</p>
  29551. <p>An element <dfn id=concept-fv-valid>satisfies its constraints</dfn> if it is not suffering
  29552. from any of the above <a href=#validity-states id=definitions:validity-states>validity states</a>.</p>
  29553. <h5 id=constraint-validation>4.10.21.2 Constraint validation</h5>
  29554. <p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the constraints</dfn> of
  29555. <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
  29556. either a <i>positive</i> result (all the controls in the form are valid) or a <i>negative</i>
  29557. result (there are invalid controls) along with a (possibly empty) list of elements that are
  29558. invalid and for which no script has claimed responsibility:</p>
  29559. <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>
  29560. <p>For each element <var>field</var> in <var>controls</var>, in <a href=#tree-order id=constraint-validation:tree-order-2>tree
  29561. order</a>, run the following substeps:</p>
  29562. <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>,
  29563. 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
  29564. constraints</a>, then move on to the next element.<li><p>Otherwise, add <var>field</var> to <var>invalid
  29565. controls</var>.</ol>
  29566. <li><p>If <var>invalid controls</var> is empty, then return a <i>positive</i> result and
  29567. abort these steps.<li><p>Let <var>unhandled invalid controls</var> be an initially empty list of
  29568. elements.<li>
  29569. <p>For each element <var>field</var> in <var>invalid controls</var>, if any,
  29570. in <a href=#tree-order id=constraint-validation:tree-order-3>tree order</a>, run the following substeps:</p>
  29571. <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
  29572. 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>
  29573. <li><p>Return a <i>negative</i> result with the list of elements in the <var>unhandled
  29574. invalid controls</var> list.</ol>
  29575. <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>
  29576. element <var>form</var>, then the user agent must run the following steps:</p>
  29577. <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
  29578. <var>unhandled invalid controls</var> be the list of elements returned if the result was
  29579. <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
  29580. <var>unhandled invalid controls</var> to the user. User agents may focus one of those elements in
  29581. the process, by running the <a href=#focusing-steps id=constraint-validation:focusing-steps>focusing steps</a> for that element, and may change the
  29582. scrolling position of the document, or perform some other action that brings the element to the
  29583. user's attention. User agents may report more than one constraint violation. User agents may
  29584. coalesce related constraint violation reports if appropriate (e.g. if multiple radio buttons in a
  29585. <a href=#radio-button-group id=constraint-validation:radio-button-group>group</a> are marked as required, only one error need be
  29586. 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
  29587. error.<li><p>Return a <i>negative</i> result.</ol>
  29588. <h5 id=the-constraint-validation-api>4.10.21.3 The <dfn>constraint validation API</dfn></h5>
  29589. <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>
  29590. <p>Returns true if the element will be validated when the form is submitted; false
  29591. otherwise.</p>
  29592. <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>
  29593. <p>Sets a custom error, so that the element would fail to validate. The given message is the
  29594. message to be shown to the user when reporting the problem to the user.</p>
  29595. <p>If the argument is the empty string, clears the custom error.</p>
  29596. <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>
  29597. <p>Returns true if the element has no value but is a required field; false otherwise.</p>
  29598. <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>
  29599. <p>Returns true if the element's value is not in the correct syntax; false otherwise.</p>
  29600. <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>
  29601. <p>Returns true if the element's value doesn't match the provided pattern; false otherwise.</p>
  29602. <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>
  29603. <p>Returns true if the element's value is longer than the provided maximum length; false otherwise.</p>
  29604. <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>
  29605. <p>Returns true if the element's value, if it is not the empty string, is shorter than the
  29606. provided minimum length; false otherwise.</p>
  29607. <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>
  29608. <p>Returns true if the element's value is lower than the provided minimum; false otherwise.</p>
  29609. <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>
  29610. <p>Returns true if the element's value is higher than the provided maximum; false otherwise.</p>
  29611. <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>
  29612. <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>
  29613. <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>
  29614. <p>Returns true if the user has provided input in the user interface that the user agent is
  29615. unable to convert to a value; false otherwise.</p>
  29616. <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>
  29617. <p>Returns true if the element has a custom error; false otherwise.</p>
  29618. <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>
  29619. <p>Returns true if the element's value has no validity problems; false otherwise.</p>
  29620. <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>
  29621. <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>
  29622. <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>
  29623. <p>Returns true if the element's value has no validity problems; otherwise, returns false, fires
  29624. 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
  29625. canceled) reports the problem to the user.</p>
  29626. <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validationmessage><a href=#dom-cva-validationmessage>validationMessage</a></code><dd>
  29627. <p>Returns the error message that would be shown to the user if the element was to be checked
  29628. for validity.</p>
  29629. </dl>
  29630. <p>The <dfn id=dom-cva-willvalidate><code>willValidate</code></dfn> attribute must return
  29631. 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
  29632. (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
  29633. constraint validation</a>).</p>
  29634. <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
  29635. message</a> to the value of the given <var>message</var> argument.</p>
  29636. <div class=example>
  29637. <p>In the following example, a script checks the value of a form control each time it is edited,
  29638. 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
  29639. message.</p>
  29640. <pre>&lt;label>Feeling: &lt;input name=f type="text" oninput="check(this)">&lt;/label>
  29641. &lt;script>
  29642. function check(input) {
  29643. if (input.value == "good" ||
  29644. input.value == "fine" ||
  29645. input.value == "tired") {
  29646. input.setCustomValidity('"' + input.value + '" is not a feeling.');
  29647. } else {
  29648. // input is fine -- reset the error message
  29649. input.setCustomValidity('');
  29650. }
  29651. }
  29652. &lt;/script></pre>
  29653. </div>
  29654. <p>The <dfn id=dom-cva-validity><code>validity</code></dfn> attribute must return a
  29655. <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.
  29656. 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
  29657. <code id=the-constraint-validation-api:dom-cva-validity-12><a href=#dom-cva-validity>validity</a></code> attribute is retrieved.</p>
  29658. <pre class=idl>interface <dfn id=validitystate>ValidityState</dfn> {
  29659. readonly attribute boolean <a href=#dom-validitystate-valuemissing id=the-constraint-validation-api:dom-validitystate-valuemissing-2>valueMissing</a>;
  29660. readonly attribute boolean <a href=#dom-validitystate-typemismatch id=the-constraint-validation-api:dom-validitystate-typemismatch-2>typeMismatch</a>;
  29661. readonly attribute boolean <a href=#dom-validitystate-patternmismatch id=the-constraint-validation-api:dom-validitystate-patternmismatch-2>patternMismatch</a>;
  29662. readonly attribute boolean <a href=#dom-validitystate-toolong id=the-constraint-validation-api:dom-validitystate-toolong-2>tooLong</a>;
  29663. readonly attribute boolean <a href=#dom-validitystate-tooshort id=the-constraint-validation-api:dom-validitystate-tooshort-2>tooShort</a>;
  29664. readonly attribute boolean <a href=#dom-validitystate-rangeunderflow id=the-constraint-validation-api:dom-validitystate-rangeunderflow-2>rangeUnderflow</a>;
  29665. readonly attribute boolean <a href=#dom-validitystate-rangeoverflow id=the-constraint-validation-api:dom-validitystate-rangeoverflow-2>rangeOverflow</a>;
  29666. readonly attribute boolean <a href=#dom-validitystate-stepmismatch id=the-constraint-validation-api:dom-validitystate-stepmismatch-2>stepMismatch</a>;
  29667. readonly attribute boolean <a href=#dom-validitystate-badinput id=the-constraint-validation-api:dom-validitystate-badinput-2>badInput</a>;
  29668. readonly attribute boolean <a href=#dom-validitystate-customerror id=the-constraint-validation-api:dom-validitystate-customerror-2>customError</a>;
  29669. readonly attribute boolean <a href=#dom-validitystate-valid id=the-constraint-validation-api:dom-validitystate-valid-2>valid</a>;
  29670. };</pre>
  29671. <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
  29672. true if the corresponding condition given in the following list is true, and false otherwise.</p>
  29673. <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>
  29674. <p>When the <dfn id=dom-cva-checkvalidity><code>checkValidity()</code></dfn> method is
  29675. 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
  29676. 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
  29677. has no default action) at the element and return false. Otherwise, it must only return true
  29678. without doing anything else.</p>
  29679. <p>When the <dfn id=dom-cva-reportvalidity><code>reportValidity()</code></dfn> method is
  29680. 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
  29681. 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,
  29682. and if that event is not canceled, report the problems with the constraints of that element to the
  29683. user; then, return false. Otherwise, it must only return true without doing anything else. When
  29684. 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
  29685. steps</a> for that element, and may change the scrolling position of the document, or perform
  29686. some other action that brings the element to the user's attention. User agents may report more
  29687. than one constraint violation, if the element suffers from multiple problems at once. If the
  29688. 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
  29689. user, report a script error.</p>
  29690. <p>The <dfn id=dom-cva-validationmessage><code>validationMessage</code></dfn> attribute must
  29691. 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>
  29692. 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,
  29693. it must return a suitably localised message that the user agent would show the user if this were
  29694. the only form control with a validity constraint problem. If the user agent would not actually
  29695. show a textual message in such a situation (e.g. it would show a graphical cue instead), then the
  29696. attribute must return a suitably localised message that expresses (one or more of) the validity
  29697. 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
  29698. 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
  29699. <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>
  29700. <h5 id=security-forms>4.10.21.4 Security</h5>
  29701. <p id=security-0>Servers should not rely on client-side validation. Client-side validation can
  29702. be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user
  29703. agents or automated tools that do not implement these features. The constraint validation features
  29704. are only intended to improve the user experience, not to provide any kind of security
  29705. mechanism.</p>
  29706. <h4 id=form-submission-2>4.10.22 <dfn>Form submission</dfn></h4>
  29707. <h5 id=introduction-6>4.10.22.1 Introduction</h5>
  29708. <p><i>This section is non-normative.</i></p>
  29709. <p>When a form is submitted, the data in the form is converted into the structure specified by the
  29710. <a href=#concept-fs-enctype id=introduction-6:concept-fs-enctype>enctype</a>, and then sent to the destination specified by the
  29711. <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>
  29712. <p>For example, take the following form:</p>
  29713. <pre>&lt;form action="/find.cgi" method=get>
  29714. &lt;input type=text name=t>
  29715. &lt;input type=search name=q>
  29716. &lt;input type=submit>
  29717. &lt;/form></pre>
  29718. <p>If the user types in "cats" in the first field and "fur" in the second, and then hits the
  29719. submit button, then the user agent will load <code>/find.cgi?t=cats&amp;q=fur</code>.</p>
  29720. <p>On the other hand, consider this form:</p>
  29721. <pre>&lt;form action="/find.cgi" method=post enctype="multipart/form-data">
  29722. &lt;input type=text name=t>
  29723. &lt;input type=search name=q>
  29724. &lt;input type=submit>
  29725. &lt;/form></pre>
  29726. <p>Given the same user input, the result on submission is quite different: the user agent instead
  29727. does an HTTP POST to the given URL, with as the entity body something like the following text:</p>
  29728. <pre>------kYFrd4jNJEgCervE
  29729. Content-Disposition: form-data; name="t"
  29730. cats
  29731. ------kYFrd4jNJEgCervE
  29732. Content-Disposition: form-data; name="q"
  29733. fur
  29734. ------kYFrd4jNJEgCervE--</pre>
  29735. <h5 id=implicit-submission>4.10.22.2 Implicit submission</h5>
  29736. <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
  29737. owner</a> is that <code id=implicit-submission:the-form-element-2><a href=#the-form-element>form</a></code> element.</p>
  29738. <p>If the user agent supports letting the user submit a form implicitly (for example, on some
  29739. platforms hitting the "enter" key while a text field is <a href=#focused id=implicit-submission:focused>focused</a> implicitly submits the form), then
  29740. 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
  29741. 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
  29742. that <a href=#default-button id=implicit-submission:default-button-2>default button</a>.</p>
  29743. <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
  29744. submission mechanism is used. (A button has no <a href=#activation-behavior id=implicit-submission:activation-behavior-2>activation behavior</a> when
  29745. disabled.)</p>
  29746. <p class=note>There are pages on the Web that are only usable if there is a way to implicitly
  29747. submit forms, so user agents are strongly encouraged to support this.</p>
  29748. <p>If the form has
  29749. no <a href=#concept-submit-button id=implicit-submission:concept-submit-button-2>submit button</a>, then the implicit submission
  29750. mechanism must do nothing if the form has more than one <i>field that blocks implicit
  29751. 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>
  29752. element from the <code id=implicit-submission:the-form-element-4><a href=#the-form-element>form</a></code> element itself otherwise.</p>
  29753. <p>For the purpose of the previous paragraph, an element is a <i>field that blocks implicit
  29754. 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
  29755. <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:
  29756. <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>,
  29757. <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>,
  29758. <a href="#url-state-(type=url)" id="implicit-submission:url-state-(type=url)">URL</a>,
  29759. <a href="#telephone-state-(type=tel)" id="implicit-submission:telephone-state-(type=tel)">Telephone</a>,
  29760. <a href="#e-mail-state-(type=email)" id="implicit-submission:e-mail-state-(type=email)">E-mail</a>,
  29761. <a href="#password-state-(type=password)" id="implicit-submission:password-state-(type=password)">Password</a>,
  29762. <a href="#date-and-time-state-(type=datetime)" id="implicit-submission:date-and-time-state-(type=datetime)">Date and Time</a>,
  29763. <a href="#date-state-(type=date)" id="implicit-submission:date-state-(type=date)">Date</a>,
  29764. <a href="#month-state-(type=month)" id="implicit-submission:month-state-(type=month)">Month</a>,
  29765. <a href="#week-state-(type=week)" id="implicit-submission:week-state-(type=week)">Week</a>,
  29766. <a href="#time-state-(type=time)" id="implicit-submission:time-state-(type=time)">Time</a>,
  29767. <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>,
  29768. <a href="#number-state-(type=number)" id="implicit-submission:number-state-(type=number)">Number</a>
  29769. </p>
  29770. <h5 id=form-submission-algorithm>4.10.22.3 Form submission algorithm</h5>
  29771. <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>
  29772. (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
  29773. following steps:</p>
  29774. <ol><li><p>Let <var>form document</var> be the <var>form</var>'s
  29775. <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
  29776. <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
  29777. <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
  29778. 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>
  29779. 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
  29780. validate the constraints</a> of <var>form</var> and examine the result: if the result
  29781. is negative (the constraint validation concluded that there were invalid fields and probably
  29782. 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
  29783. 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>
  29784. 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
  29785. cancelable named <code id=form-submission-algorithm:event-submit><a href=#event-submit>submit</a></code>, at <var>form</var>. If the
  29786. event's default action is prevented (i.e. if the event is canceled) then abort these steps.
  29787. 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
  29788. 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>
  29789. <p>If <var>action</var> is the empty string, let <var>action</var> be
  29790. <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>
  29791. <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,
  29792. 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
  29793. 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
  29794. 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
  29795. form, then let <var>target browsing context</var> be that <a href=#browsing-context id=form-submission-algorithm:browsing-context-4>browsing context</a>.
  29796. 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
  29797. name</a> using <var>target</var> as the name and <var>form browsing
  29798. context</var> as the context in which the algorithm is executed, and let <var>target
  29799. 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,
  29800. alternatively, if the <var>form document</var> has not yet <a href=#completely-loaded id=form-submission-algorithm:completely-loaded>completely
  29801. loaded</a> and the <var>submitted from <code id=form-submission-algorithm:dom-form-submit-4><a href=#dom-form-submit>submit()</a></code>
  29802. method</var> flag is set, then let <var>replace</var> be true. Otherwise, let it be
  29803. false.<li>
  29804. <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
  29805. dialog</a> steps.</p>
  29806. <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
  29807. on that row based on the value of <var>method</var> as given in the first cell of each
  29808. column. Then, jump to the steps named in that cell and defined below the table.</p>
  29809. <table><thead><tr><td>
  29810. <th> <a href=#attr-fs-method-get id=form-submission-algorithm:attr-fs-method-get>GET</a>
  29811. <th> <a href=#attr-fs-method-post id=form-submission-algorithm:attr-fs-method-post>POST</a>
  29812. <tbody><tr><th> <code>http</code>
  29813. <td> <a href=#submit-mutate-action id=form-submission-algorithm:submit-mutate-action>Mutate action URL</a>
  29814. <td> <a href=#submit-body id=form-submission-algorithm:submit-body>Submit as entity body</a>
  29815. <tr><th> <code>https</code>
  29816. <td> <a href=#submit-mutate-action id=form-submission-algorithm:submit-mutate-action-2>Mutate action URL</a>
  29817. <td> <a href=#submit-body id=form-submission-algorithm:submit-body-2>Submit as entity body</a>
  29818. <tr><th> <code>ftp</code>
  29819. <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action>Get action URL</a>
  29820. <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-2>Get action URL</a>
  29821. <tr><th> <code>javascript</code>
  29822. <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-3>Get action URL</a>
  29823. <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-4>Get action URL</a>
  29824. <tr><th> <code>data</code>
  29825. <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-5>Get action URL</a>
  29826. <td> <a href=#submit-data-post id=form-submission-algorithm:submit-data-post>Post to data:</a>
  29827. <tr><th> <code>mailto</code>
  29828. <td> <a href=#submit-mailto-headers id=form-submission-algorithm:submit-mailto-headers>Mail with headers</a>
  29829. <td> <a href=#submit-mailto-body id=form-submission-algorithm:submit-mailto-body>Mail as body</a>
  29830. </table>
  29831. <p>If <var>scheme</var> is not one of those listed in this table, then the behavior is
  29832. not defined by this specification. User agents should, in the absence of another specification
  29833. defining this, act in a manner analogous to that defined in this specification for similar
  29834. schemes.</p>
  29835. <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
  29836. <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
  29837. <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
  29838. 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>
  29839. <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
  29840. its <a href=#task-queue id=form-submission-algorithm:task-queue>task queue</a>.<li>
  29841. <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>
  29842. <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
  29843. the particular resource <var>destination</var>. If <var>replace</var> is
  29844. true, then <var>target browsing context</var> must be navigated with
  29845. <a href=#replacement-enabled id=form-submission-algorithm:replacement-enabled>replacement enabled</a>.</p>
  29846. </ol>
  29847. <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
  29848. 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>
  29849. was <a href=#queue-a-task id=form-submission-algorithm:queue-a-task>queued</a>.</p>
  29850. <li>
  29851. <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
  29852. <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-6>planned navigation</a>.</p>
  29853. <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
  29854. source</a>.</p>
  29855. </ol>
  29856. <p>The behaviors are as follows:</p>
  29857. <dl><dt><dfn id=submit-mutate-action>Mutate action URL</dfn>
  29858. <dd>
  29859. <p>Let <var>query</var> be the result of encoding the <var>form data
  29860. 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
  29861. algorithm</a>, interpreted as a US-ASCII string.</p>
  29862. <p>Set <var>parsed action</var>'s <a href=#concept-url-query id=form-submission-algorithm:concept-url-query>query</a>
  29863. component to <var>query</var>.</p>
  29864. <p>Let <var>destination</var> be a new <a href=#url id=form-submission-algorithm:url-2>URL</a> formed by applying the
  29865. <a href=#concept-url-serialiser id=form-submission-algorithm:concept-url-serialiser>URL serialiser</a> algorithm to <var>parsed action</var>.</p>
  29866. <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate>Plan to navigate</a> to <var>destination</var>.</p>
  29867. <dt><dfn id=submit-body>Submit as entity body</dfn>
  29868. <dd>
  29869. <p>Let <var>entity body</var> be the result of encoding the <var>form data
  29870. set</var> using the <a href=#appropriate-form-encoding-algorithm id=form-submission-algorithm:appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a>.</p>
  29871. <p>Let <var>MIME type</var> be determined as follows:</p>
  29872. <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
  29873. 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
  29874. 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>
  29875. <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
  29876. method given by <var>method</var> and with <var>entity body</var> as the
  29877. entity body, of type <var>MIME type</var>.</p>
  29878. <dt><dfn id=submit-get-action>Get action URL</dfn>
  29879. <dd>
  29880. <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-3>Plan to navigate</a> to <var>action</var>.</p>
  29881. <p class=note>The <var>form data set</var> is discarded.</p>
  29882. <dt><dfn id=submit-data-post>Post to data:</dfn>
  29883. <dd>
  29884. <p>Let <var>data</var> be the result of encoding the <var>form data
  29885. 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>
  29886. <p>If <var>action</var> contains the string "<code>%%%%</code>" (four U+0025
  29887. 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
  29888. <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,
  29889. <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
  29890. 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>
  29891. <p>Otherwise, if <var>action</var> contains the string "<code>%%</code>"
  29892. (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
  29893. encode</a> all characters in <var>data</var> that, if interpreted as US-ASCII, are
  29894. 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
  29895. 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>
  29896. <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
  29897. 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>
  29898. <dt><dfn id=submit-mailto-headers>Mail with headers</dfn>
  29899. <dd>
  29900. <p>Let <var>headers</var> be the resulting encoding the <var>form data
  29901. 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
  29902. algorithm</a>, interpreted as a US-ASCII string.</p>
  29903. <p>Replace occurrences of U+002B PLUS SIGN characters (+) in <var>headers</var> with
  29904. the string "<code>%20</code>".</p>
  29905. <p>Let <var>destination</var> consist of all the characters from the first character
  29906. in <var>action</var> to the character immediately before the first U+003F QUESTION
  29907. MARK character (?), if any, or the end of the string if there are none.</p>
  29908. <p>Append a single U+003F QUESTION MARK character (?) to <var>destination</var>.</p>
  29909. <p>Append <var>headers</var> to <var>destination</var>.</p>
  29910. <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-5>Plan to navigate</a> to <var>destination</var>.</p>
  29911. <dt><dfn id=submit-mailto-body>Mail as body</dfn>
  29912. <dd>
  29913. <p>Let <var>body</var> be the resulting of encoding the <var>form data
  29914. 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
  29915. 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
  29916. set</a>. <a href=#refsURL>[URL]</a></p>
  29917. <p>Let <var>destination</var> have the same value as <var>action</var>.</p>
  29918. <p>If <var>destination</var> does not contain a U+003F QUESTION MARK character (?),
  29919. append a single U+003F QUESTION MARK character (?) to <var>destination</var>.
  29920. Otherwise, append a single U+0026 AMPERSAND character (&amp;).</p>
  29921. <p>Append the string "<code>body=</code>" to <var>destination</var>.</p>
  29922. <p>Append <var>body</var>, interpreted as a US-ASCII string, to <var>destination</var>.</p>
  29923. <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-6>Plan to navigate</a> to <var>destination</var>.</p>
  29924. <dt><dfn id=submit-dialog>Submit dialog</dfn>
  29925. <dd>
  29926. <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>
  29927. <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>
  29928. attribute, do nothing. Otherwise, proceed as follows:</p>
  29929. <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>
  29930. 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
  29931. U+002C COMMA character (,), and the <a href=#concept-input-type-image-coordinate id=form-submission-algorithm:concept-input-type-image-coordinate-2>selected
  29932. coordinate</a>'s <var>y</var>-component, expressed in the same way as the <var>x</var>-component.</p>
  29933. <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>
  29934. <p>Otherwise, there is no <var>result</var>.</p>
  29935. <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>
  29936. </dl>
  29937. <p>The <dfn id=appropriate-form-encoding-algorithm>appropriate form encoding algorithm</dfn> is
  29938. determined as follows:</p>
  29939. <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
  29940. 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>
  29941. </ol>
  29942. <h5 id=constructing-form-data-set>4.10.22.4 Constructing the form data set</h5>
  29943. <p>The algorithm to <dfn id=constructing-the-form-data-set>construct the form data set</dfn>
  29944. 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>
  29945. is null.</p>
  29946. <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
  29947. empty.<li>
  29948. <p><i>Loop</i>: For each element <var>field</var> in <var>controls</var>, in
  29949. <a href=#tree-order id=constructing-form-data-set:tree-order-2>tree order</a>, run the following substeps:</p>
  29950. <ol><li>
  29951. <p>If any of the following conditions are met, then skip these substeps for this element:</p>
  29952. <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
  29953. 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
  29954. 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
  29955. 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
  29956. a <a href=#plugin id=constructing-form-data-set:plugin>plugin</a>.</ul>
  29957. <p>Otherwise, process <var>field</var> as follows:</p>
  29958. <li><p>Let <var>type</var> be the value of the <code>type</code> IDL
  29959. attribute of <var>field</var>.<li>
  29960. <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
  29961. substeps:</p>
  29962. <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>
  29963. attribute specified and its value is not the empty string, let <var>name</var> be
  29964. 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
  29965. concatenation of <var>name</var> and a single U+0078 LATIN SMALL LETTER X character
  29966. (x).<li><p>Let <var>name<sub>y</sub></var> be the string consisting of the
  29967. concatenation of <var>name</var> and a single U+0079 LATIN SMALL LETTER Y character
  29968. (y).<li><p>The <var>field</var> element is <var>submitter</var>, and before
  29969. 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
  29970. user, and let <var>y</var> be the <var>y</var>-component of the coordinate
  29971. 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
  29972. <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
  29973. <i>end</i> step below.</ol>
  29974. <li><p>Let <var>name</var> be the value of the <var>field</var> element's
  29975. <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
  29976. <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
  29977. 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
  29978. <var>type</var> as the type.<li>
  29979. <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
  29980. <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
  29981. substeps:</p>
  29982. <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>
  29983. 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>
  29984. as the name, <var>value</var> as the value, and <var>type</var> as the
  29985. type.</ol>
  29986. <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
  29987. 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,
  29988. append an entry to the <var>form data set</var> with the <var>name</var> as
  29989. 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
  29990. <var>form data set</var> with the <var>name</var> as the name, the empty
  29991. 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:
  29992. 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,
  29993. append an entry to the <var>form data set</var> with <var>name</var> as the
  29994. 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>
  29995. <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
  29996. attribute's value is not the empty string, then run these substeps:</p>
  29997. <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
  29998. 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
  29999. '<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
  30000. "<code>direction</code>" as the type.</ol>
  30001. <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>
  30002. 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
  30003. <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>
  30004. </ol>
  30005. <li>
  30006. <p><i>End</i>: For the name of each entry in the <var>form data set</var>, and for the
  30007. 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
  30008. CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character, and every
  30009. occurrence of a U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR)
  30010. character, by a two-character string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED
  30011. (CRLF) character pair.</p>
  30012. <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
  30013. <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
  30014. 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
  30015. control's <a href=#concept-fe-value id=constructing-form-data-set:concept-fe-value-3>value</a> (which also performs any necessary line
  30016. 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>
  30017. 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
  30018. normalized.</p>
  30019. <li><p>Return the <var>form data set</var>.</ol>
  30020. <h5 id=selecting-a-form-submission-encoding>4.10.22.5 Selecting a form submission encoding</h5>
  30021. <p>If the user agent is to <dfn id=picking-an-encoding-for-the-form>pick an encoding for a
  30022. form</dfn>, optionally with an <i>allow non-ASCII-compatible encodings</i> flag set, it must run
  30023. the following substeps:</p>
  30024. <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
  30025. 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
  30026. encoding</a> for the token and, if this does not result in failure, append the
  30027. <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
  30028. that are not <a href=#ascii-compatible-character-encoding id=selecting-a-form-submission-encoding:ascii-compatible-character-encoding>ASCII-compatible character
  30029. encodings</a> from <var>candidate encodings</var>.<li><p>If <var>candidate encodings</var> is empty, return UTF-8 and abort these
  30030. steps.<li>
  30031. <p>Each character encoding in <var>candidate encodings</var> can represent a finite
  30032. number of characters. (For example, UTF-8 can represent all 1.1 million or so Unicode code
  30033. points, while Windows-1252 can only represent 256.)</p>
  30034. <p>For each encoding in <var>candidate encodings</var>, determine how many of the
  30035. characters in the names and values of the entries in the <var>form data set</var> the
  30036. encoding can represent (without ignoring duplicates). Let <var>max</var> be the
  30037. highest such count. (For UTF-8, <var>max</var> would equal the number of characters
  30038. in the names and values of the entries in the <var>form data set</var>.)</p>
  30039. <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
  30040. data set</var>.</p>
  30041. </ol>
  30042. <h5 id=url-encoded-form-data>4.10.22.6 URL-encoded form data</h5>
  30043. <p class=note>This form data set encoding is in many ways an aberrant monstrosity, the result of
  30044. many years of implementation accidents and compromises leading to a set of requirements necessary
  30045. for interoperability, but in no way representing good design practices. In particular, readers are
  30046. cautioned to pay close attention to the twisted details involving repeated (and in some cases
  30047. nested) conversions between character encodings and byte sequences.</p>
  30048. <p>The <dfn id=application/x-www-form-urlencoded-encoding-algorithm><code>application/x-www-form-urlencoded</code> encoding algorithm</dfn> is as
  30049. follows:</p>
  30050. <ol><li><p>Let <var>result</var> be the empty string.<li>
  30051. <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
  30052. 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>
  30053. <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
  30054. 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
  30055. the selected character encoding.</p>
  30056. <p>Otherwise, let the selected character encoding be UTF-8.</p>
  30057. <li><p>Let <var>charset</var> be the <a href=#encoding-name id=url-encoded-form-data:encoding-name>name</a> of the
  30058. selected <a href=#encoding id=url-encoded-form-data:encoding>character encoding</a>.<li>
  30059. <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
  30060. <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
  30061. 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
  30062. name only.<li><p>For each character in the entry's name and value that cannot be expressed using the
  30063. selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND
  30064. character (&amp;), a U+0023 NUMBER SIGN character (#), one or more <a href=#ascii-digits id=url-encoded-form-data:ascii-digits>ASCII digits</a>
  30065. representing the Unicode code point of the character in base ten, and finally a U+003B
  30066. SEMICOLON character (;).<li>
  30067. <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
  30068. encoding. The entry's name and value are now byte strings.</p>
  30069. <li>
  30070. <p>For each byte in the entry's name and value, apply the appropriate subsubsteps from the
  30071. following list:</p>
  30072. <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
  30073. as ASCII).<dt>If the byte is in the range 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to
  30074. 0x7A<dd><p>Leave the byte as is.<dt>Otherwise<dd>
  30075. <ol><li><p>Let <var>s</var> be a string consisting of a U+0025 PERCENT SIGN character
  30076. (%) 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
  30077. 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
  30078. string.</p>
  30079. <li><p>Replace the byte in question in the name or value being processed by the bytes in
  30080. <var>s</var>, preserving their relative order.</ol>
  30081. </dl>
  30082. <li>
  30083. <p>Interpret the entry's name and value as Unicode strings encoded in US-ASCII. (All of the
  30084. bytes in the string will be in the range 0x00 to 0x7F; the high bit will be zero throughout.)
  30085. The entry's name and value are now Unicode strings again.</p>
  30086. <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
  30087. "<code>text</code>", and this is the first entry in the <var>form data
  30088. set</var>, then append the value to <var>result</var> and skip the rest of the
  30089. substeps for this entry, moving on to the next entry, if any, or the next step in the overall
  30090. algorithm otherwise.<li><p>If this is not the first entry, append a single U+0026 AMPERSAND character (&amp;) to
  30091. <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>
  30092. <li><p>Encode <var>result</var> as US-ASCII and return the resulting byte
  30093. stream.</ol>
  30094. <p>To <dfn id=application/x-www-form-urlencoded-decoding-algorithm>decode
  30095. <code>application/x-www-form-urlencoded</code> payloads</dfn>, the following algorithm should be
  30096. used. This algorithm uses as inputs the payload itself, <var>payload</var>, consisting of
  30097. a Unicode string using only characters in the range U+0000 to U+007F; a default character encoding
  30098. <var>encoding</var>; and optionally an <var>isindex</var> flag indicating that
  30099. 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
  30100. of name-value pairs. If the <var>isindex</var> flag is set and the first control really
  30101. 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
  30102. will have as its name the empty string.</p>
  30103. <p>Which default character encoding to use can only be determined on a case-by-case basis, but
  30104. generally the best character encoding to use as a default is the one that was used to encode the
  30105. page on which the form used to create the payload was itself found. In the absence of a better
  30106. default, UTF-8 is suggested.</p>
  30107. <p>The <var>isindex</var> flag is for legacy use only. Forms in conforming HTML documents
  30108. will not generate payloads that need to be decoded with this flag set.</p>
  30109. <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
  30110. characters (&amp;).<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
  30111. 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>
  30112. <p>For each string <var>string</var> in <var>strings</var>, run these
  30113. substeps:</p>
  30114. <ol><li>
  30115. <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
  30116. <var>value</var> be the substring from the first character, if any, after the first
  30117. U+003D EQUALS SIGN character (=) up to the end of <var>string</var>. If the first
  30118. U+003D EQUALS SIGN character (=) is the first character, then <var>name</var> will be
  30119. the empty string. If it is the last character, then <var>value</var> will be the
  30120. empty string.</p>
  30121. <p>Otherwise, <var>string</var> contains no U+003D EQUALS SIGN characters (=). Let
  30122. <var>name</var> have the value of <var>string</var> and let <var>value</var> be the empty string.</p>
  30123. <li>
  30124. <p>Replace any U+002B PLUS SIGN characters (+) in <var>name</var> and <var>value</var> with U+0020 SPACE characters.</p>
  30125. <li>
  30126. <p>Replace any escape in <var>name</var> and <var>value</var> with the
  30127. character represented by the escape. This replacement must not be recursive.</p>
  30128. <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
  30129. digits</a>.</p>
  30130. <p>The character represented by an escape is the Unicode character whose code point is equal
  30131. to the value of the two characters after the U+0025 PERCENT SIGN character (%), interpreted as
  30132. a hexadecimal number (in the range 0..255).</p>
  30133. <p class=example>So for instance the string "<code>A%2BC</code>" would become
  30134. "<code>A+C</code>". Similarly, the string "<code>100%25AA%21</code>" becomes
  30135. the string "<code>100%AA!</code>".</p>
  30136. <li><p>Convert the <var>name</var> and <var>value</var> strings to their byte
  30137. representation in ISO-8859-1 (i.e. convert the Unicode string to a byte string, mapping code
  30138. points to byte values directly).<li><p>Add a pair consisting of <var>name</var> and <var>value</var> to <var>pairs</var>.</ol>
  30139. <li><p>If any of the name-value pairs in <var>pairs</var> have a name component
  30140. consisting of the string "<code>_charset_</code>" encoded in US-ASCII, and the value
  30141. component of the first such pair, when decoded as US-ASCII, is the name of a supported character
  30142. encoding, then let <var>encoding</var> be that character encoding (replacing the default
  30143. passed to the algorithm).<li><p>Convert the name and value components of each name-value pair in <var>pairs</var>
  30144. to Unicode by interpreting the bytes according to the encoding <var>encoding</var>.<li><p>Return <var>pairs</var>.</ol>
  30145. <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
  30146. ignored. In particular, this MIME type does not support the <code>charset</code>
  30147. parameter.</p>
  30148. <h5 id=multipart-form-data>4.10.22.7 Multipart form data</h5>
  30149. <p>The <dfn id=multipart/form-data-encoding-algorithm><code>multipart/form-data</code> encoding algorithm</dfn> is as follows:</p>
  30150. <ol><li><p>Let <var>result</var> be the empty string.<li>
  30151. <p>If the algorithm was invoked with an explicit character encoding, let the selected character
  30152. encoding be that encoding. (This algorithm is used by other specifications, which provide an
  30153. 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
  30154. in the next paragraph.)</p>
  30155. <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
  30156. 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>
  30157. <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
  30158. 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
  30159. the selected character encoding.</p>
  30160. <p>Otherwise, let the selected character encoding be UTF-8.</p>
  30161. <li><p>Let <var>charset</var> be the <a href=#encoding-name id=multipart-form-data:encoding-name>name</a> of the
  30162. selected <a href=#encoding id=multipart-form-data:encoding>character encoding</a>.<li>
  30163. <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
  30164. <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
  30165. 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
  30166. selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND
  30167. character (&amp;), a U+0023 NUMBER SIGN character (#), one or more <a href=#ascii-digits id=multipart-form-data:ascii-digits>ASCII digits</a>
  30168. representing the Unicode code point of the character in base ten, and finally a U+003B
  30169. SEMICOLON character (;).</ol>
  30170. <li>
  30171. <p>Encode the (now mutated) <var>form data set</var> using the rules described by RFC 2388,
  30172. <cite>Returning Values from Forms: <code>multipart/form-data</code></cite>, and return
  30173. the resulting byte stream. <a href=#refsRFC2388>[RFC2388]</a></p>
  30174. <p>Each entry in the <var>form data set</var> is a <i>field</i>, the name of the entry is the
  30175. <i>field name</i> and the value of the entry is the <i>field value</i>.</p>
  30176. <p>The order of parts must be the same as the order of fields in the <var>form data set</var>.
  30177. Multiple entries with the same name must be treated as distinct fields.</p>
  30178. <p class=note>In particular, this means that multiple files submitted as part of a single
  30179. <code>&lt;input type=file multiple></code> element will result in each file
  30180. 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
  30181. is not used.</p>
  30182. <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
  30183. 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
  30184. values must be encoded using the character encoding selected above (field names in particular do
  30185. not get converted to a 7-bit safe encoding as suggested in RFC 2388).</p>
  30186. <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
  30187. file fields) must use the character encoding selected above, though the precise name may be
  30188. approximated if necessary (e.g. newlines could be removed from file names, quotes could be
  30189. changed to "%22", and characters not expressible in the selected character encoding could be
  30190. replaced by other characters). User agents must not use the RFC 2231 encoding suggested by RFC
  30191. 2388.</p>
  30192. <p>The boundary used by the user agent in generating the return value of this algorithm is the
  30193. <dfn id=multipart/form-data-boundary-string><code>multipart/form-data</code> boundary string</dfn>. (This value is used to generate the
  30194. MIME type of the form submission payload generated by this algorithm.)</p>
  30195. </ol>
  30196. <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>
  30197. <h5 id=plain-text-form-data>4.10.22.8 Plain text form data</h5>
  30198. <p>The <dfn id=text/plain-encoding-algorithm><code>text/plain</code> encoding algorithm</dfn> is as follows:</p>
  30199. <ol><li><p>Let <var>result</var> be the empty string.<li>
  30200. <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
  30201. 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
  30202. non-ASCII-compatible encodings</i> flag unset.</p>
  30203. <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
  30204. character encoding.</p>
  30205. <li><p>Let <var>charset</var> be the <a href=#encoding-name id=plain-text-form-data:encoding-name>name</a> of the
  30206. 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
  30207. 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
  30208. name only.<li>
  30209. <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
  30210. <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>
  30211. <li><p>Encode <var>result</var> using the <a href=#encoder id=plain-text-form-data:encoder>encoder</a> for the selected
  30212. character encoding and return the resulting byte stream.</ol>
  30213. <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
  30214. not reliably interpretable by computer, as the format is ambiguous (for example, there is no way
  30215. to distinguish a literal newline in a value from the newline at the end of the value).</p>
  30216. <h4 id=resetting-a-form>4.10.23 Resetting a form</h4>
  30217. <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
  30218. <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>
  30219. <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
  30220. 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>
  30221. <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
  30222. 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>
  30223. <h3 id=interactive-elements>4.11 Interactive elements</h3>
  30224. <h4 id=the-details-element>4.11.1 The <dfn><code>details</code></dfn> element</h4>
  30225. <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>
  30226. <pre class=idl>interface <dfn id=htmldetailselement>HTMLDetailsElement</dfn> : <a href=#htmlelement id=the-details-element:htmlelement>HTMLElement</a> {
  30227. attribute boolean <a href=#dom-details-open id=the-details-element:dom-details-open>open</a>;
  30228. };</pre>
  30229. </dl>
  30230. <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
  30231. user can obtain additional information or controls.</p>
  30232. <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>
  30233. <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,
  30234. <a href=#represents id=the-details-element:represents-2>represents</a> the summary or legend of the details. If there is no
  30235. 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.
  30236. "Details").</p>
  30237. <p>The rest of the element's contents <a href=#represents id=the-details-element:represents-3>represents</a> the additional information or
  30238. controls.</p>
  30239. <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
  30240. attribute</a>. If present, it indicates that both the summary and the additional information is
  30241. to be shown to the user. If the attribute is absent, only the summary is to be shown.</p>
  30242. <p>When the element is created, if the attribute is absent, the additional information should be
  30243. hidden; if the attribute is present, that information should be shown. Subsequently, if the
  30244. attribute is removed, then the information should be hidden; if the attribute is added, the
  30245. information should be shown.</p>
  30246. <p>The user agent should allow the user to request that the additional information be shown or
  30247. 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
  30248. remove the <code id=the-details-element:attr-details-open-3><a href=#attr-details-open>open</a></code> attribute from the element.</p>
  30249. <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
  30250. 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
  30251. following steps, which are known as the <dfn id=details-notification-task-steps>details notification task steps</dfn>, for this
  30252. <code id=the-details-element:the-details-element-4><a href=#the-details-element>details</a></code> element:</p>
  30253. <ol><li>
  30254. <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
  30255. <code id=the-details-element:the-details-element-5><a href=#the-details-element>details</a></code> element, then abort these steps.</p>
  30256. <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
  30257. several times in succession, these steps essentially get coalesced so that only one event is
  30258. fired.</p>
  30259. <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
  30260. <code id=the-details-element:the-details-element-6><a href=#the-details-element>details</a></code> element.</ol>
  30261. <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
  30262. source</a>.</p>
  30263. <p>The <dfn id=dom-details-open><code>open</code></dfn> IDL attribute must
  30264. <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>
  30265. <div class=example>
  30266. <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
  30267. details in a progress report.</p>
  30268. <pre>&lt;section class="progress window">
  30269. &lt;h1>Copying "Really Achieving Your Childhood Dreams"&lt;/h1>
  30270. &lt;details>
  30271. &lt;summary>Copying... &lt;progress max="375505392" value="97543282">&lt;/progress> 25%&lt;/summary>
  30272. &lt;dl>
  30273. &lt;dt>Transfer rate:&lt;/dt> &lt;dd>452KB/s&lt;/dd>
  30274. &lt;dt>Local filename:&lt;/dt> &lt;dd>/home/rpausch/raycd.m4v&lt;/dd>
  30275. &lt;dt>Remote filename:&lt;/dt> &lt;dd>/var/www/lectures/raycd.m4v&lt;/dd>
  30276. &lt;dt>Duration:&lt;/dt> &lt;dd>01:16:27&lt;/dd>
  30277. &lt;dt>Colour profile:&lt;/dt> &lt;dd>SD (6-1-6)&lt;/dd>
  30278. &lt;dt>Dimensions:&lt;/dt> &lt;dd>320×240&lt;/dd>
  30279. &lt;/dl>
  30280. &lt;/details>
  30281. &lt;/section></pre>
  30282. </div>
  30283. <div class=example>
  30284. <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
  30285. default:</p>
  30286. <pre>&lt;details>
  30287. &lt;summary>&lt;label for=fn>Name &amp; Extension:&lt;/label>&lt;/summary>
  30288. &lt;p>&lt;input type=text id=fn name=fn value="Pillar Magazine.pdf">
  30289. &lt;p>&lt;label>&lt;input type=checkbox name=ext checked> Hide extension&lt;/label>
  30290. &lt;/details></pre>
  30291. <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
  30292. to collapse a set of fields down to a small set of headings, with the ability to open each
  30293. one.</p>
  30294. <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>
  30295. <p>In these examples, the summary really just summarises what the controls can change, and not
  30296. the actual values, which is less than ideal.</p>
  30297. </div>
  30298. <div class=example>
  30299. <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
  30300. automatically as the user interacts with the control, it can be used in CSS to style the element
  30301. differently based on its state. Here, a stylesheet is used to animate the colour of the summary
  30302. when the element is opened or closed:</p>
  30303. <pre>&lt;style>
  30304. details > summary { transition: color 1s; color: black; }
  30305. details[open] > summary { color: red; }
  30306. &lt;/style>
  30307. &lt;details>
  30308. &lt;summary>Automated Status: Operational&lt;/summary>
  30309. &lt;p>Velocity: 12m/s&lt;/p>
  30310. &lt;p>Direction: North&lt;/p>
  30311. &lt;/details></pre>
  30312. </div>
  30313. <h4 id=the-summary-element>4.11.2 The <dfn><code>summary</code></dfn> element</h4>
  30314. <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>
  30315. <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
  30316. 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>
  30317. element, if any.</p>
  30318. <h4 id=the-menu-element>4.11.3 The <dfn id=menus><code>menu</code></dfn> element</h4>
  30319. <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>
  30320. <pre class=idl>interface <dfn id=htmlmenuelement>HTMLMenuElement</dfn> : <a href=#htmlelement id=the-menu-element:htmlelement>HTMLElement</a> {
  30321. attribute DOMString <a href=#dom-menu-type id=the-menu-element:dom-menu-type>type</a>;
  30322. attribute DOMString <a href=#dom-menu-label id=the-menu-element:dom-menu-label>label</a>;
  30323. // <a href="#HTMLMenuElement-partial">also has obsolete members</a>
  30324. };</pre>
  30325. </dl>
  30326. <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>
  30327. <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
  30328. attribute</a> indicating the kind of menu being declared. The attribute has two states. The
  30329. "<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
  30330. 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
  30331. 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>
  30332. 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
  30333. menu</a> state; otherwise, it is the <a href=#toolbar-state id=the-menu-element:toolbar-state-3>toolbar</a> state.</p>
  30334. <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
  30335. <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>
  30336. the commands of a popup menu, and the user can only examine and interact with the commands if that
  30337. 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>
  30338. <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
  30339. <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
  30340. toolbar consisting of its contents, in the form of either an unordered list of items (represented
  30341. 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
  30342. 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>
  30343. describing available commands.</p>
  30344. <p>The <dfn id=attr-menu-label><code>label</code></dfn> attribute gives the label of the
  30345. menu. It is used by user agents to display nested menus in the UI: a context menu containing
  30346. 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
  30347. 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
  30348. 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
  30349. <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
  30350. menu</a> state.</p>
  30351. <hr>
  30352. <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
  30353. 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
  30354. <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
  30355. <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
  30356. 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>
  30357. <hr>
  30358. <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>
  30359. <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>
  30360. <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
  30361. <var>source</var> and with a particular element <var>subject</var> as a subject, the user agent
  30362. must run the following steps:</p>
  30363. <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
  30364. menu construct</a> algorithm when passed the <var>source</var> element.</p>
  30365. <li>
  30366. <p>Display <var>pop-up menu</var> to the user, and let the algorithm that invoked this one continue.</p>
  30367. <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
  30368. 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
  30369. 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
  30370. 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>
  30371. <p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
  30372. from the DOM before being shown, and is then immutable.</p>
  30373. </ol>
  30374. <p>To <dfn id=build-a-menu-construct>build a menu construct</dfn> for an element <var>source</var>, the user agent must run
  30375. the following steps, which return a <a href=#menu-construct id=the-menu-element:menu-construct-3>menu construct</a>:</p>
  30376. <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>
  30377. <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>
  30378. as the output.</p>
  30379. <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
  30380. 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>,
  30381. run the appropriate steps from the following list:</p>
  30382. <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
  30383. 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
  30384. 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
  30385. 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
  30386. <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
  30387. <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>
  30388. <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
  30389. 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
  30390. 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>
  30391. <hr>
  30392. <p>The <dfn id=dom-menu-type><code>type</code></dfn> IDL attribute must <a href=#reflect id=the-menu-element:reflect>reflect</a>
  30393. 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>
  30394. <p>The <dfn id=dom-menu-label><code>label</code></dfn> IDL attribute must
  30395. <a href=#reflect id=the-menu-element:reflect-2>reflect</a> the content attribute of the same name.</p>
  30396. <div class=example>
  30397. <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
  30398. buttons on it, each of which has a dropdown menu with a series of options:</p>
  30399. <pre>&lt;menu>
  30400. &lt;li>
  30401. &lt;button type=menu value="File" menu="filemenu">
  30402. &lt;menu id="filemenu" type="popup">
  30403. &lt;menuitem onclick="fnew()" label="New...">
  30404. &lt;menuitem onclick="fopen()" label="Open...">
  30405. &lt;menuitem onclick="fsave()" label="Save">
  30406. &lt;menuitem onclick="fsaveas()" label="Save as...">
  30407. &lt;/menu>
  30408. &lt;/li>
  30409. &lt;li>
  30410. &lt;button type=menu value="Edit" menu="editmenu">
  30411. &lt;menu id="editmenu" type="popup">
  30412. &lt;menuitem onclick="ecopy()" label="Copy">
  30413. &lt;menuitem onclick="ecut()" label="Cut">
  30414. &lt;menuitem onclick="epaste()" label="Paste">
  30415. &lt;/menu>
  30416. &lt;/li>
  30417. &lt;li>
  30418. &lt;button type=menu value="Help" menu="helpmenu">
  30419. &lt;menu id="helpmenu" type="popup">
  30420. &lt;menuitem onclick="location='help.html'" label="Help">
  30421. &lt;menuitem onclick="location='about.html'" label="About">
  30422. &lt;/menu>
  30423. &lt;/li>
  30424. &lt;/menu></pre>
  30425. <p>In a supporting user agent, this might look like this (assuming the user has just activated the
  30426. second button):</p>
  30427. <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>
  30428. </div>
  30429. <h4 id=the-menuitem-element>4.11.4 The <dfn><code>menuitem</code></dfn> element</h4>
  30430. <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>
  30431. <pre class=idl>interface <dfn id=htmlmenuitemelement>HTMLMenuItemElement</dfn> : <a href=#htmlelement id=the-menuitem-element:htmlelement>HTMLElement</a> {
  30432. attribute DOMString <a href=#dom-menuitem-type id=the-menuitem-element:dom-menuitem-type>type</a>;
  30433. attribute DOMString <a href=#dom-menuitem-label id=the-menuitem-element:dom-menuitem-label>label</a>;
  30434. attribute DOMString <a href=#dom-menuitem-icon id=the-menuitem-element:dom-menuitem-icon>icon</a>;
  30435. attribute boolean <a href=#dom-menuitem-disabled id=the-menuitem-element:dom-menuitem-disabled>disabled</a>;
  30436. attribute boolean <a href=#dom-menuitem-checked id=the-menuitem-element:dom-menuitem-checked>checked</a>;
  30437. attribute DOMString <a href=#dom-menuitem-radiogroup id=the-menuitem-element:dom-menuitem-radiogroup>radiogroup</a>;
  30438. attribute boolean <a href=#dom-menuitem-default id=the-menuitem-element:dom-menuitem-default>default</a>;
  30439. 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>;
  30440. };</pre>
  30441. </dl>
  30442. <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
  30443. 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>
  30444. <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
  30445. <code id=the-menuitem-element:attr-menuitem-type-2><a href=#attr-menuitem-type>type</a></code>,
  30446. <code id=the-menuitem-element:attr-menuitem-label-2><a href=#attr-menuitem-label>label</a></code>,
  30447. <code id=the-menuitem-element:attr-menuitem-icon-2><a href=#attr-menuitem-icon>icon</a></code>,
  30448. <code id=the-menuitem-element:attr-menuitem-disabled-2><a href=#attr-menuitem-disabled>disabled</a></code>,
  30449. <code id=the-menuitem-element:attr-menuitem-checked-2><a href=#attr-menuitem-checked>checked</a></code>, and
  30450. <code id=the-menuitem-element:attr-menuitem-radiogroup-2><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
  30451. attributes defines a new command.</p>
  30452. <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
  30453. one. This allows authors to define a command once, and set its state (e.g. whether it is active or
  30454. disabled) in one place, and have all references to that command in the user interface change at
  30455. the same time.</p>
  30456. <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
  30457. 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
  30458. 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
  30459. must not have any of the following attributes specified:
  30460. <code id=the-menuitem-element:attr-menuitem-type-3><a href=#attr-menuitem-type>type</a></code>,
  30461. <code id=the-menuitem-element:attr-menuitem-label-3><a href=#attr-menuitem-label>label</a></code>,
  30462. <code id=the-menuitem-element:attr-menuitem-icon-3><a href=#attr-menuitem-icon>icon</a></code>,
  30463. <code id=the-menuitem-element:attr-menuitem-disabled-3><a href=#attr-menuitem-disabled>disabled</a></code>,
  30464. <code id=the-menuitem-element:attr-menuitem-checked-3><a href=#attr-menuitem-checked>checked</a></code>,
  30465. <code id=the-menuitem-element:attr-menuitem-radiogroup-3><a href=#attr-menuitem-radiogroup>radiogroup</a></code>.
  30466. </p>
  30467. <hr>
  30468. <p>The <dfn id=attr-menuitem-type><code>type</code></dfn> attribute indicates the kind of
  30469. command: either a normal command with an associated action, or a state or option that can be
  30470. toggled, or a selection of one item from a list of items.</p>
  30471. <p>The attribute is an <a href=#enumerated-attribute id=the-menuitem-element:enumerated-attribute>enumerated attribute</a> with three keywords and states. The
  30472. "<dfn id=attr-menuitem-type-keyword-command><code>command</code></dfn>" keyword maps to the
  30473. <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>
  30474. <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>
  30475. <p>The <dfn id=attr-menuitem-label><code>label</code></dfn> attribute gives the name of the
  30476. 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
  30477. 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
  30478. specified, it must have a value that is not the empty string.</p>
  30479. <p>The <dfn id=attr-menuitem-icon><code>icon</code></dfn> attribute gives a picture that
  30480. represents the command. If the attribute is specified, the attribute's value must contain a
  30481. <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
  30482. 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
  30483. attribute's value must be <a href=#resolve-a-url id=the-menuitem-element:resolve-a-url>resolved</a> relative to the element.
  30484. 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>
  30485. <p>The <dfn id=attr-menuitem-disabled><code>disabled</code></dfn> attribute is a
  30486. <a href=#boolean-attribute id=the-menuitem-element:boolean-attribute>boolean attribute</a> that, if present, indicates that the command is not available in
  30487. the current state.</p>
  30488. <p class=note>The distinction between <code id=the-menuitem-element:attr-menuitem-disabled-4><a href=#attr-menuitem-disabled>disabled</a></code> and
  30489. <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
  30490. context, it could be enabled if only certain aspects of the situation were changed. A command
  30491. would be marked as hidden if, in that situation, the command will never be enabled. For example,
  30492. in the context menu for a water faucet, the command "open" might be disabled if the faucet is
  30493. already open, but the command "eat" would be marked hidden since the faucet could never be
  30494. eaten.</p>
  30495. <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
  30496. attribute</a> that, if present, indicates that the command is selected. The attribute must be
  30497. 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>
  30498. <p>The <dfn id=attr-menuitem-radiogroup><code>radiogroup</code></dfn> attribute gives the
  30499. name of the group of commands that will be toggled when the command itself is toggled, for
  30500. 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
  30501. 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
  30502. the <a href=#attr-menuitem-type-state-radio id=the-menuitem-element:attr-menuitem-type-state-radio-3>Radio</a> state. When specified, the
  30503. attribute's value must be a non-empty string.</p>
  30504. <hr>
  30505. <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
  30506. <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
  30507. 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
  30508. order</a>, hereafter <var>master</var>, itself <a href=#concept-command id=the-menuitem-element:concept-command>defines a
  30509. 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>
  30510. <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>
  30511. attribute must have a <a href=#master-command id=the-menuitem-element:master-command>master command</a>.</p>
  30512. <p class=note>This effectively defines the syntax of the attribute's value as being the ID of
  30513. another element that <a href=#concept-command id=the-menuitem-element:concept-command-2>defines a command</a>.</p>
  30514. <hr>
  30515. <p>The <dfn id=attr-menuitem-title><code>title</code></dfn> attribute gives a hint describing
  30516. the command, which might be shown to the user to help him.</p>
  30517. <p>The <dfn id=attr-menuitem-default><code>default</code></dfn> attribute indicates, if
  30518. present, that the command is the one that would have been invoked if the user had directly
  30519. 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>
  30520. <div class=example>
  30521. <p>In this trivial example, a submit button is given a context menu that has two options, one to
  30522. reset the form, and one to submit the form. The submit command is marked as being the default.</p>
  30523. <pre>&lt;form action="dosearch.pl">
  30524. &lt;p>&lt;label>Enter search terms: &lt;input type="text" name="terms">&lt;/label>&lt;/p>
  30525. &lt;p>&lt;input type=submit contextmenu=formmenu id="submitbutton">&lt;/p>
  30526. &lt;p hidden>&lt;input type=reset id="resetbutton">&lt;/p>
  30527. &lt;menu type=popup id=formmenu>
  30528. &lt;menuitem command="submitbutton" default>
  30529. &lt;menuitem command="resetbutton">
  30530. &lt;/menu>
  30531. &lt;/form></pre>
  30532. </div>
  30533. <hr>
  30534. <p>The <dfn id=dom-menuitem-type><code>type</code></dfn> IDL attribute must
  30535. <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
  30536. values</a>.</p>
  30537. <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>
  30538. the respective content attributes of the same name.</p>
  30539. <p>The <dfn id=dom-menuitem-command><code>command</code></dfn> IDL attribute must return the
  30540. <a href=#master-command id=the-menuitem-element:master-command-2>master command</a>, if any, or null otherwise.</p>
  30541. <hr>
  30542. <p>If the element's <a href=#command-facet-disabledstate id=the-menuitem-element:command-facet-disabledstate>Disabled State</a> is false
  30543. (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>
  30544. attributes, as follows:</p>
  30545. <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
  30546. <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
  30547. 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
  30548. 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
  30549. current element's (treating missing <code id=the-menuitem-element:attr-menuitem-radiogroup-5><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
  30550. 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>
  30551. <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
  30552. 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>
  30553. <p class=note>Firing a synthetic <code id=the-menuitem-element:event-click><a href=#event-click>click</a></code> event at the element
  30554. does not cause any of the actions described above to happen.</p>
  30555. <p>If the element's <a href=#command-facet-disabledstate id=the-menuitem-element:command-facet-disabledstate-2>Disabled State</a> is true
  30556. (disabled) then the element has no <a href=#activation-behavior id=the-menuitem-element:activation-behavior-3>activation behavior</a>.</p>
  30557. <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>
  30558. <div class=example>
  30559. <p>Here is an example of a pop-up menu button with three options that let the user toggle between
  30560. left, center, and right alignment. One could imagine such a toolbar as part of a text editor. The
  30561. menu also has a separator followed by another menu item labeled "Publish", though that menu item
  30562. is disabled.</p>
  30563. <pre>&lt;button type=menu menu=editmenu>Commands...&lt;/button>
  30564. &lt;menu type="popup" id="editmenu">
  30565. &lt;menuitem type="radio" radiogroup="alignment" checked="checked"
  30566. label="Left" icon="icons/alL.png" onclick="setAlign('left')">
  30567. &lt;menuitem type="radio" radiogroup="alignment"
  30568. label="Center" icon="icons/alC.png" onclick="setAlign('center')">
  30569. &lt;menuitem type="radio" radiogroup="alignment"
  30570. label="Right" icon="icons/alR.png" onclick="setAlign('right')">
  30571. &lt;hr>
  30572. &lt;menuitem type="command" disabled
  30573. label="Publish" icon="icons/pub.png" onclick="publish()">
  30574. &lt;/menu></pre>
  30575. </div>
  30576. <h4 id=context-menus>4.11.5 Context menus</h4>
  30577. <h5 id=declaring-a-context-menu>4.11.5.1 Declaring a context menu</h5>
  30578. <p>The <dfn id=attr-contextmenu><code>contextmenu</code></dfn> attribute gives the element's
  30579. 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>
  30580. 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>
  30581. attribute is in the <a href=#popup-menu-state id=declaring-a-context-menu:popup-menu-state>popup menu</a> state.</p>
  30582. <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
  30583. 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>
  30584. <div class=example>
  30585. <p>Here is an example of a context menu for an input control:</p>
  30586. <pre>&lt;form name="npc">
  30587. &lt;label>Character name: &lt;input name=char type=text contextmenu=namemenu required>&lt;/label>
  30588. &lt;menu type=popup id=namemenu>
  30589. &lt;menuitem label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()">
  30590. &lt;menuitem label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)">
  30591. &lt;/menu>
  30592. &lt;/form></pre>
  30593. <p>This adds two items to the control's context menu, one called "Pick random name", and one
  30594. called "Prefill other fields based on name". They invoke scripts that are not shown in the
  30595. example above.</p>
  30596. </div>
  30597. <h5 id=processing-model-5>4.11.5.2 Processing model</h5>
  30598. <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
  30599. 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
  30600. <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
  30601. <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
  30602. context menu</a> is that element. Otherwise, if <var>A</var> has a parent element,
  30603. 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
  30604. 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
  30605. menu</a> is null.</p>
  30606. <p>When an element's context menu is requested (e.g. by the user right-clicking the element, or
  30607. pressing a context menu key), the user agent must apply the appropriate rules from the following
  30608. list:</p>
  30609. <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
  30610. <code id=processing-model-5:mouseevent><a href=#mouseevent>MouseEvent</a></code> interface, at the element for which the menu was requested. The context
  30611. information of the event must be initialised to the same values as the last
  30612. <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
  30613. 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
  30614. event named <code>contextmenu</code></a> that bubbles and is
  30615. cancelable at the element for which the menu was requested.</dl>
  30616. <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
  30617. sequence of events is UA-dependent, as it will vary based on platform conventions.</p>
  30618. <p>The default action of the <code id=processing-model-5:event-contextmenu-3><a href=#event-contextmenu>contextmenu</a></code> event depends on
  30619. 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
  30620. menu</a> when the event dispatch has completed, as follows.</p>
  30621. <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
  30622. null, the default action must be for the user agent to show its default context menu, if it has
  30623. one.</p>
  30624. <p>Otherwise, let <var>subject</var> be the element for which the menu was requested, and let
  30625. <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
  30626. the <code id=processing-model-5:event-contextmenu-4><a href=#event-contextmenu>contextmenu</a></code> event's dispatch has completed. The user
  30627. 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,
  30628. with the <code id=processing-model-5:dom-relatedevent-relatedtarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute initialised
  30629. to <var>subject</var>. The event must be cancelable. </p>
  30630. <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
  30631. 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
  30632. <var>menu</var> with <var>subject</var> as the subject.</p>
  30633. <p>The user agent may also provide access to its default context menu, if any, with the context
  30634. menu shown. For example, it could merge the menu items from the two menus together, or provide the
  30635. page's context menu as a submenu of the default menu. In general, user agents are encouraged to
  30636. de-emphasise their own contextual menu items, so as to give the author's context menu the
  30637. appearance of legitimacy — to allow documents to feel like "applications" rather than "mere
  30638. Web pages".</p>
  30639. <p>User agents may provide means for bypassing the context menu processing model, ensuring that
  30640. the user can always access the UA's default context menus. For example, the user agent could
  30641. handle right-clicks that have the Shift key depressed in such a way that it does not fire the
  30642. <code id=processing-model-5:event-contextmenu-5><a href=#event-contextmenu>contextmenu</a></code> event and instead always shows the default
  30643. context menu.</p>
  30644. <hr>
  30645. <p>The <dfn id=dom-contextmenu><code>contextMenu</code></dfn> IDL attribute must
  30646. <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>
  30647. <div class=example>
  30648. <p>In this example, an image of cats is given a context menu with four possible commands:</p>
  30649. <pre>&lt;img src="cats.jpeg" alt="Cats" contextmenu=catsmenu>
  30650. &lt;menu type="popup" id="catsmenu">
  30651. &lt;menuitem label="Pet the kittens" onclick="kittens.pet()">
  30652. &lt;menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">
  30653. &lt;menu label="Feed the kittens">
  30654. &lt;menuitem label="Fish" onclick="kittens.feed(fish)">
  30655. &lt;menuitem label="Chicken" onclick="kittens.feed(chicken)">
  30656. &lt;/menu>
  30657. &lt;/menu></pre>
  30658. <p>When a user of a mouse-operated visual Web browser right-clicks on the image, the browser
  30659. might pop up a context menu like this:</p>
  30660. <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.">
  30661. <p>When the user clicks the disclosure triangle, such a user agent would expand the context menu
  30662. in place, to show the browser's own commands:</p>
  30663. <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.">
  30664. </div>
  30665. <h5 id=the-relatedevent-interfaces>4.11.5.3 The <code id=the-relatedevent-interfaces:relatedevent><a href=#relatedevent>RelatedEvent</a></code> interfaces</h5>
  30666. <pre class=idl>[Constructor(DOMString type, optional <a href=#relatedeventinit id=the-relatedevent-interfaces:relatedeventinit>RelatedEventInit</a> eventInitDict)]
  30667. interface <dfn id=relatedevent>RelatedEvent</dfn> : <a href=#event id=the-relatedevent-interfaces:event>Event</a> {
  30668. 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>;
  30669. };
  30670. dictionary <dfn id=relatedeventinit>RelatedEventInit</dfn> : <a href=#eventinit id=the-relatedevent-interfaces:eventinit>EventInit</a> {
  30671. <a href=#eventtarget id=the-relatedevent-interfaces:eventtarget-2>EventTarget</a>? relatedTarget;
  30672. };</pre>
  30673. <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>
  30674. <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
  30675. target involved in the event would be the element for which the menu is being shown.</p>
  30676. </dl>
  30677. <p>The <dfn id=dom-relatedevent-relatedtarget><code>relatedTarget</code></dfn> attribute must
  30678. return the value it was initialised to. When the object is created, this attribute must be
  30679. initialised to null. It represents the other event target that is related to the event.</p>
  30680. <h4 id=commands>4.11.6 Commands</h4>
  30681. <h5 id=facets-2>4.11.6.1 Facets</h5>
  30682. <p>A <dfn id=concept-command>command</dfn> is the abstraction behind menu items, buttons, and
  30683. links. Once a command is defined, other parts of the interface can refer to the same command,
  30684. 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>
  30685. <p id=facets>Commands are defined to have the following <dfn id=concept-facet>facets</dfn>:</p>
  30686. <dl><dt><dfn id=command-facet-type>Type</dfn><dd>The kind of command: "command", meaning it is a normal command; "radio", meaning that
  30687. 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
  30688. commands); or "checkbox", meaning that triggering the command will, amongst other things, toggle
  30689. 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
  30690. 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
  30691. 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
  30692. 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
  30693. 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>
  30694. <p>These facets are exposed on elements using the <dfn id=command-api>command API</dfn>:</p>
  30695. <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>
  30696. <p>Exposes the <a href=#command-facet-type id=facets-2:command-facet-type>Type</a> facet of the command.</p>
  30697. <dt><var>element</var> . <code id=facets-2:dom-element-id><a href=#dom-element-id>id</a></code><dd>
  30698. <p>Exposes the <a href=#command-facet-id id=facets-2:command-facet-id>ID</a> facet of the command.</p>
  30699. <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandlabel><a href=#dom-command-ro-commandlabel>commandLabel</a></code><dd>
  30700. <p>Exposes the <a href=#command-facet-label id=facets-2:command-facet-label>Label</a> facet of the command.</p>
  30701. <dt><var>element</var> . <code id=facets-2:dom-title><a href=#dom-title>title</a></code><dd>
  30702. <p>Exposes the <a href=#command-facet-hint id=facets-2:command-facet-hint>Hint</a> facet of the command.</p>
  30703. <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandicon><a href=#dom-command-ro-commandicon>commandIcon</a></code><dd>
  30704. <p>Exposes the <a href=#command-facet-icon id=facets-2:command-facet-icon>Icon</a> facet of the command.</p>
  30705. <dt><var>element</var> . <code id=facets-2:dom-accesskeylabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code><dd>
  30706. <p>Exposes the <a href=#command-facet-accesskey id=facets-2:command-facet-accesskey>Access Key</a> facet of the command.</p>
  30707. <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandhidden><a href=#dom-command-ro-commandhidden>commandHidden</a></code><dd>
  30708. <p>Exposes the <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate>Hidden State</a> facet of the command.</p>
  30709. <dt><var>element</var> . <code id=facets-2:dom-command-ro-commanddisabled><a href=#dom-command-ro-commanddisabled>commandDisabled</a></code><dd>
  30710. <p>Exposes the <a href=#command-facet-disabledstate id=facets-2:command-facet-disabledstate-2>Disabled State</a> facet of the command.</p>
  30711. <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandchecked><a href=#dom-command-ro-commandchecked>commandChecked</a></code><dd>
  30712. <p>Exposes the <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate-3>Checked State</a> facet of the command.</p>
  30713. <dt><var>element</var> . <code id=facets-2:dom-click><a href=#dom-click>click</a></code>()<dd>
  30714. <p>Triggers the <a href=#command-facet-action id=facets-2:command-facet-action>Action</a> of the command.</p>
  30715. </dl>
  30716. <p>The <dfn id=dom-command-ro-commandtype><code>commandType</code></dfn> attribute must
  30717. 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",
  30718. "radio", or "checkbox" respectively. If the element does not define a command, it must return
  30719. null.</p>
  30720. <p>The <dfn id=dom-command-ro-commandlabel><code>commandLabel</code></dfn> attribute must
  30721. return the command's <a href=#command-facet-label id=facets-2:command-facet-label-2>Label</a>, or null if the element does
  30722. not define a command or does not specify a <a href=#command-facet-label id=facets-2:command-facet-label-3>Label</a>.</p>
  30723. <p>The <dfn id=dom-command-ro-commandicon><code>commandIcon</code></dfn> attribute must
  30724. 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
  30725. does not define a command, then the attribute must return null.</p>
  30726. <p>The <dfn id=dom-command-ro-commandhidden><code>commandHidden</code></dfn> attribute must
  30727. return true if the command's <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate-2>Hidden State</a> is that
  30728. the command is hidden, and false if the command is not hidden. If the element does not define a
  30729. command, the attribute must return null.</p>
  30730. <p>The <dfn id=dom-command-ro-commanddisabled><code>commandDisabled</code></dfn> attribute
  30731. must return true if the command's <a href=#command-facet-disabledstate id=facets-2:command-facet-disabledstate-3>Disabled State</a>
  30732. is that the command is disabled, and false if the command is not disabled. This attribute is not
  30733. affected by the command's <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate-3>Hidden State</a>. If the
  30734. element does not define a command, the attribute must return null.</p>
  30735. <p>The <dfn id=dom-command-ro-commandchecked><code>commandChecked</code></dfn> attribute must
  30736. return true if the command's <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate-4>Checked State</a> is that
  30737. the command is checked, and false if it is that the command is not checked. If the element does
  30738. not define a command, the attribute must return null.</p>
  30739. <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>
  30740. 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>
  30741. <hr>
  30742. <dl class=domintro><dt><var>document</var> . <code id=facets-2:dom-document-commands><a href=#dom-document-commands>commands</a></code><dd>
  30743. <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
  30744. define commands and have IDs.</p>
  30745. </dl>
  30746. <p>The <dfn id=dom-document-commands><code>commands</code></dfn> attribute of the document's
  30747. <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
  30748. <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>
  30749. <hr>
  30750. <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>
  30751. <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
  30752. 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>
  30753. 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
  30754. 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>
  30755. <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
  30756. user.</p>
  30757. <p class=example>For example, such commands could be listed in the user agent's menu bar.</p>
  30758. <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>
  30759. <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>
  30760. <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>
  30761. <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.
  30762. Otherwise the command is an <a href=#anonymous-command id=using-the-a-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
  30763. <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
  30764. element's <code id=using-the-a-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
  30765. <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
  30766. <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>
  30767. <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
  30768. 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
  30769. 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
  30770. 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>
  30771. <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
  30772. <a href=#assigned-access-key id=using-the-a-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
  30773. <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)
  30774. 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>
  30775. <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
  30776. 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>
  30777. <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
  30778. false. (The command is never checked.)</p>
  30779. <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
  30780. 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>
  30781. 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>
  30782. event</a> at the element.</p>
  30783. <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>
  30784. <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
  30785. command</a>.</p>
  30786. <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>,
  30787. <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>,
  30788. <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
  30789. 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>
  30790. <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
  30791. 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>
  30792. <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>
  30793. <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
  30794. 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
  30795. 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
  30796. command</a>.</p>
  30797. <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
  30798. 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
  30799. 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>
  30800. <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.
  30801. Otherwise the command is an <a href=#anonymous-command id=using-the-input-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
  30802. <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
  30803. command:</p>
  30804. <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
  30805. 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,
  30806. locale-dependent value that the UA uses to label the button itself if the attribute is absent.</p>
  30807. <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
  30808. 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
  30809. <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
  30810. 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
  30811. the string given by <code><var>element</var>.labels[0].textContent</code>). Otherwise,
  30812. 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>
  30813. <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
  30814. 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>
  30815. <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
  30816. 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>
  30817. <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
  30818. <a href=#assigned-access-key id=using-the-input-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
  30819. <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)
  30820. 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>
  30821. <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
  30822. 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>
  30823. <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
  30824. 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
  30825. 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>
  30826. <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
  30827. 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>
  30828. 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>
  30829. event</a> at the element.</p>
  30830. <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>
  30831. <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>
  30832. 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>
  30833. <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
  30834. <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>
  30835. <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.
  30836. Otherwise the command is an <a href=#anonymous-command id=using-the-option-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
  30837. <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
  30838. <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
  30839. 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,
  30840. 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
  30841. 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
  30842. characters</a> replaced by a single U+0020 SPACE character.</p>
  30843. <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
  30844. 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
  30845. attribute is absent.</p>
  30846. <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>
  30847. <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
  30848. <a href=#assigned-access-key id=using-the-option-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
  30849. <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)
  30850. 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>
  30851. <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
  30852. 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
  30853. <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
  30854. of its ancestors is <a href=#inert id=using-the-option-element-to-define-a-command:inert>inert</a>, and false otherwise.</p>
  30855. <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
  30856. (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,
  30857. and false otherwise.</p>
  30858. <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>
  30859. <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
  30860. command</h5>
  30861. <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
  30862. command</a>.</p>
  30863. <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
  30864. <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
  30865. "<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>
  30866. <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.
  30867. Otherwise the command is an <a href=#anonymous-command id=using-the-menuitem-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
  30868. <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
  30869. <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
  30870. it doesn't.</p>
  30871. <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
  30872. 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
  30873. if the attribute is absent.</p>
  30874. <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
  30875. 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
  30876. <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
  30877. 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>
  30878. <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
  30879. <a href=#assigned-access-key id=using-the-menuitem-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
  30880. <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)
  30881. 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>
  30882. <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
  30883. 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>
  30884. <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
  30885. (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
  30886. false otherwise.</p>
  30887. <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
  30888. defined <a href=#activation-behavior id=using-the-menuitem-element-to-define-a-command:activation-behavior>activation behavior</a>, is to
  30889. <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
  30890. <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>
  30891. <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
  30892. a command indirectly</dfn></h5>
  30893. <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>
  30894. <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>
  30895. <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.
  30896. 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>
  30897. <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>
  30898. <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>
  30899. <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>
  30900. <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
  30901. <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>
  30902. <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>
  30903. <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>
  30904. <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>
  30905. <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>
  30906. <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
  30907. on a <code>label</code> element to define a command</dfn></h5>
  30908. <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
  30909. 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
  30910. 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>
  30911. <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>
  30912. <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.
  30913. 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>
  30914. <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
  30915. 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>
  30916. <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>
  30917. <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>
  30918. <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
  30919. <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>
  30920. <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
  30921. 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>
  30922. <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
  30923. false. (The command is never checked.)</p>
  30924. <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
  30925. on a <code>legend</code> element to define a command</dfn></h5>
  30926. <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
  30927. <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
  30928. <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>
  30929. 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>
  30930. <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>
  30931. <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.
  30932. 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>
  30933. <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
  30934. 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>
  30935. <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>
  30936. <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>
  30937. <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
  30938. <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>
  30939. <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
  30940. 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
  30941. <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
  30942. 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
  30943. <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>
  30944. <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
  30945. false. (The command is never checked.)</p>
  30946. <h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements>4.11.6.10 <dfn>Using the <code>accesskey</code>
  30947. attribute to define a command on other elements</dfn></h5>
  30948. <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
  30949. command</a>.</p>
  30950. <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
  30951. 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>,
  30952. then that section applies to this element, and this section does not. Otherwise, this section
  30953. applies to that element.</p>
  30954. <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>
  30955. <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.
  30956. 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>
  30957. <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
  30958. 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
  30959. <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
  30960. 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
  30961. the string given by <code><var>element</var>.labels[0].textContent</code>). Otherwise,
  30962. 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
  30963. itself.</p>
  30964. <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
  30965. <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>
  30966. <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>
  30967. <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
  30968. <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>
  30969. <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)
  30970. 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>
  30971. <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
  30972. 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>
  30973. <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
  30974. false. (The command is never checked.)</p>
  30975. <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
  30976. steps:</p>
  30977. <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
  30978. 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>,
  30979. <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>
  30980. <h4 id=the-dialog-element>4.11.7 The <dfn><code>dialog</code></dfn> element</h4>
  30981. <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>
  30982. <pre class=idl>interface <dfn id=htmldialogelement>HTMLDialogElement</dfn> : <a href=#htmlelement id=the-dialog-element:htmlelement>HTMLElement</a> {
  30983. attribute boolean <a href=#dom-dialog-open id=the-dialog-element:dom-dialog-open>open</a>;
  30984. attribute DOMString <a href=#dom-dialog-returnvalue id=the-dialog-element:dom-dialog-returnvalue>returnValue</a>;
  30985. 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);
  30986. 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);
  30987. void <a href=#dom-dialog-close id=the-dialog-element:dom-dialog-close>close</a>(optional DOMString returnValue);
  30988. };</pre>
  30989. </dl>
  30990. <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
  30991. to perform a task, for example a dialog box, inspector, or window.</p>
  30992. <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
  30993. 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
  30994. that the user can interact with it.</p>
  30995. <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
  30996. specified should not be shown to the user. This requirement may be implemented indirectly through
  30997. the style layer. For example, user agents that <a href=#renderingUA>support the suggested
  30998. default rendering</a> implement this requirement using the CSS rules described in the <a href=#rendering>rendering section</a>.</p>
  30999. <p>The <code id=the-dialog-element:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute must not be specified on
  31000. <code id=the-dialog-element:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> elements.</p>
  31001. <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>
  31002. <p>Displays the <code id=the-dialog-element:the-dialog-element-5><a href=#the-dialog-element>dialog</a></code> element.</p>
  31003. <p>The argument, if provided, provides an anchor point to which the element will be fixed.</p>
  31004. <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>
  31005. <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>
  31006. <p>The argument, if provided, provides an anchor point to which the element will be fixed.</p>
  31007. <p>This method honors the <code id=the-dialog-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute.</p>
  31008. <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>
  31009. <p>Closes the <code id=the-dialog-element:the-dialog-element-7><a href=#the-dialog-element>dialog</a></code> element.</p>
  31010. <p>The argument, if provided, provides a return value.</p>
  31011. <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>
  31012. <p>Returns the <code id=the-dialog-element:the-dialog-element-8><a href=#the-dialog-element>dialog</a></code>'s return value.</p>
  31013. <p>Can be set, to update the return value.</p>
  31014. </dl>
  31015. <p>When the <dfn id=dom-dialog-show><code>show()</code></dfn> method is invoked, the user
  31016. agent must run the following steps:</p>
  31017. <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
  31018. 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>
  31019. 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,
  31020. <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
  31021. 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>
  31022. <hr>
  31023. <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
  31024. <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
  31025. initialised to be empty.</p>
  31026. <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
  31027. <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
  31028. 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>
  31029. <p>When the <dfn id=dom-dialog-showmodal><code>showModal()</code></dfn> method is invoked,
  31030. the user agent must run the following steps:</p>
  31031. <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
  31032. 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>
  31033. 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
  31034. 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
  31035. 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
  31036. 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>
  31037. 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
  31038. <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>
  31039. <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>
  31040. <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>
  31041. at this point, or if it is <a href=#inert id=the-dialog-element:inert>inert</a>, abort these steps.<li>
  31042. <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
  31043. <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>
  31044. <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>
  31045. <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>
  31046. <p>If there isn't one of those either, then let <var>control</var> be <var>subject</var>.</p>
  31047. <li><p>Run the <a href=#focusing-steps id=the-dialog-element:focusing-steps>focusing steps</a> for <var>control</var>.</ol>
  31048. <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
  31049. <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>
  31050. <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
  31051. 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
  31052. <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
  31053. 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
  31054. 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
  31055. dialog</a> at all.</ol>
  31056. <p>When the <dfn id=dom-dialog-close><code>close()</code></dfn> method is invoked, the user
  31057. 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
  31058. with an argument, that argument must be used as the return value; otherwise, there is no return
  31059. value.</p>
  31060. <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
  31061. must run the following steps:</p>
  31062. <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>
  31063. 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>
  31064. 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>
  31065. <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
  31066. stack</a>, then run these substeps:</p>
  31067. <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
  31068. 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
  31069. dialog</a> at all.</ol>
  31070. <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>
  31071. <p>The <dfn id=dom-dialog-returnvalue><code>returnValue</code></dfn> IDL attribute, on
  31072. getting, must return the last value to which it was set. On setting, it must be set to the new
  31073. value. When the element is created, it must be set to the empty string.</p>
  31074. <hr>
  31075. <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
  31076. 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
  31077. 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
  31078. 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
  31079. 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>
  31080. <p class=note>An example of such a UI mechanism would be the user pressing the "Escape" key.</p>
  31081. <hr>
  31082. <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>,
  31083. <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
  31084. 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
  31085. 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
  31086. <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>
  31087. <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,
  31088. and when it is in that mode and has new rendering boxes created, the user agent must set up the
  31089. element such that its top static position, for the purposes of calculating the used value of the
  31090. 'top' property, is the value that would place the element's top margin edge as far from the top of
  31091. the viewport as the element's bottom margin edge from the bottom of the viewport, if the element's
  31092. height is less than the height of the viewport, and otherwise is the value that would place the
  31093. element's top margin edge at the top of the viewport.</p>
  31094. <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
  31095. <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
  31096. measured in CSS pixels), then the user agent must recreate the element's boxes, recalculating its
  31097. top static position as in the previous paragraph.</p>
  31098. <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>
  31099. must remain the element's top static position until its boxes are recreated. (The element's static
  31100. position is only used in calculating the used value of the 'top' property in certain situations;
  31101. it's not used, for instance, to position the element if its 'position' property is set to
  31102. 'static'.)</p>
  31103. <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
  31104. steps:</p>
  31105. <ol><li>
  31106. <p>If <var>anchor</var> is a <code id=the-dialog-element:mouseevent-3><a href=#mouseevent>MouseEvent</a></code> object, then run these
  31107. substeps:</p>
  31108. <ol><li><p>If <var>anchor</var>'s target element does not have a rendered box, or is in a
  31109. different document than <var>subject</var>, then let <var>subject</var> be
  31110. 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>
  31111. steps.<li><p>Let <var>anchor element</var> be an anonymous element rendered as a box with
  31112. zero height and width (so its margin and border boxes both just form a point), positioned so
  31113. that its top and left are at the coordinate identified by the event, and whose properties all
  31114. compute to their initial values.</ol>
  31115. <p>Otherwise, let <var>anchor element</var> be <var>anchor</var>.</p>
  31116. <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>
  31117. <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
  31118. <var>B</var>, the following requirements apply:</p>
  31119. <ul><li>
  31120. <p>If at any time either <var>A</var> or <var>B</var> cease having rendered
  31121. boxes, <var>A</var> and <var>B</var> cease being in the same
  31122. <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
  31123. <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
  31124. alignment</a>, otherwise, let <var>subject</var>'s mode become <a href=#normal-alignment id=the-dialog-element:normal-alignment-3>normal
  31125. alignment</a>.</p>
  31126. <li>
  31127. <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
  31128. otherwise compute to (i.e. the 'position' property's specified value is ignored).</p>
  31129. <p class=note>The '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-2>absolute-anchored</a>'
  31130. keyword's requirements are described below.</p>
  31131. <li>
  31132. <p>The anchor points for <var>A</var> and <var>B</var> are defined as per the
  31133. appropriate entry in the following list:</p>
  31134. <dl class=switch><dt>If the computed value of 'anchor-point' is 'none' on both <var>A</var> and <var>B</var>
  31135. <dd>
  31136. <p>The anchor points of <var>A</var> and <var>B</var> are the center points
  31137. of their respective first boxes' border boxes.
  31138. <dt>If the computed value of 'anchor-point' is 'none' on <var>A</var> and a specific
  31139. point on <var>B</var>
  31140. <dd>
  31141. <p>The anchor point of <var>B</var> is the point given by its 'anchor-point'
  31142. property.
  31143. <p>If the anchor point of <var>B</var> is the center point of <var>B</var>'s
  31144. first box's border box, then <var>A</var>'s anchor point is the center point of its
  31145. first box's margin box.
  31146. <p>Otherwise, <var>A</var>'s anchor point is on one of its margin edges. Consider
  31147. 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
  31148. 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
  31149. by the location of <var>B</var>'s anchor point relative to these four hypothetical
  31150. lines, as follows:
  31151. <p>If the anchor point of <var>B</var> lies on L1 or L2, or inside the area bounded
  31152. by L1 and L2 that also contains the points above <var>B</var>'s first box's border
  31153. box, then let <var>A</var>'s anchor point be the horizontal center of <var>A</var>'s bottom margin edge.</p>
  31154. <p>Otherwise, if the anchor point of <var>B</var> lies on L3 or L4, or inside the
  31155. area bounded by L4 and L4 that also contains the points below <var>B</var>'s first
  31156. box's border box, then let <var>A</var>'s anchor point be the horizontal center of
  31157. <var>A</var>'s top margin edge.</p>
  31158. <p>Otherwise, if the anchor point of <var>B</var> lies inside the area bounded by L4
  31159. and L1 that also contains the points to the left of <var>B</var>'s first box's border
  31160. box, then let <var>A</var>'s anchor point be the vertical center of <var>A</var>'s right margin edge.</p>
  31161. <p>Otherwise, the anchor point of <var>B</var> lies inside the area bounded by L2 and
  31162. L3 that also contains the points to the right of <var>B</var>'s first box's border
  31163. box; let <var>A</var>'s anchor point be the vertical center of <var>A</var>'s left margin edge.</p>
  31164. <dt>If the computed value of 'anchor-point' is a specific point on <var>A</var> and
  31165. 'none' on <var>B</var>
  31166. <dd>
  31167. <p>The anchor point of <var>A</var> is the point given by its 'anchor-point'
  31168. property.
  31169. <p>If the anchor point of <var>A</var> is the center point of <var>A</var>'s
  31170. first box's margin box, then <var>B</var>'s anchor point is the center point of its
  31171. first box's border box.
  31172. <p>Otherwise, <var>B</var>'s anchor point is on one of its border edges. Consider
  31173. 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
  31174. 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
  31175. by the location of <var>A</var>'s anchor point relative to these four hypothetical
  31176. lines, as follows:
  31177. <p>If the anchor point of <var>A</var> lies on L1 or L2, or inside the area bounded
  31178. by L1 and L2 that also contains the points above <var>A</var>'s first box's margin
  31179. box, then let <var>B</var>'s anchor point be the horizontal center of <var>B</var>'s bottom border edge.</p>
  31180. <p>Otherwise, if the anchor point of <var>A</var> lies on L3 or L4, or inside the
  31181. area bounded by L4 and L4 that also contains the points below <var>A</var>'s first
  31182. box's margin box, then let <var>B</var>'s anchor point be the horizontal center of
  31183. <var>B</var>'s top border edge.</p>
  31184. <p>Otherwise, if the anchor point of <var>A</var> lies inside the area bounded by L4
  31185. and L1 that also contains the points to the left of <var>A</var>'s first box's margin
  31186. box, then let <var>B</var>'s anchor point be the vertical center of <var>B</var>'s right border edge.</p>
  31187. <p>Otherwise, the anchor point of <var>A</var> lies inside the area bounded by L2 and
  31188. L3 that also contains the points to the right of <var>A</var>'s first box's margin
  31189. box; let <var>B</var>'s anchor point be the vertical center of <var>B</var>'s left border edge.</p>
  31190. <dt>If the computed value of 'anchor-point' is a specific point on both <var>A</var>
  31191. and <var>B</var>
  31192. <dd>
  31193. <p>The anchor points of <var>A</var> and <var>B</var> are the points given
  31194. by their respective 'anchor-point' properties.
  31195. </dl>
  31196. <p class=note>The rules above generally use <var>A</var>'s <em>margin</em> box, but
  31197. <var>B</var>'s <em>border</em> box. This is because while <var>A</var> always
  31198. has a margin box, and using the margin box allows for the dialog to be positioned offset from
  31199. the box it is annotating, <var>B</var> sometimes does not have a margin box (e.g. if it
  31200. is a table-cell), or has a margin box whose position may be not entirely clear (e.g. in the face
  31201. of margin collapsing and 'clear' handling of in-flow blocks).</p>
  31202. <p>In cases where <var>B</var> does not have a border box but its border box is used by
  31203. the algorithm above, user agents must use its first box's content area instead. (This is in
  31204. particular an issue with boxes in tables that have 'border-collapse' set to 'collapse'.)</p>
  31205. <li>
  31206. <p>When an element's 'position' property computes to '<dfn id=css-position-absolute-anchored>absolute-anchored</dfn>', the 'float' property does not
  31207. apply and must compute to 'none', the 'display' property must compute to a value as described by
  31208. the table in <a href=http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo>the section of CSS
  31209. 2.1 describing the <cite>relationships between 'display', 'position', and 'float'</cite></a>,
  31210. and the element's box must be positioned using the rules for absolute positioning but with its
  31211. static position set such that if the box is positioned in its static position, its anchor point
  31212. 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
  31213. positioned</i>. For the purposes of determining the containing block of other elements, the
  31214. '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-3>absolute-anchored</a>' keyword must be treated
  31215. like the 'absolute' keyword.</p>
  31216. </ul>
  31217. <p class=note>The trivial example of an element that does not have a rendered box is one whose
  31218. 'display' property computes to 'none'. However, there are many other cases; e.g. table columns do
  31219. not have boxes (their properties merely affect other boxes).</p>
  31220. <p class=note>If an element to which another element is anchored changes rendering, the anchored
  31221. element will be be repositioned accordingly. (In other words, the requirements above are live,
  31222. they are not just calculated once per anchored element.)</p>
  31223. <p class=note>The '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-4>absolute-anchored</a>'
  31224. keyword is not a keyword that can be specified in CSS; the 'position' property can only compute to
  31225. 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>
  31226. <p>User agents in visual interactive media should allow the user to pan the viewport to access all
  31227. 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
  31228. viewport and the viewport would otherwise not have a scroll mechanism (e.g. because the viewport's
  31229. 'overflow' property is set to 'hidden').</p>
  31230. <hr>
  31231. <p>The <dfn id=dom-dialog-open><code>open</code></dfn> IDL attribute must
  31232. <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>
  31233. <h5 id=anchor-points>4.11.7.1 Anchor points</h5>
  31234. <p class=critical>This section will eventually be moved to a CSS specification; it is specified
  31235. here only on an interim basis until an editor can be found to own this.</p>
  31236. <table class=css-property><caption>'anchor-point'</caption><tr><th>Value:
  31237. <td> none | &lt;position>
  31238. <tr><th>Initial:
  31239. <td> none
  31240. <tr><th>Applies to:
  31241. <td> all elements
  31242. <tr><th>Inherited:
  31243. <td> no
  31244. <tr><th>Percentages:
  31245. <td> refer to width or height of box; see prose
  31246. <tr><th>Media:
  31247. <td> visual
  31248. <tr><th>Computed value:
  31249. <td> The specified value, but with any lengths replaced by their corresponding absolute length
  31250. <tr><th>Animatable:
  31251. <td> no
  31252. <tr><th>Canonical order:
  31253. <td> per grammar
  31254. </table>
  31255. <p>The 'anchor-point' property specifies a point to which dialog boxes are to be aligned.</p>
  31256. <p>If the value is a &lt;position>, the anchor point is the point given by the value, which
  31257. must be interpreted relative to the element's first rendered box's margin box. Percentages must be
  31258. calculated relative to the element's first rendered box's margin box (specifically, its width for
  31259. the horizontal position and its height for the vertical position). <a href=#refsCSSVALUES>[CSSVALUES]</a> <a href=#refsCSS>[CSS]</a></p>
  31260. <p>If the value is the keyword 'none', then no explicit anchor point is defined. The user agent
  31261. will pick an anchor point automatically if necessary (as described in the definition of the
  31262. <code id=anchor-points:dom-dialog-open><a href=#dom-dialog-open>open()</a></code> method above).</p>
  31263. <h3 id=scripting-3>4.12 Scripting</h3>
  31264. <p>Scripts allow authors to add interactivity to their documents.</p>
  31265. <p>Authors are encouraged to use declarative alternatives to scripting where possible, as
  31266. declarative mechanisms are often more maintainable, and many users disable scripting.</p>
  31267. <div class=example>
  31268. <p>For example, instead of using script to show or hide a section to show more details, the
  31269. <code id=scripting-3:the-details-element><a href=#the-details-element>details</a></code> element could be used.</p>
  31270. </div>
  31271. <p>Authors are also encouraged to make their applications degrade gracefully in the absence of
  31272. scripting support.</p>
  31273. <div class=example>
  31274. <p>For example, if an author provides a link in a table header to dynamically resort the table,
  31275. the link could also be made to function without scripts by requesting the sorted table from the
  31276. server.</p>
  31277. </div>
  31278. <h4 id=the-script-element>4.12.1 The <dfn id=script><code>script</code></dfn> element</h4>
  31279. <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>
  31280. 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
  31281. <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>
  31282. attribute, the element must be either empty or contain only
  31283. <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
  31284. 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>
  31285. <pre class=idl>interface <dfn id=htmlscriptelement>HTMLScriptElement</dfn> : <a href=#htmlelement id=the-script-element:htmlelement>HTMLElement</a> {
  31286. attribute DOMString <a href=#dom-script-src id=the-script-element:dom-script-src>src</a>;
  31287. attribute DOMString <a href=#dom-script-type id=the-script-element:dom-script-type>type</a>;
  31288. attribute DOMString <a href=#dom-script-charset id=the-script-element:dom-script-charset>charset</a>;
  31289. attribute boolean <a href=#dom-script-async id=the-script-element:dom-script-async>async</a>;
  31290. attribute boolean <a href=#dom-script-defer id=the-script-element:dom-script-defer>defer</a>;
  31291. attribute DOMString? <a href=#dom-script-crossorigin id=the-script-element:dom-script-crossorigin>crossOrigin</a>;
  31292. attribute DOMString <a href=#dom-script-text id=the-script-element:dom-script-text>text</a>;
  31293. // <a href="#HTMLScriptElement-partial">also has obsolete members</a>
  31294. };</pre>
  31295. </dl>
  31296. <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
  31297. their documents. The element does not <a href=#represents id=the-script-element:represents>represent</a> content for the
  31298. user.</p>
  31299. <p>When used to include dynamic scripts, the scripts may either be embedded inline or may be
  31300. 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
  31301. 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
  31302. 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
  31303. requirements of that language's specification.</p>
  31304. <p>When used to include data blocks (as opposed to scripts), the data must be embedded inline, the
  31305. 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,
  31306. 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
  31307. 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>
  31308. <p>The <dfn id=attr-script-type><code>type</code></dfn> attribute gives the language of the
  31309. 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
  31310. type</a>. The <code>charset</code> parameter must not be specified. The default, which
  31311. is used if the attribute is absent, is "<code>text/javascript</code>".</p>
  31312. <p>The <dfn id=attr-script-src><code>src</code></dfn> attribute, if specified, gives the
  31313. 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
  31314. non-empty URL potentially surrounded by spaces</a> identifying a script resource of the type
  31315. 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
  31316. of the type "<code>text/javascript</code>", if the attribute is absent. A resource is a
  31317. script resource of a given type if that type identifies a scripting language and the resource
  31318. conforms with the requirements of that language's specification.</p>
  31319. <p>The <dfn id=attr-script-charset><code>charset</code></dfn> attribute gives the character
  31320. 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
  31321. 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
  31322. the <code>charset</code> parameter of the <a href=#content-type id=the-script-element:content-type>Content-Type
  31323. metadata</a> of the external file, if any. <a href=#refsENCODING>[ENCODING]</a></p>
  31324. <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
  31325. 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
  31326. present.</p>
  31327. <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
  31328. 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>
  31329. 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
  31330. present, then the script is executed when the page has finished parsing. If neither attribute is
  31331. present, then the script is fetched and executed immediately, before the user agent continues
  31332. parsing the page.</p>
  31333. <p class=note>The exact processing details for these attributes are, for mostly historical
  31334. reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation
  31335. requirements are therefore by necessity scattered throughout the specification. The algorithms
  31336. below (in this section) describe the core of this processing, but these algorithms reference and
  31337. 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>,
  31338. 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>
  31339. <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
  31340. 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
  31341. is the default.</p>
  31342. <p>The <dfn id=attr-script-crossorigin><code>crossorigin</code></dfn> attribute is a
  31343. <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>
  31344. <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;
  31345. these attribute are only used at specific times described below.</p>
  31346. <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>
  31347. <p>The first is a flag indicating whether or not the script block has been <dfn id=already-started>"already
  31348. 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,
  31349. when created, are not "already started"). The <a href=#concept-node-clone-ext id=the-script-element:concept-node-clone-ext>cloning
  31350. 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
  31351. it is set on the element being cloned.</p>
  31352. <p>The second is a flag indicating whether the element was <dfn id=parser-inserted>"parser-inserted"</dfn>.
  31353. 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
  31354. 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
  31355. affects the processing of those elements.</p>
  31356. <p>The third is a flag indicating whether the element will <dfn id=force-async>"force-async"</dfn>. Initially,
  31357. <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>
  31358. 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
  31359. 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
  31360. <a href=#force-async id=the-script-element:force-async-2>"force-async"</a> flag must be unset.</p>
  31361. <p>The fourth is a flag indicating whether or not the script block is <dfn id=ready-to-be-parser-executed>"ready to be
  31362. 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
  31363. blocks, when created, are not "ready to be parser-executed"). This flag is used only for elements
  31364. 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
  31365. script.</p>
  31366. <p>The last few pieces of state are <dfn id=concept-script-type><var>the script block's
  31367. type</var></dfn>, <dfn id=concept-script-encoding><var>the script block's character
  31368. encoding</var></dfn>, and <dfn id=concept-script-fallback-encoding><var>the script block's
  31369. fallback character encoding</var></dfn>. They are determined when the script is prepared, based on
  31370. the attributes on the element at that time, and the
  31371. <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>
  31372. <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>
  31373. experiences one of the events listed in the following list, the user agent must synchronously
  31374. <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>
  31375. <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
  31376. into a document</a>, at the time the <a href=#nodes-are-inserted id=the-script-element:nodes-are-inserted>node is inserted</a>
  31377. 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
  31378. 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
  31379. document fragment is <a href=#nodes-are-inserted id=the-script-element:nodes-are-inserted-2>inserted</a> into the
  31380. <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
  31381. attribute.</ul>
  31382. <p>To <dfn id=prepare-a-script>prepare a script</dfn>, the user agent must act as
  31383. follows:</p>
  31384. <ol><li>
  31385. <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
  31386. the user agent must abort these steps at this point. The script is not executed.</p>
  31387. <li>
  31388. <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
  31389. <a href=#parser-inserted id=the-script-element:parser-inserted-4>"parser-inserted"</a> flag. Otherwise, set <var>was-parser-inserted</var> to
  31390. false.</p>
  31391. <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
  31392. when the parser tries to run them, e.g. because they are empty or specify an unsupported
  31393. scripting language, another script can later mutate them and cause them to run again.</p>
  31394. <li>
  31395. <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
  31396. <a href=#force-async id=the-script-element:force-async-3>"force-async"</a> flag to true.</p>
  31397. <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
  31398. run when the parser tries to run it, but it is later executed after a script dynamically updates
  31399. 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>
  31400. attribute isn't set.</p>
  31401. <li id=script-processing-empty>
  31402. <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
  31403. 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
  31404. agent must abort these steps at this point. The script is not executed.</p>
  31405. <li>
  31406. <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
  31407. these steps at this point. The script is not executed.</p>
  31408. <li id=script-processing-prepare>
  31409. <p>If either:</p>
  31410. <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
  31411. 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
  31412. 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>
  31413. 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>
  31414. attribute nor a <code id=the-script-element:attr-script-language-2><a href=#attr-script-language>language</a></code> attribute, then</ul>
  31415. <p>...let <var id=the-script-element:concept-script-type><a href=#concept-script-type>the script block's type</a></var> for this
  31416. <code id=the-script-element:the-script-element-29><a href=#the-script-element>script</a></code> element be "<code>text/javascript</code>".</p>
  31417. <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
  31418. 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
  31419. with any leading or trailing sequences of <a href=#space-character id=the-script-element:space-character>space characters</a>
  31420. removed.</p>
  31421. <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>
  31422. 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
  31423. <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>"
  31424. 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>
  31425. <p class=note>The <code id=the-script-element:attr-script-language-5><a href=#attr-script-language>language</a></code> attribute is never
  31426. 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>
  31427. attribute present.</p>
  31428. <li>
  31429. <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,
  31430. then the user agent must abort these steps at this point. The script is not executed.</p>
  31431. <li>
  31432. <p>If <var>was-parser-inserted</var> is true, then flag the element as
  31433. <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
  31434. false.</p>
  31435. <li id=script-processing-start>
  31436. <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>
  31437. <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>
  31438. <li>
  31439. <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
  31440. <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,
  31441. then abort these steps.</p>
  31442. <li id=script-processing-noscript>
  31443. <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>
  31444. element, then the user agent must abort these steps at this point. The script is not
  31445. executed.</p>
  31446. <p class=note>The definition of <a href=#concept-n-noscript id=the-script-element:concept-n-noscript-2>scripting is disabled</a>
  31447. means that, amongst others, the following scripts will not execute: scripts in
  31448. <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>
  31449. 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
  31450. <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
  31451. 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
  31452. <code id=the-script-element:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> API. <a href=#refsXHR>[XHR]</a>
  31453. <a href=#refsDOMPARSING>[DOMPARSING]</a> <a href=#refsDOM>[DOM]</a></p>
  31454. <li id=script-processing-for>
  31455. <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>
  31456. 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>
  31457. <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>
  31458. 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
  31459. <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
  31460. string "<code>window</code>", then the user agent must abort these steps at this
  31461. 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
  31462. 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
  31463. is not executed.</ol>
  31464. <li id=script-processing-encoding>
  31465. <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>
  31466. attribute, then let <var id=the-script-element:concept-script-encoding><a href=#concept-script-encoding>the script block's character
  31467. 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
  31468. encoding</a> from the value of the <code id=the-script-element:attr-script-charset-4><a href=#attr-script-charset>charset</a></code>
  31469. attribute.</p>
  31470. <p>Otherwise, let <var id=the-script-element:concept-script-fallback-encoding><a href=#concept-script-fallback-encoding>the script block's fallback
  31471. 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>
  31472. <p class=note>Only one of these two pieces of state is set.</p>
  31473. <li id=script-processing-src-prepare>
  31474. <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
  31475. substeps:</p>
  31476. <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
  31477. a simple event</a> named <code id=the-script-element:event-error><a href=#event-error>error</a></code> at the element, and abort
  31478. these steps.<li><p><a href=#resolve-a-url id=the-script-element:resolve-a-url>Resolve</a> <var>src</var> relative to the
  31479. 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
  31480. event</a> named <code id=the-script-element:event-error-2><a href=#event-error>error</a></code> at the element, and abort these
  31481. steps.<li>
  31482. <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
  31483. <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
  31484. 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
  31485. <i>default origin behaviour</i> set to <i>taint</i>.</p>
  31486. <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
  31487. <a href=#cors-cross-origin id=the-script-element:cors-cross-origin>CORS-cross-origin</a>. This only affects how error reporting happens.</p>
  31488. <p>For performance reasons, user agents may start fetching the script (as defined above) as
  31489. 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
  31490. 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
  31491. 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
  31492. step. If the UA performs such prefetching, but the element is never inserted in the document,
  31493. 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
  31494. user agent will not execute the script so obtained, and the fetching process will have been
  31495. effectively wasted.</p>
  31496. </ol>
  31497. <li>
  31498. <p>Then, the first of the following options that describes the situation must be followed:</p>
  31499. <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>
  31500. 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
  31501. 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
  31502. an <code id=the-script-element:attr-script-async-11><a href=#attr-script-async>async</a></code> attribute<dd>
  31503. <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
  31504. document has finished parsing</dfn> associated with the <code id=the-script-element:document-4><a href=#document>Document</a></code> of the parser
  31505. that created the element.</p>
  31506. <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>
  31507. 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>
  31508. 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
  31509. parser will handle executing the script.</p>
  31510. <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
  31511. <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>
  31512. <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
  31513. <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
  31514. script per <code id=the-script-element:document-6><a href=#document>Document</a></code> at a time.)</p>
  31515. <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>
  31516. 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>
  31517. 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
  31518. parser will handle executing the script.</p>
  31519. <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
  31520. <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
  31521. 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
  31522. 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
  31523. 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
  31524. a style sheet that is blocking scripts</a><dd>
  31525. <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
  31526. <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
  31527. script per <code id=the-script-element:document-9><a href=#document>Document</a></code> at a time.)</p>
  31528. <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
  31529. executing the script.</p>
  31530. <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
  31531. <a href=#force-async id=the-script-element:force-async-5>"force-async"</a> flag set<dd>
  31532. <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
  31533. 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>
  31534. 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>
  31535. <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>
  31536. 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>
  31537. has completed must run the following steps:</p>
  31538. <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
  31539. execute in order as soon as possible</a> to which it was added above, then mark the
  31540. 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
  31541. 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
  31542. 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
  31543. 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
  31544. still not empty and the first entry has already been marked as ready, then jump back to the
  31545. step labeled <i>execution</i>.</ol>
  31546. <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>
  31547. attribute<dd>
  31548. <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
  31549. 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
  31550. <a href=#prepare-a-script id=the-script-element:prepare-a-script-3>prepare a script</a> algorithm started.</p>
  31551. <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>
  31552. 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>
  31553. 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
  31554. <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>
  31555. <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
  31556. scripts are already executing.</dl>
  31557. </ol>
  31558. <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>
  31559. 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>
  31560. 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>
  31561. <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
  31562. <code id=the-script-element:document-11><a href=#document>Document</a></code>'s parser(s).</p>
  31563. <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
  31564. <code id=the-script-element:document-12><a href=#document>Document</a></code> before it would normally have stopped blocking that parser, it nonetheless
  31565. continues blocking that parser until the condition that causes it to be blocking the parser no
  31566. 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
  31567. 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
  31568. 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
  31569. parser until the style sheets are all loaded, at which time the script executes and the parser is
  31570. unblocked).</p>
  31571. <p>When the user agent is required to <dfn id=execute-the-script-block>execute a script
  31572. block</dfn>, it must run the following steps:</p>
  31573. <ol><li>
  31574. <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
  31575. <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,
  31576. then abort these steps.</p>
  31577. <li>
  31578. <p>Jump to the appropriate set of steps from the list below:</p>
  31579. <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
  31580. 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>
  31581. <p>Executing the script block must consist of running the following steps. For the purposes of
  31582. these steps, the script is considered to be from an <i>external file</i> if, while the
  31583. <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
  31584. <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
  31585. specified.</p>
  31586. <ol><li id=establish-script-block-source>
  31587. <p>Initialise <dfn id=concept-script-source><var>the script block's source</var></dfn>
  31588. as follows:</p>
  31589. <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
  31590. block's type</a></var> is a text-based language<dd>
  31591. <p>The contents of that file, interpreted as a Unicode string, are the script source.</p>
  31592. <p>To obtain the Unicode string, the user agent run the following steps:</p>
  31593. <ol><li><p>If the resource's <a href=#content-type id=the-script-element:content-type-2>Content Type metadata</a>, if any,
  31594. 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
  31595. 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
  31596. block's character encoding</a></var>, then let <var>character encoding</var> be
  31597. 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
  31598. encoding</a></var>.<li>
  31599. <p>If the specification for <var id=the-script-element:concept-script-type-6><a href=#concept-script-type>the script block's
  31600. type</a></var> gives specific rules for decoding files in that format to Unicode, follow
  31601. them, using <var>character encoding</var> as the character encoding specified by
  31602. higher-level protocols, if necessary.</p>
  31603. <p>Otherwise, <a href=#decode id=the-script-element:decode>decode</a> the file to Unicode, using <var>character
  31604. encoding</var> as the fallback encoding.</p>
  31605. <p class=note>The <a href=#decode id=the-script-element:decode-2>decode</a> algorithm overrides <var>character
  31606. encoding</var> if the file contains a BOM.</p>
  31607. </ol>
  31608. <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
  31609. block's type</a></var> is an XML-based language<dd>
  31610. <p>The external file is the script source. When it is later executed, it must be
  31611. interpreted in a manner consistent with the specification defining the language given by
  31612. <var id=the-script-element:concept-script-type-8><a href=#concept-script-type>the script block's type</a></var>.</p>
  31613. <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
  31614. type</a></var> is a text-based language<dd>
  31615. <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
  31616. 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>
  31617. <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
  31618. type</a></var> is an XML-based language<dd>
  31619. <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
  31620. <a href=#already-started id=the-script-element:already-started-4>"already started"</a> flag was last set are the script source.</p>
  31621. </dl>
  31622. <li>
  31623. <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
  31624. at the <code id=the-script-element:the-script-element-47><a href=#the-script-element>script</a></code> element.</p>
  31625. <p>If the event is canceled, then abort these steps.</p>
  31626. <li>
  31627. <p>If the script is from an external file, then increment the
  31628. <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
  31629. <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
  31630. <code id=the-script-element:document-15><a href=#document>Document</a></code>.</p>
  31631. <li>
  31632. <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>
  31633. 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
  31634. initialized.</p>
  31635. <li>
  31636. <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>
  31637. element.</p>
  31638. <li>
  31639. <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
  31640. 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
  31641. 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
  31642. <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>
  31643. <p>If the script came from a resource that was <a href=#fetch id=the-script-element:fetch-6>fetched</a> in the
  31644. 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>
  31645. <p class=note>This is where the script is compiled and actually executed.</p>
  31646. <li>
  31647. <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
  31648. element</var>.</p>
  31649. <li>
  31650. <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>
  31651. <li>
  31652. <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
  31653. cancelable) at the <code id=the-script-element:the-script-element-54><a href=#the-script-element>script</a></code> element.</p>
  31654. <li>
  31655. <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>
  31656. <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
  31657. 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>
  31658. element.</p>
  31659. </ol>
  31660. </dl>
  31661. </ol>
  31662. <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
  31663. content attributes of the same name.</p>
  31664. <p>The <dfn id=dom-script-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
  31665. <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>
  31666. <p>The <dfn id=dom-script-async><code>async</code></dfn> IDL attribute controls whether the
  31667. 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
  31668. 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
  31669. 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
  31670. content attribute must be removed if the IDL attribute's new value is false, and must be set to
  31671. the empty string if the IDL attribute's new value is true. If the element's
  31672. <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>
  31673. the <code id=the-script-element:attr-script-async-14><a href=#attr-script-async>async</a></code> content attribute.</p>
  31674. <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>
  31675. <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>
  31676. nodes.</p>
  31677. <p>Can be set, to replace the element's children with the given value.</p>
  31678. </dl>
  31679. <p>The IDL attribute <dfn id=dom-script-text><code>text</code></dfn> must return a
  31680. 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
  31681. <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
  31682. 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>
  31683. <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>
  31684. 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
  31685. <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>
  31686. attributes, they do not execute at all.</p>
  31687. <div class=example>
  31688. <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
  31689. the other includes some data.</p>
  31690. <pre>&lt;script src="game-engine.js">&lt;/script>
  31691. &lt;script type="text/x-game-map">
  31692. ........U.........e
  31693. o............A....e
  31694. .....A.....AAA....e
  31695. .A..AAA...AAAAA...e
  31696. &lt;/script></pre>
  31697. <p>The data in this case might be used by the script to generate the map of a video game. The
  31698. data doesn't have to be used that way, though; maybe the map data is actually embedded in other
  31699. parts of the page's markup, and the data block here is just used by the site's search engine to
  31700. help users who are looking for particular features in their game maps.</p>
  31701. </div>
  31702. <div class=example>
  31703. <p>The following sample shows how a script element can be used to define a function that is then
  31704. 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
  31705. to invoke script while the document is being parsed, in this case to initialise the form's
  31706. output.</p>
  31707. <pre>&lt;script>
  31708. function calculate(form) {
  31709. var price = 52000;
  31710. if (form.elements.brakes.checked)
  31711. price += 1000;
  31712. if (form.elements.radio.checked)
  31713. price += 2500;
  31714. if (form.elements.turbo.checked)
  31715. price += 5000;
  31716. if (form.elements.sticker.checked)
  31717. price += 250;
  31718. form.elements.result.value = price;
  31719. }
  31720. &lt;/script>
  31721. &lt;form name="pricecalc" onsubmit="return false" onchange="calculate(this)">
  31722. &lt;fieldset>
  31723. &lt;legend>Work out the price of your car&lt;/legend>
  31724. &lt;p>Base cost: £52000.&lt;/p>
  31725. &lt;p>Select additional options:&lt;/p>
  31726. &lt;ul>
  31727. &lt;li>&lt;label>&lt;input type=checkbox name=brakes> Ceramic brakes (£1000)&lt;/label>&lt;/li>
  31728. &lt;li>&lt;label>&lt;input type=checkbox name=radio> Satellite radio (£2500)&lt;/label>&lt;/li>
  31729. &lt;li>&lt;label>&lt;input type=checkbox name=turbo> Turbo charger (£5000)&lt;/label>&lt;/li>
  31730. &lt;li>&lt;label>&lt;input type=checkbox name=sticker> "XZ" sticker (£250)&lt;/label>&lt;/li>
  31731. &lt;/ul>
  31732. &lt;p>Total: £&lt;output name=result>&lt;/output>&lt;/p>
  31733. &lt;/fieldset>
  31734. &lt;script>
  31735. calculate(document.forms.pricecalc);
  31736. &lt;/script>
  31737. &lt;/form></pre>
  31738. </div>
  31739. <h5 id=scriptingLanguages>4.12.1.1 Scripting languages</h5>
  31740. <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
  31741. case-insensitive</a> match for the corresponding component in the <a href=#mime-type id=scriptingLanguages:mime-type>MIME type</a> string
  31742. of a scripting language that the user agent implements.</p>
  31743. <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
  31744. languages to which they refer:</p>
  31745. <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>
  31746. <p>User agents may support other <a href=#mime-type id=scriptingLanguages:mime-type-3>MIME types</a> for other languages,
  31747. but must not support other <a href=#mime-type id=scriptingLanguages:mime-type-4>MIME types</a> for the languages in the list
  31748. above. User agents are not required to support the languages listed above.</p>
  31749. <p>The following <a href=#mime-type id=scriptingLanguages:mime-type-5>MIME types</a> (with or without parameters) must not
  31750. be interpreted as scripting languages:</p>
  31751. <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>
  31752. <li><code id=scriptingLanguages:text/xml><a href=#text/xml>text/xml</a></code>
  31753. <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>
  31754. <li><code id=scriptingLanguages:application/xml><a href=#application/xml>application/xml</a></code>
  31755. </ul>
  31756. <p class=note>These types are explicitly listed here because they are poorly-defined types that
  31757. are nonetheless likely to be used as formats for data blocks, and it would be problematic if they
  31758. were suddenly to be interpreted as script by a user agent.</p>
  31759. <p>When examining types to determine if they represent supported languages, user agents must not
  31760. ignore MIME parameters. Types are to be compared including all parameters.</p>
  31761. <p class=note>For example, types that include the <code>charset</code> parameter will
  31762. not be recognised as referencing any of the scripting languages listed above.</p>
  31763. <h5 id=restrictions-for-contents-of-script-elements>4.12.1.2 <dfn>Restrictions for contents of <code>script</code> elements</dfn></h5>
  31764. <p class=note>The easiest and safest way to avoid the rather strange restrictions described in
  31765. this section is to always escape "<code>&lt;!--</code>" as "<code>&lt;\!--</code>", "<code>&lt;script</code>" as "<code>&lt;\script</code>", and "<code>&lt;/script</code>" as "<code>&lt;\/script</code>" when these sequences appear in literals in scripts (e.g. in
  31766. strings, regular expressions, or comments), and to avoid writing code that uses such constructs in
  31767. expressions. Doing so avoids the pitfalls that the restrictions in this section are prone to
  31768. 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
  31769. a strange and exotic practice that acts unintuitively in the face of these sequences.</p>
  31770. <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.
  31771. <a href=#refsABNF>[ABNF]</a></p>
  31772. <pre>script = outer *( comment-open inner comment-close outer )
  31773. outer = &lt; any string that doesn't contain a substring that matches not-in-outer >
  31774. not-in-outer = comment-open
  31775. inner = &lt; any string that doesn't contain a substring that matches not-in-inner >
  31776. not-in-inner = comment-close / script-open
  31777. comment-open = "&lt;!--"
  31778. comment-close = "-->"
  31779. script-open = "&lt;" s c r i p t tag-end
  31780. s = %x0053 ; U+0053 LATIN CAPITAL LETTER S
  31781. s =/ %x0073 ; U+0073 LATIN SMALL LETTER S
  31782. c = %x0043 ; U+0043 LATIN CAPITAL LETTER C
  31783. c =/ %x0063 ; U+0063 LATIN SMALL LETTER C
  31784. r = %x0052 ; U+0052 LATIN CAPITAL LETTER R
  31785. r =/ %x0072 ; U+0072 LATIN SMALL LETTER R
  31786. i = %x0049 ; U+0049 LATIN CAPITAL LETTER I
  31787. i =/ %x0069 ; U+0069 LATIN SMALL LETTER I
  31788. p = %x0050 ; U+0050 LATIN CAPITAL LETTER P
  31789. p =/ %x0070 ; U+0070 LATIN SMALL LETTER P
  31790. t = %x0054 ; U+0054 LATIN CAPITAL LETTER T
  31791. t =/ %x0074 ; U+0074 LATIN SMALL LETTER T
  31792. tag-end = %x0009 ; U+0009 CHARACTER TABULATION (tab)
  31793. tag-end =/ %x000A ; U+000A LINE FEED (LF)
  31794. tag-end =/ %x000C ; U+000C FORM FEED (FF)
  31795. tag-end =/ %x0020 ; U+0020 SPACE
  31796. tag-end =/ %x002F ; U+002F SOLIDUS (/)
  31797. tag-end =/ %x003E ; U+003E GREATER-THAN SIGN (>)</pre>
  31798. <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
  31799. further restrictions on the contents of the element, as described in the section below.</p>
  31800. <div class=example>
  31801. <p>The following script illustrates this issue. Suppose you have a script that contains a string,
  31802. as in:</p>
  31803. <pre>var example = 'Consider this string: &lt;!-- &lt;script>';
  31804. console.log(example);</pre>
  31805. <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
  31806. restrictions above:</p>
  31807. <pre>&lt;script>
  31808. var example = 'Consider this string: &lt;!-- &lt;script>';
  31809. console.log(example);
  31810. &lt;/script></pre>
  31811. <p>The bigger problem, though, and the reason why it would violate those restrictions, is that
  31812. actually the script would get parsed weirdly: <em>the script block above is not terminated</em>.
  31813. That is, what looks like a "<code>&lt;/script></code>" end tag in this snippet is
  31814. 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
  31815. terminated); if it somehow were to execute, as it might if the markup looked as follows, it would
  31816. fail because the script (highlighted here) is not valid JavaScript:</p>
  31817. <pre>&lt;script><mark>
  31818. var example = 'Consider this string: &lt;!-- &lt;script>';
  31819. console.log(example);
  31820. &lt;/script>
  31821. &lt;!-- despite appearances, this is actually part of the script still! -->
  31822. &lt;script>
  31823. ... // this is the same script block still...
  31824. </mark>&lt;/script></pre>
  31825. <p>What is going on here is that for legacy reasons, "<code>&lt;!--</code>" and "<code>&lt;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
  31826. in order for the parser to consider closing the block.</p>
  31827. <p>By escaping the problematic strings as mentioned at the top of this section, the problem is
  31828. avoided entirely:</p>
  31829. <pre>&lt;script><mark>
  31830. var example = 'Consider this string: &lt;\!-- &lt;\script>';
  31831. console.log(example);
  31832. </mark>&lt;/script>
  31833. &lt;!-- this is just a comment between script blocks -->
  31834. &lt;script><mark>
  31835. ... // this is a new script block
  31836. </mark>&lt;/script></pre>
  31837. <p>It is possible for these sequences to naturally occur in script expressions, as in the
  31838. following examples:</p>
  31839. <pre>if (x&lt;!--y) { ... }
  31840. if ( player&lt;script ) { ... }</pre>
  31841. <p>In such cases the characters cannot be escaped, but the expressions can be rewritten so that
  31842. the sequences don't occur, as in:</p>
  31843. <pre>if (x &lt; !--y) { ... }
  31844. if (!--y > x) { ... }
  31845. if (!(--y) > x) { ... }
  31846. if (player &lt; script) { ... }
  31847. if (script > player) { ... }</pre>
  31848. <p>Doing this also avoids a different pitfall as well: for related historical reasons, the string
  31849. "&lt;!--" in JavaScript is actually treated as a line comment start, just like "//".</p>
  31850. </div>
  31851. <h5 id=inline-documentation-for-external-scripts>4.12.1.3 <dfn>Inline documentation for external scripts</dfn></h5>
  31852. <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
  31853. 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
  31854. 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
  31855. element's contents, matches the <code>documentation</code> production in the following
  31856. ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
  31857. <pre>documentation = *( *( space / tab / comment ) [ line-comment ] newline )
  31858. comment = slash star *( not-star / star not-slash ) 1*star slash
  31859. line-comment = slash slash *not-newline
  31860. ; characters
  31861. tab = %x0009 ; U+0009 CHARACTER TABULATION (tab)
  31862. newline = %x000A ; U+000A LINE FEED (LF)
  31863. space = %x0020 ; U+0020 SPACE
  31864. star = %x002A ; U+002A ASTERISK (*)
  31865. slash = %x002F ; U+002F SOLIDUS (/)
  31866. not-newline = %x0000-0009 / %x000B-10FFFF
  31867. ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character>Unicode character</a> other than U+000A LINE FEED (LF)
  31868. not-star = %x0000-0029 / %x002B-10FFFF
  31869. ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character-2>Unicode character</a> other than U+002A ASTERISK (*)
  31870. not-slash = %x0000-002E / %x0030-10FFFF
  31871. ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character-3>Unicode character</a> other than U+002F SOLIDUS (/)</pre>
  31872. <p class=note>This corresponds to putting the contents of the element in JavaScript
  31873. comments.</p>
  31874. <p class=note>This requirement is in addition to the earlier restrictions on the syntax of
  31875. contents of <code id=inline-documentation-for-external-scripts:the-script-element-3><a href=#the-script-element>script</a></code> elements.</p>
  31876. <div class=example>
  31877. <p>This allows authors to include documentation, such as license information or API information,
  31878. inside their documents while still referring to external script files. The syntax is constrained
  31879. so that authors don't accidentally include what looks like valid script while also providing a
  31880. <code id=inline-documentation-for-external-scripts:attr-script-src-2><a href=#attr-script-src>src</a></code> attribute.</p>
  31881. <pre>&lt;script src="cool-effects.js">
  31882. // create new instances using:
  31883. // var e = new Effect();
  31884. // start the effect using .play, stop using .stop:
  31885. // e.play();
  31886. // e.stop();
  31887. &lt;/script></pre>
  31888. </div>
  31889. <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>
  31890. <p><i>This section is non-normative.</i></p>
  31891. <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.
  31892. However, in the absence of another specification actually defining this, here are some guidelines
  31893. for implementors, based on existing implementations:</p>
  31894. <ul><li><p>When an XSLT transformation program is triggered by an <code>&lt;?xml-stylesheet?></code> processing instruction and the browser implements a
  31895. 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
  31896. 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>),
  31897. 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
  31898. 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,
  31899. 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
  31900. 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
  31901. (<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>
  31902. 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
  31903. needs to create a fragment that is equivalent to one built manually by creating the elements
  31904. using <code id=scriptTagXSLT:dom-document-createelementns><a href=#dom-document-createelementns>document.createElementNS()</a></code>. For instance,
  31905. 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
  31906. 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
  31907. fragment is inserted into a document.</ul>
  31908. <p>The main distinction between the first two cases and the last case is that the first two
  31909. operate on <code id=scriptTagXSLT:document-2><a href=#document>Document</a></code>s and the last operates on a fragment.</p>
  31910. <h4 id=the-noscript-element>4.12.2 The <dfn><code>noscript</code></dfn> element</h4>
  31911. <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>
  31912. <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
  31913. <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript-3>scripting is disabled</a>. It is used to present different
  31914. markup to user agents that support scripting and those that don't support scripting, by affecting
  31915. how the document is parsed.</p>
  31916. <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>
  31917. <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
  31918. 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>,
  31919. 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>
  31920. 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
  31921. <a href=#html-fragment-parsing-algorithm id=the-noscript-element:html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a> with
  31922. 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>
  31923. element and the text contents as the <var>input</var> must result in a list of nodes
  31924. 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
  31925. 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
  31926. 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
  31927. 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>
  31928. 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
  31929. enabled</a> for the <code id=the-noscript-element:the-noscript-element-16><a href=#the-noscript-element>noscript</a></code> element<dd>
  31930. <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
  31931. that running the following algorithm results in a conforming document with no
  31932. <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
  31933. 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
  31934. error</a>:</p>
  31935. <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
  31936. <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:
  31937. <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
  31938. 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
  31939. <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
  31940. 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>
  31941. </ol>
  31942. </dl>
  31943. <p class=note>All these contortions are required because, for historical reasons, the
  31944. <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
  31945. whether <a href=#scripting-flag id=the-noscript-element:scripting-flag>scripting was enabled or not</a> when the parser was
  31946. invoked.</p>
  31947. <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>
  31948. <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
  31949. 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
  31950. is by essentially "turning off" the parser when scripts are enabled, so that the contents of the
  31951. element are treated as pure text and not as real elements. XML does not define a mechanism by
  31952. which to do this.</p>
  31953. <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
  31954. <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
  31955. forth, even when <a href=#concept-n-script id=the-noscript-element:concept-n-script-4>scripting is enabled</a> for the element.</p>
  31956. <div class=example>
  31957. <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
  31958. used to provide fallback for a script.</p>
  31959. <pre>&lt;form action="calcSquare.php">
  31960. &lt;p>
  31961. &lt;label for=x>Number&lt;/label>:
  31962. &lt;input id="x" name="x" type="number">
  31963. &lt;/p>
  31964. &lt;script>
  31965. var x = document.getElementById('x');
  31966. var output = document.createElement('p');
  31967. output.textContent = 'Type a number; it will be squared right then!';
  31968. x.form.appendChild(output);
  31969. x.form.onsubmit = function () { return false; }
  31970. x.oninput = function () {
  31971. var v = x.valueAsNumber;
  31972. output.textContent = v + ' squared is ' + v * v;
  31973. };
  31974. &lt;/script>
  31975. &lt;noscript>
  31976. &lt;input type=submit value="Calculate Square">
  31977. &lt;/noscript>
  31978. &lt;/form></pre>
  31979. <p>When script is disabled, a button appears to do the calculation on the server side. When
  31980. script is enabled, the value is computed on-the-fly instead.</p>
  31981. <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,
  31982. but for some reason the page's script might fail. For this reason, it's generally better to avoid
  31983. 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
  31984. scriptless page to a scripted page on the fly, as in the next example:</p>
  31985. <pre>&lt;form action="calcSquare.php">
  31986. &lt;p>
  31987. &lt;label for=x>Number&lt;/label>:
  31988. &lt;input id="x" name="x" type="number">
  31989. &lt;/p>
  31990. <strong>&lt;input id="submit" type=submit value="Calculate Square"></strong>
  31991. &lt;script>
  31992. var x = document.getElementById('x');
  31993. var output = document.createElement('p');
  31994. output.textContent = 'Type a number; it will be squared right then!';
  31995. x.form.appendChild(output);
  31996. x.form.onsubmit = function () { return false; }
  31997. x.oninput = function () {
  31998. var v = x.valueAsNumber;
  31999. output.textContent = v + ' squared is ' + v * v;
  32000. };
  32001. <strong> var submit = document.getElementById('submit');
  32002. submit.parentNode.removeChild(submit);</strong>
  32003. &lt;/script>
  32004. &lt;/form></pre>
  32005. <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
  32006. <a href=#the-xhtml-syntax id=the-noscript-element:the-xhtml-syntax-2>the XHTML syntax</a>.</p>
  32007. </div>
  32008. <h4 id=the-template-element>4.12.3 The <dfn><code>template</code></dfn> element</h4>
  32009. <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>
  32010. <pre class=idl>interface <dfn id=htmltemplateelement>HTMLTemplateElement</dfn> : <a href=#htmlelement id=the-template-element:htmlelement>HTMLElement</a> {
  32011. 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>;
  32012. };</pre>
  32013. </dl>
  32014. <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
  32015. inserted in the document by script.</p>
  32016. <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>
  32017. <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>
  32018. <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
  32019. <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
  32020. 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
  32021. example, this avoids form controls from being submitted, scripts from executing, and so
  32022. forth.)</p>
  32023. </dl>
  32024. <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
  32025. 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
  32026. agent must run the following steps to establish the <a href=#template-contents id=the-template-element:template-contents>template contents</a>:</p>
  32027. <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
  32028. 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
  32029. created <code id=the-template-element:documentfragment-5><a href=#documentfragment>DocumentFragment</a></code> object.</ol>
  32030. <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
  32031. document</dfn> is the <code id=the-template-element:document-4><a href=#document>Document</a></code> returned by the following algorithm:</p>
  32032. <ol><li>
  32033. <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
  32034. these substeps:</p>
  32035. <ol><li>
  32036. <p>If <var>doc</var> does not yet have an <dfn id=associated-inert-template-document>associated inert template
  32037. document</dfn> then run these substeps:</p>
  32038. <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
  32039. <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"
  32040. 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
  32041. <var>new doc</var> as an <a href=#html-documents id=the-template-element:html-documents-2>HTML document</a>
  32042. 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>
  32043. <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
  32044. template document</a>.</ol>
  32045. <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
  32046. <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
  32047. 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
  32048. 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
  32049. <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
  32050. <code id=the-template-element:document-11><a href=#document>Document</a></code> owner for their contents.</p>
  32051. <li><p>Return <var>doc</var>.</ol>
  32052. <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
  32053. steps:</p>
  32054. <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
  32055. 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
  32056. <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>
  32057. <p>The <dfn id=dom-template-content><code>content</code></dfn> IDL attribute must return the
  32058. <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>
  32059. <hr>
  32060. <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>
  32061. element <var>node</var> being cloned to a copy <var>copy</var> must run the
  32062. following steps:</p>
  32063. <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
  32064. <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
  32065. document</a>, and with the <var>clone children
  32066. 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
  32067. contents</a>.</ol>
  32068. <div class=example>
  32069. <p>In this example, a script populates a table four-column with data from a data structure, using
  32070. 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
  32071. structure from markup.</p>
  32072. <pre>&lt;!DOCTYPE html>
  32073. &lt;title>Cat data&lt;/title>
  32074. &lt;script>
  32075. // Data is hard-coded here, but could come from the server
  32076. var data = [
  32077. { name: 'Pillar', color: 'Ticked Tabby', sex: 'Female (neutered)', legs: 3 },
  32078. { name: 'Hedral', color: 'Tuxedo', sex: 'Male (neutered)', legs: 4 },
  32079. ];
  32080. &lt;/script>
  32081. &lt;table>
  32082. &lt;thead>
  32083. &lt;tr>
  32084. &lt;th>Name &lt;th>Colour &lt;th>Sex &lt;th>Legs
  32085. &lt;tbody>
  32086. &lt;template id="row">
  32087. &lt;tr>&lt;td>&lt;td>&lt;td>&lt;td>
  32088. &lt;/template>
  32089. &lt;/table>
  32090. &lt;script>
  32091. var template = document.querySelector('#row');
  32092. for (var i = 0; i &lt; data.length; i += 1) {
  32093. var cat = data[i];
  32094. var clone = template.content.cloneNode(true);
  32095. var cells = clone.querySelectorAll('td');
  32096. cells[0].textContent = cat.name;
  32097. cells[1].textContent = cat.color;
  32098. cells[2].textContent = cat.sex;
  32099. cells[3].textContent = cat.legs;
  32100. template.parentNode.appendChild(clone);
  32101. }
  32102. &lt;/script></pre>
  32103. </div>
  32104. <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>
  32105. <p><i>This section is non-normative.</i></p>
  32106. <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>
  32107. element. However, in the absence of another specification actually defining this, here are some
  32108. guidelines for implementors, which are intended to be consistent with other processing described
  32109. in this specification:</p>
  32110. <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
  32111. 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
  32112. 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
  32113. <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
  32114. 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
  32115. 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
  32116. needs to ignore <a href=#template-contents id=template-XSLT-XPath:template-contents-3>template contents</a>.</p>
  32117. </ul>
  32118. <h4 id=the-canvas-element>4.12.4 The <dfn id=canvas><code>canvas</code></dfn> element</h4>
  32119. <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>
  32120. <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>;
  32121. interface <dfn id=htmlcanvaselement>HTMLCanvasElement</dfn> : <a href=#htmlelement id=the-canvas-element:htmlelement>HTMLElement</a> {
  32122. attribute unsigned long <a href=#dom-canvas-width id=the-canvas-element:dom-canvas-width>width</a>;
  32123. attribute unsigned long <a href=#dom-canvas-height id=the-canvas-element:dom-canvas-height>height</a>;
  32124. <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);
  32125. boolean <a href=#dom-canvas-probablysupportscontext id=the-canvas-element:dom-canvas-probablysupportscontext>probablySupportsContext</a>(DOMString contextId, any... arguments);
  32126. 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);
  32127. <a href=#canvasproxy id=the-canvas-element:canvasproxy>CanvasProxy</a> <a href=#dom-canvas-transfercontroltoproxy id=the-canvas-element:dom-canvas-transfercontroltoproxy>transferControlToProxy</a>();
  32128. DOMString <a href=#dom-canvas-todataurl id=the-canvas-element:dom-canvas-todataurl>toDataURL</a>(optional DOMString type, any... arguments);
  32129. 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);
  32130. };</pre>
  32131. </dl>
  32132. <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,
  32133. which can be used for rendering graphs, game graphics, art, or other visual images on the fly.</p>
  32134. <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
  32135. 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
  32136. render a page heading: if the desired presentation of the heading is graphically intense, it
  32137. 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
  32138. CSS and supporting technologies such as Web Components.</p>
  32139. <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
  32140. presented to the user, conveys essentially the same function or purpose as the
  32141. <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>
  32142. 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
  32143. content</a>.</p>
  32144. <hr>
  32145. <p>In interactive visual media, if <a href=#concept-n-script id=the-canvas-element:concept-n-script>scripting is enabled</a> for
  32146. 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,
  32147. 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
  32148. of a dynamically created image, the element's bitmap.</p>
  32149. <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
  32150. previously associated with a rendering context (e.g. if the page was viewed in an interactive
  32151. visual medium and is now being printed, or if some script that ran during the page layout process
  32152. 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>
  32153. <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
  32154. represents its <a href=#fallback-content id=the-canvas-element:fallback-content-2>fallback content</a> instead.</p>
  32155. <p>In non-visual media, and in visual media if <a href=#concept-n-noscript id=the-canvas-element:concept-n-noscript>scripting is
  32156. 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
  32157. 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
  32158. content</a> instead.</p>
  32159. <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
  32160. 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
  32161. content</a>). When an element is <a href=#focused id=the-canvas-element:focused>focused</a>, it is the target of keyboard interaction
  32162. events (even though the element itself is not visible). This allows authors to make an interactive
  32163. 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
  32164. effect on mouse interaction events.) <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
  32165. <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>
  32166. 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
  32167. relevant canvas fallback content</dfn>.</p>
  32168. <hr>
  32169. <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:
  32170. <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
  32171. 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
  32172. numeric values. If an attribute is missing, or if parsing its value returns an error, then the
  32173. default value must be used instead. The <code id=the-canvas-element:attr-canvas-width-2><a href=#attr-canvas-width>width</a></code>
  32174. attribute defaults to 300, and the <code id=the-canvas-element:attr-canvas-height-2><a href=#attr-canvas-height>height</a></code> attribute
  32175. defaults to 150.</p>
  32176. <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>
  32177. <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>
  32178. <p>The user agent must use a square pixel density consisting of one pixel of image data per
  32179. 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>
  32180. <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
  32181. bitmap is then subject to the 'object-fit' CSS property. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  32182. <hr>
  32183. <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
  32184. contexts, such as those described in the section on the <code id=the-canvas-element:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
  32185. object below, have an <dfn id=concept-canvas-origin-clean>origin-clean</dfn> flag, which can
  32186. 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
  32187. <a href=#concept-canvas-origin-clean id=the-canvas-element:concept-canvas-origin-clean>origin-clean</a> flag must be set to true.</p>
  32188. <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
  32189. <code id=the-canvas-element:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> section below.</p>
  32190. <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
  32191. have a bound rendering context. To keep track of whether it has a rendering context or not, and
  32192. 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>
  32193. <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,
  32194. and its bitmap must be fully transparent black with an intrinsic width equal to the numeric value
  32195. 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
  32196. 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>
  32197. attribute, those values being interpreted in CSS pixels, and being updated as the attributes are
  32198. set, changed, or removed.</p>
  32199. <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
  32200. a paint source</a> whose width is the element's intrinsic width, whose height is the element's
  32201. intrinsic height, and whose appearance is the element's bitmap.</p>
  32202. <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
  32203. 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
  32204. 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>
  32205. <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
  32206. respective content attributes of the same name, with the same defaults.</p>
  32207. <hr>
  32208. <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>
  32209. <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
  32210. 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>
  32211. <p>This specification defines the "<code id=the-canvas-element:canvas-context-2d-2><a href=#canvas-context-2d>2d</a></code>" context below.
  32212. 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>"
  32213. context. <a href=#refsWEBGL>[WEBGL]</a></p>
  32214. <p>Returns null if the given context ID is not supported, if the canvas has already been
  32215. 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>
  32216. <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
  32217. used.</p>
  32218. <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>
  32219. <p>Returns false if calling <code id=the-canvas-element:dom-canvas-getcontext-3><a href=#dom-canvas-getcontext>getContext()</a></code> with the
  32220. same arguments would definitely return null, and true otherwise.</p>
  32221. <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
  32222. conditions (e.g. availability of system resources) can vary over time.</p>
  32223. <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
  32224. used.</p>
  32225. <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>
  32226. <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>
  32227. <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
  32228. used.</p>
  32229. </dl>
  32230. <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
  32231. <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
  32232. <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
  32233. 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
  32234. <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
  32235. <code id=the-canvas-element:dom-canvasproxy-setcontext><a href=#dom-canvasproxy-setcontext>setContext()</a></code> method.</p>
  32236. <p>These three methods are mutually exclusive; calling any of the three makes the other two start
  32237. throwing <code id=the-canvas-element:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code> exceptions when called.</p>
  32238. <p>Each rendering context has a <dfn id=concept-canvas-context-bitmap-mode>context bitmap
  32239. 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>.
  32240. Initially, rendering contexts must be in the <a href=#concept-canvas-bound id=the-canvas-element:concept-canvas-bound>unbound</a>
  32241. mode.</p>
  32242. <hr>
  32243. <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,
  32244. must run the steps in the cell of the following table whose column header describes the
  32245. <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>
  32246. and whose row header describes the method's first argument.</p>
  32247. <table><thead><tr><td>
  32248. <th><a href=#concept-canvas-none id=the-canvas-element:concept-canvas-none-2>none</a>
  32249. <th><a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-2>direct-2d</a>
  32250. <th><a href=#concept-canvas-direct-webgl id=the-canvas-element:concept-canvas-direct-webgl>direct-webgl</a>
  32251. <th><a href=#concept-canvas-indirect id=the-canvas-element:concept-canvas-indirect>indirect</a>
  32252. <th><a href=#concept-canvas-proxied id=the-canvas-element:concept-canvas-proxied>proxied</a>
  32253. <tbody><tr><th>"<dfn id=canvas-context-2d><code>2d</code></dfn>"
  32254. <td>
  32255. 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
  32256. 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
  32257. context creation algorithm</a> defined in the section below, passing it the
  32258. <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
  32259. that object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
  32260. <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed>fixed</a>, and return the
  32261. <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
  32262. <td>
  32263. Return the same object as was return the last time the method was invoked with this same
  32264. argument.
  32265. <td>
  32266. Return null.
  32267. <td>
  32268. Throw an <code id=the-canvas-element:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32269. <td>
  32270. Throw an <code id=the-canvas-element:invalidstateerror-6><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32271. <tr><th>"<dfn id=canvas-context-webgl><code>webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
  32272. <td>
  32273. Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
  32274. obtain either a <code id=the-canvas-element:webglrenderingcontext-2><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> or null; if the returned value is null,
  32275. 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
  32276. <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>
  32277. object‡ <a href=#refsWEBGL>[WEBGL]</a>
  32278. <td>
  32279. Return null.
  32280. <td>
  32281. Return the same object as was return the last time the method was invoked with this same
  32282. argument.
  32283. <td>
  32284. Throw an <code id=the-canvas-element:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32285. <td>
  32286. Throw an <code id=the-canvas-element:invalidstateerror-8><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32287. <tr><th>A vendor-specific extension*
  32288. <td>
  32289. Behave as defined for the extension.
  32290. <td>
  32291. Behave as defined for the extension.
  32292. <td>
  32293. Behave as defined for the extension.
  32294. <td>
  32295. Throw an <code id=the-canvas-element:invalidstateerror-9><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32296. <td>
  32297. Throw an <code id=the-canvas-element:invalidstateerror-10><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32298. <tr><th>An unsupported value†
  32299. <td>
  32300. Return null.
  32301. <td>
  32302. Return null.
  32303. <td>
  32304. Return null.
  32305. <td>
  32306. Throw an <code id=the-canvas-element:invalidstateerror-11><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32307. <td>
  32308. Throw an <code id=the-canvas-element:invalidstateerror-12><a href=#invalidstateerror>InvalidStateError</a></code> exception.
  32309. </table>
  32310. <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>
  32311. <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
  32312. graphics hardware's abilities and having no software fallback implementation.</small></p>
  32313. <p class=tablenote><small>‡ The second (and subsequent) argument(s) to the method, if
  32314. any, are ignored in all cases except this one. See the WebGL specification for
  32315. details.</small></p>
  32316. <hr>
  32317. <p>The <dfn id=dom-canvas-probablysupportscontext><code>probablySupportsContext(<var>contextId</var>,
  32318. <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
  32319. invoked, must return false if calling <code id=the-canvas-element:dom-canvas-getcontext-7><a href=#dom-canvas-getcontext>getContext()</a></code> on
  32320. the same object and with the same arguments would definitely return null at this time, and true
  32321. otherwise.</p>
  32322. <hr>
  32323. <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
  32324. run the following steps:</p>
  32325. <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
  32326. 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>
  32327. 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
  32328. bitmap mode</a> is <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed-3>fixed</a>, then throw an
  32329. <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
  32330. 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
  32331. set its <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-5>context
  32332. 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
  32333. 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
  32334. 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
  32335. mode</a> to <a href=#concept-canvas-bound id=the-canvas-element:concept-canvas-bound-3>bound</a>.</ol>
  32336. <hr>
  32337. <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>
  32338. <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
  32339. canvas.</p>
  32340. <p>The first argument, if provided, controls the type of the image to be returned (e.g. PNG or
  32341. JPEG). The default is <code>image/png</code>; that type is also used if the given type
  32342. isn't supported. The other arguments are specific to the type, and control the way that the
  32343. image is generated, as given <a href=#canvas-serialisation-arguments>in the table
  32344. below</a>.</p>
  32345. <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
  32346. was really returned in the requested format by checking to see if the returned string starts
  32347. 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
  32348. not supported. (The one exception to this is if the canvas has either no height or no width, in
  32349. which case the result might simply be "<code>data:,</code>".)</p>
  32350. <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>
  32351. <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,
  32352. and invokes a callback with a handle to that object.</p>
  32353. <p>The second argument, if provided, controls the type of the image to be returned (e.g. PNG or
  32354. JPEG). The default is <code>image/png</code>; that type is also used if the given type
  32355. isn't supported. The other arguments are specific to the type, and control the way that the
  32356. image is generated, as given <a href=#canvas-serialisation-arguments>in the table
  32357. below</a>.</p>
  32358. </dl>
  32359. <p>The <dfn id=dom-canvas-todataurl><code>toDataURL()</code></dfn> method must run the
  32360. following steps:</p>
  32361. <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
  32362. <code id=the-canvas-element:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
  32363. <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
  32364. 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
  32365. serialisation of the <code>canvas</code> element's bitmap as a file</a>, using the method's
  32366. 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
  32367. <var>file</var>. <a href=#refsRFC2397>[RFC2397]</a></p>
  32368. </ol>
  32369. <p>The <dfn id=dom-canvas-toblob><code>toBlob()</code></dfn> method must run the following
  32370. steps:</p>
  32371. <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
  32372. <code id=the-canvas-element:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
  32373. <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
  32374. any.<li>
  32375. <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
  32376. dimension or its vertical dimension is zero) then let <var>result</var> be null.</p>
  32377. <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
  32378. bitmap as a file</a>, using <var>arguments</var>. <a href=#refsFILEAPI>[FILEAPI]</a> </p>
  32379. <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
  32380. <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
  32381. blob serialisation task source</dfn>.</ol>
  32382. <h5 id=proxying-canvases-to-workers>4.12.4.1 Proxying canvases to workers</h5>
  32383. <p>Since DOM nodes cannot be accessed across worker boundaries, a proxy object is needed to enable
  32384. 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>
  32385. <pre class=idl>[Exposed=(Window,Worker)]
  32386. interface <dfn id=canvasproxy>CanvasProxy</dfn> {
  32387. 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);
  32388. };
  32389. // <a href=#canvasproxy id=proxying-canvases-to-workers:canvasproxy>CanvasProxy</a> implements <a href=#transferable id=proxying-canvases-to-workers:transferable>Transferable</a>;</pre>
  32390. <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>
  32391. <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
  32392. 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>)
  32393. or to a worker.</p>
  32394. <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>
  32395. <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>
  32396. <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
  32397. the given object.</p>
  32398. <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
  32399. <a href=#transfer-a-transferable-object id=proxying-canvases-to-workers:transfer-a-transferable-object>transfered</a>.</p>
  32400. </dl>
  32401. <hr>
  32402. <p>The <dfn id=dom-canvas-transfercontroltoproxy><code>transferControlToProxy()</code></dfn>
  32403. 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>
  32404. <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
  32405. context mode</a> is not <a href=#concept-canvas-none id=proxying-canvases-to-workers:concept-canvas-none>none</a>, throw an
  32406. <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
  32407. 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>
  32408. element.</ol>
  32409. <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),
  32410. 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
  32411. can be <dfn id=concept-canvasproxy-disabled>disabled</dfn>, meaning it can no longer be bound
  32412. 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>
  32413. <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
  32414. <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
  32415. element.</p>
  32416. <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,
  32417. must run the following steps:</p>
  32418. <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>
  32419. 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
  32420. bitmap mode</a> is <a href=#concept-canvas-fixed id=proxying-canvases-to-workers:concept-canvas-fixed>fixed</a>, then throw an
  32421. <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
  32422. 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
  32423. 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
  32424. 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
  32425. 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>
  32426. 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>
  32427. <p id=transferCanvasProxy>To <a href=#transfer-a-transferable-object id=proxying-canvases-to-workers:transfer-a-transferable-object-3>transfer</a> a
  32428. <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>,
  32429. 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
  32430. <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>,
  32431. 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
  32432. finally return <var>new</var>.</p>
  32433. <div class=example>
  32434. <p>Here is a clock implemented on a worker. First, the main page:</p>
  32435. <pre>&lt;!DOCTYPE HTML>
  32436. &lt;title>Clock&lt;/title>
  32437. &lt;canvas>&lt;/canvas>
  32438. &lt;script>
  32439. var canvas = document.getElementsByTagName('canvas')[0];
  32440. var proxy = canvas.transferControlToProxy();
  32441. var worker = new Worker('clock.js');
  32442. worker.postMessage(proxy, [proxy]);
  32443. &lt;/script></pre>
  32444. <p>Second, the worker:</p>
  32445. <pre>onmessage = function (event) {
  32446. var context = new CanvasRenderingContext2D();
  32447. event.data.setContext(context); // event.data is the CanvasProxy object
  32448. setInterval(function () {
  32449. context.clearRect(0, 0, context.width, context.height);
  32450. context.fillText(new Date(), 0, 100);
  32451. context.commit();
  32452. }, 1000);
  32453. };</pre>
  32454. </div>
  32455. <h5 id=2dcontext>4.12.4.2 The 2D rendering context</h5>
  32456. <pre class=idl>typedef (<a href=#htmlimageelement id=2dcontext:htmlimageelement>HTMLImageElement</a> or
  32457. <a href=#htmlvideoelement id=2dcontext:htmlvideoelement>HTMLVideoElement</a> or
  32458. <a href=#htmlcanvaselement id=2dcontext:htmlcanvaselement>HTMLCanvasElement</a> or
  32459. <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
  32460. <a href=#imagebitmap id=2dcontext:imagebitmap>ImageBitmap</a>) <dfn id=canvasimagesource>CanvasImageSource</dfn>;
  32461. 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>" };
  32462. [<a href=#dom-context-2d id=2dcontext:dom-context-2d>Constructor</a>(optional unsigned long width, unsigned long height), Exposed=(Window,Worker)]
  32463. interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {
  32464. // back-reference to the canvas
  32465. 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>;
  32466. // canvas dimensions
  32467. attribute unsigned long <a href=#dom-context-2d-width id=2dcontext:dom-context-2d-width>width</a>;
  32468. attribute unsigned long <a href=#dom-context-2d-height id=2dcontext:dom-context-2d-height>height</a>;
  32469. // for contexts that aren't directly <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed>fixed</a> to a specific canvas
  32470. 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>
  32471. // state
  32472. void <a href=#dom-context-2d-save id=2dcontext:dom-context-2d-save>save</a>(); // push state on state stack
  32473. void <a href=#dom-context-2d-restore id=2dcontext:dom-context-2d-restore>restore</a>(); // pop state stack and restore state
  32474. // transformations (default transform is the identity matrix)
  32475. attribute <a href=#svgmatrix id=2dcontext:svgmatrix>SVGMatrix</a> <a href=#dom-context-2d-currenttransform id=2dcontext:dom-context-2d-currenttransform>currentTransform</a>;
  32476. void <a href=#dom-context-2d-scale id=2dcontext:dom-context-2d-scale>scale</a>(unrestricted double x, unrestricted double y);
  32477. void <a href=#dom-context-2d-rotate id=2dcontext:dom-context-2d-rotate>rotate</a>(unrestricted double angle);
  32478. void <a href=#dom-context-2d-translate id=2dcontext:dom-context-2d-translate>translate</a>(unrestricted double x, unrestricted double y);
  32479. 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);
  32480. 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);
  32481. void <a href=#dom-context-2d-resettransform id=2dcontext:dom-context-2d-resettransform>resetTransform</a>();
  32482. // compositing
  32483. attribute unrestricted double <a href=#dom-context-2d-globalalpha id=2dcontext:dom-context-2d-globalalpha>globalAlpha</a>; // (default 1.0)
  32484. attribute DOMString <a href=#dom-context-2d-globalcompositeoperation id=2dcontext:dom-context-2d-globalcompositeoperation>globalCompositeOperation</a>; // (default source-over)
  32485. // image smoothing
  32486. attribute boolean <a href=#dom-context-2d-imagesmoothingenabled id=2dcontext:dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a>; // (default true)
  32487. // colours and styles (see also the <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles>CanvasDrawingStyles</a> interface)
  32488. attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-strokestyle id=2dcontext:dom-context-2d-strokestyle>strokeStyle</a>; // (default black)
  32489. attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-fillstyle id=2dcontext:dom-context-2d-fillstyle>fillStyle</a>; // (default black)
  32490. <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);
  32491. <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);
  32492. <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);
  32493. // shadows
  32494. attribute unrestricted double <a href=#dom-context-2d-shadowoffsetx id=2dcontext:dom-context-2d-shadowoffsetx>shadowOffsetX</a>; // (default 0)
  32495. attribute unrestricted double <a href=#dom-context-2d-shadowoffsety id=2dcontext:dom-context-2d-shadowoffsety>shadowOffsetY</a>; // (default 0)
  32496. attribute unrestricted double <a href=#dom-context-2d-shadowblur id=2dcontext:dom-context-2d-shadowblur>shadowBlur</a>; // (default 0)
  32497. attribute DOMString <a href=#dom-context-2d-shadowcolor id=2dcontext:dom-context-2d-shadowcolor>shadowColor</a>; // (default transparent black)
  32498. // rects
  32499. 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);
  32500. 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);
  32501. 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);
  32502. // path API (see also <a href=#canvaspathmethods id=2dcontext:canvaspathmethods>CanvasPathMethods</a>)
  32503. void <a href=#dom-context-2d-beginpath id=2dcontext:dom-context-2d-beginpath>beginPath</a>();
  32504. 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>");
  32505. 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>");
  32506. void <a href=#dom-context-2d-stroke id=2dcontext:dom-context-2d-stroke>stroke</a>();
  32507. 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);
  32508. void <a href=#dom-context-2d-drawsystemfocusring id=2dcontext:dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a>(<a href=#element id=2dcontext:element>Element</a> element);
  32509. 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);
  32510. 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);
  32511. 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);
  32512. void <a href=#dom-context-2d-scrollpathintoview id=2dcontext:dom-context-2d-scrollpathintoview>scrollPathIntoView</a>();
  32513. 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);
  32514. 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>");
  32515. 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>");
  32516. void <a href=#dom-context-2d-resetclip id=2dcontext:dom-context-2d-resetclip>resetClip</a>();
  32517. 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>");
  32518. 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>");
  32519. boolean <a href=#dom-context-2d-ispointinstroke id=2dcontext:dom-context-2d-ispointinstroke>isPointInStroke</a>(unrestricted double x, unrestricted double y);
  32520. 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);
  32521. // text (see also the <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-2>CanvasDrawingStyles</a> interface)
  32522. 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);
  32523. 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);
  32524. <a href=#textmetrics id=2dcontext:textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext id=2dcontext:dom-context-2d-measuretext>measureText</a>(DOMString text);
  32525. // drawing images
  32526. 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);
  32527. 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);
  32528. 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);
  32529. // hit regions
  32530. 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);
  32531. void <a href=#dom-context-2d-removehitregion id=2dcontext:dom-context-2d-removehitregion>removeHitRegion</a>(DOMString id);
  32532. void <a href=#dom-context-2d-clearhitregions id=2dcontext:dom-context-2d-clearhitregions>clearHitRegions</a>();
  32533. // <a href=#pixel-manipulation id=2dcontext:pixel-manipulation>pixel manipulation</a>
  32534. <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);
  32535. <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);
  32536. <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);
  32537. 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);
  32538. 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);
  32539. };
  32540. <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d-2>CanvasRenderingContext2D</a> implements <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-3>CanvasDrawingStyles</a>;
  32541. <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d-3>CanvasRenderingContext2D</a> implements <a href=#canvaspathmethods id=2dcontext:canvaspathmethods-2>CanvasPathMethods</a>;
  32542. [NoInterfaceObject, Exposed=(Window,Worker)]
  32543. interface <dfn id=canvasdrawingstyles>CanvasDrawingStyles</dfn> {
  32544. // line caps/joins
  32545. attribute unrestricted double <a href=#dom-context-2d-linewidth id=2dcontext:dom-context-2d-linewidth>lineWidth</a>; // (default 1)
  32546. attribute DOMString <a href=#dom-context-2d-linecap id=2dcontext:dom-context-2d-linecap>lineCap</a>; // "butt", "round", "square" (default "butt")
  32547. attribute DOMString <a href=#dom-context-2d-linejoin id=2dcontext:dom-context-2d-linejoin>lineJoin</a>; // "round", "bevel", "miter" (default "miter")
  32548. attribute unrestricted double <a href=#dom-context-2d-miterlimit id=2dcontext:dom-context-2d-miterlimit>miterLimit</a>; // (default 10)
  32549. // dashed lines
  32550. void <a href=#dom-context-2d-setlinedash id=2dcontext:dom-context-2d-setlinedash>setLineDash</a>(sequence&lt;unrestricted double> segments); // default empty
  32551. sequence&lt;unrestricted double> <a href=#dom-context-2d-getlinedash id=2dcontext:dom-context-2d-getlinedash>getLineDash</a>();
  32552. attribute unrestricted double <a href=#dom-context-2d-linedashoffset id=2dcontext:dom-context-2d-linedashoffset>lineDashOffset</a>;
  32553. // text
  32554. attribute DOMString <a href=#dom-context-2d-font id=2dcontext:dom-context-2d-font>font</a>; // (default 10px sans-serif)
  32555. attribute DOMString <a href=#dom-context-2d-textalign id=2dcontext:dom-context-2d-textalign>textAlign</a>; // "start", "end", "left", "right", "center" (default: "start")
  32556. attribute DOMString <a href=#dom-context-2d-textbaseline id=2dcontext:dom-context-2d-textbaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
  32557. attribute DOMString <a href=#dom-context-2d-direction id=2dcontext:dom-context-2d-direction>direction</a>; // "ltr", "rtl", "inherit" (default: "inherit")
  32558. };
  32559. [NoInterfaceObject, Exposed=(Window,Worker)]
  32560. interface <dfn id=canvaspathmethods>CanvasPathMethods</dfn> {
  32561. // shared path API methods
  32562. void <a href=#dom-context-2d-closepath id=2dcontext:dom-context-2d-closepath>closePath</a>();
  32563. void <a href=#dom-context-2d-moveto id=2dcontext:dom-context-2d-moveto>moveTo</a>(unrestricted double x, unrestricted double y);
  32564. void <a href=#dom-context-2d-lineto id=2dcontext:dom-context-2d-lineto>lineTo</a>(unrestricted double x, unrestricted double y);
  32565. 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);
  32566. 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);
  32567. 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);
  32568. 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);
  32569. 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);
  32570. 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);
  32571. 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);
  32572. };
  32573. [Exposed=(Window,Worker)]
  32574. interface <dfn id=canvasgradient>CanvasGradient</dfn> {
  32575. // opaque object
  32576. void <a href=#dom-canvasgradient-addcolorstop id=2dcontext:dom-canvasgradient-addcolorstop>addColorStop</a>(double offset, DOMString color);
  32577. };
  32578. [Exposed=(Window,Worker)]
  32579. interface <dfn id=canvaspattern>CanvasPattern</dfn> {
  32580. // opaque object
  32581. void <a href=#dom-canvaspattern-settransform id=2dcontext:dom-canvaspattern-settransform>setTransform</a>(<a href=#svgmatrix id=2dcontext:svgmatrix-2>SVGMatrix</a> transform);
  32582. };
  32583. [Exposed=(Window,Worker)]
  32584. interface <dfn id=textmetrics>TextMetrics</dfn> {
  32585. // x-direction
  32586. readonly attribute double <a href=#dom-textmetrics-width id=2dcontext:dom-textmetrics-width>width</a>; // advance width
  32587. readonly attribute double <a href=#dom-textmetrics-actualboundingboxleft id=2dcontext:dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft</a>;
  32588. readonly attribute double <a href=#dom-textmetrics-actualboundingboxright id=2dcontext:dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a>;
  32589. // y-direction
  32590. readonly attribute double <a href=#dom-textmetrics-fontboundingboxascent id=2dcontext:dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent</a>;
  32591. readonly attribute double <a href=#dom-textmetrics-fontboundingboxdescent id=2dcontext:dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent</a>;
  32592. readonly attribute double <a href=#dom-textmetrics-actualboundingboxascent id=2dcontext:dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a>;
  32593. readonly attribute double <a href=#dom-textmetrics-actualboundingboxdescent id=2dcontext:dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent</a>;
  32594. readonly attribute double <a href=#dom-textmetrics-emheightascent id=2dcontext:dom-textmetrics-emheightascent>emHeightAscent</a>;
  32595. readonly attribute double <a href=#dom-textmetrics-emheightdescent id=2dcontext:dom-textmetrics-emheightdescent>emHeightDescent</a>;
  32596. readonly attribute double <a href=#dom-textmetrics-hangingbaseline id=2dcontext:dom-textmetrics-hangingbaseline>hangingBaseline</a>;
  32597. readonly attribute double <a href=#dom-textmetrics-alphabeticbaseline id=2dcontext:dom-textmetrics-alphabeticbaseline>alphabeticBaseline</a>;
  32598. readonly attribute double <a href=#dom-textmetrics-ideographicbaseline id=2dcontext:dom-textmetrics-ideographicbaseline>ideographicBaseline</a>;
  32599. };
  32600. dictionary <dfn id=hitregionoptions>HitRegionOptions</dfn> {
  32601. <a href=#path2d id=2dcontext:path2d-9>Path2D</a>? <a href=#dom-hitregionoptions-path id=2dcontext:dom-hitregionoptions-path>path</a> = null;
  32602. <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>";
  32603. DOMString <a href=#dom-hitregionoptions-id id=2dcontext:dom-hitregionoptions-id>id</a> = "";
  32604. DOMString? <a href=#dom-hitregionoptions-parentid id=2dcontext:dom-hitregionoptions-parentid>parentID</a> = null;
  32605. DOMString <a href=#dom-hitregionoptions-cursor id=2dcontext:dom-hitregionoptions-cursor>cursor</a> = "inherit";
  32606. // for control-backed regions:
  32607. <a href=#element id=2dcontext:element-5>Element</a>? <a href=#dom-hitregionoptions-control id=2dcontext:dom-hitregionoptions-control>control</a> = null;
  32608. // for unbacked regions:
  32609. DOMString? <a href=#dom-hitregionoptions-label id=2dcontext:dom-hitregionoptions-label>label</a> = null;
  32610. DOMString? <a href=#dom-hitregionoptions-role id=2dcontext:dom-hitregionoptions-role>role</a> = null;
  32611. };
  32612. [<a href=#dom-imagedata id=2dcontext:dom-imagedata>Constructor</a>(unsigned long sw, unsigned long sh),
  32613. <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),
  32614. Exposed=(Window,Worker)]
  32615. interface <dfn id=imagedata>ImageData</dfn> {
  32616. readonly attribute unsigned long <a href=#dom-imagedata-width id=2dcontext:dom-imagedata-width>width</a>;
  32617. readonly attribute unsigned long <a href=#dom-imagedata-height id=2dcontext:dom-imagedata-height>height</a>;
  32618. readonly attribute <a href=#uint8clampedarray id=2dcontext:uint8clampedarray-2>Uint8ClampedArray</a> <a href=#dom-imagedata-data id=2dcontext:dom-imagedata-data>data</a>;
  32619. };
  32620. [<a href=#dom-drawingstyle id=2dcontext:dom-drawingstyle>Constructor</a>(optional <a href=#element id=2dcontext:element-6>Element</a> scope), Exposed=(Window,Worker)]
  32621. interface <dfn id=drawingstyle>DrawingStyle</dfn> { };
  32622. <a href=#drawingstyle id=2dcontext:drawingstyle>DrawingStyle</a> implements <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-4>CanvasDrawingStyles</a>;
  32623. [<a href=#dom-path2d id=2dcontext:dom-path2d>Constructor</a>,
  32624. <a href=#dom-path2d-copy id=2dcontext:dom-path2d-copy>Constructor</a>(<a href=#path2d id=2dcontext:path2d-10>Path2D</a> path),
  32625. <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>"),
  32626. <a href=#dom-path2d-withdata id=2dcontext:dom-path2d-withdata>Constructor</a>(DOMString d), Exposed=(Window,Worker)]
  32627. interface <dfn id=path2d>Path2D</dfn> {
  32628. 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);
  32629. 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);
  32630. 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);
  32631. 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);
  32632. 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);
  32633. 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);
  32634. };
  32635. <a href=#path2d id=2dcontext:path2d-16>Path2D</a> implements <a href=#canvaspathmethods id=2dcontext:canvaspathmethods-3>CanvasPathMethods</a>;</pre>
  32636. <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>
  32637. <p>Returns a <code id=2dcontext:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object that is permanently bound to a
  32638. particular <code id=2dcontext:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element.</p>
  32639. <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>
  32640. <p>Returns an unbound <code id=2dcontext:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object with an implied bitmap with
  32641. the given dimensions in CSS pixels (300x150, if the arguments are omitted).</p>
  32642. <dt><var>context</var> . <code id=2dcontext:dom-context-2d-canvas-2><a href=#dom-context-2d-canvas>canvas</a></code><dd>
  32643. <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
  32644. <code id=2dcontext:dom-canvas-getcontext-2><a href=#dom-canvas-getcontext>getContext()</a></code> method.</p>
  32645. <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>
  32646. <p>Return the dimensions of the bitmap, in CSS pixels.</p>
  32647. <p>Can be set, to update the bitmap's dimensions. If the rendering context is bound to a canvas,
  32648. this will also update the canvas' intrinsic dimensions.</p>
  32649. <dt><var>context</var> . <code id=2dcontext:dom-context-2d-commit-2><a href=#dom-context-2d-commit>commit</a></code>()<dd>
  32650. <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>
  32651. </dl>
  32652. <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
  32653. 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>
  32654. <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
  32655. to an <dfn id=output-bitmap>output bitmap</dfn>. These are initialised when the object is created, and can be
  32656. 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
  32657. underlying bitmap. In general, the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap>scratch bitmap</a> is what scripts interact with, and
  32658. the <a href=#output-bitmap id=2dcontext:output-bitmap-2>output bitmap</a> is what is being displayed. These bitmaps always have the same
  32659. dimensions.</p>
  32660. <p>Each such bitmap has an <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean>origin-clean</a> flag,
  32661. 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>
  32662. <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.
  32663. Initially, this list is empty. <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> also have a
  32664. <dfn id=list-of-pending-interface-actions>list of pending interface actions</dfn>, which can contain instructions to draw the user's
  32665. attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
  32666. Initially, this list is also empty.</p>
  32667. <p>The <code id=2dcontext:canvasrenderingcontext2d-8><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> 2D rendering context represents a flat linear
  32668. Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having
  32669. <var>x</var> values increasing when going right, and <var>y</var> values
  32670. increasing when going down. The <var>x</var>-coordinate of the right-most edge is equal to
  32671. the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>scratch bitmap</a> in CSS pixels; similarly, the
  32672. <var>y</var>-coordinate of the bottom-most edge is equal to the height of the rendering
  32673. context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> in CSS pixels.</p>
  32674. <p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
  32675. that the user agent will use internally or during rendering. On high-definition displays, for
  32676. instance, the user agent may internally use bitmaps with two device pixels per unit in the
  32677. coordinate space, so that the rendering remains at high quality throughout. Anti-aliasing can
  32678. similarly be implemented using over-sampling with bitmaps of a higher resolution than the final
  32679. image on the display.</p>
  32680. <hr>
  32681. <p>The <dfn id=2d-context-creation-algorithm>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
  32682. <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element), consists of running the following steps:</p>
  32683. <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
  32684. <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
  32685. <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
  32686. 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
  32687. numeric values of <var>target</var>'s <code id=2dcontext:attr-canvas-width><a href=#attr-canvas-width>width</a></code> and
  32688. <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>
  32689. <hr>
  32690. <p>The <dfn id=dom-context-2d><code>CanvasRenderingContext2D()</code></dfn> constructor, when
  32691. invoked, must run the following steps:</p>
  32692. <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
  32693. 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
  32694. 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
  32695. bitmap</a>.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-15><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
  32696. <hr>
  32697. <p>When the user agent is required to <dfn id=commit-the-scratch-bitmap>commit the scratch bitmap</dfn> for a rendering
  32698. context, it must run the following steps:
  32699. <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
  32700. bitmap</a>.<li><p>Let <var>origin-clean flag copy</var> be a copy of the rendering context's
  32701. <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>
  32702. flag.<li><p>Let <var>hit region list copy</var> be a copy of the rendering context's
  32703. <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
  32704. 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
  32705. 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
  32706. context was most recently <a href=#concept-canvas-binding-steps id=2dcontext:concept-canvas-binding-steps-2>bound</a>.<li>
  32707. <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>
  32708. to perform the following substeps:</p>
  32709. <ol><li><p>Overwrite <var>output bitmap</var> with <var>bitmap
  32710. 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
  32711. 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
  32712. copy</var>.</ol>
  32713. </ol>
  32714. <p>The algorithm above must use the <dfn id=canvas-updating-task-source>canvas updating task source</dfn> (which is just used by
  32715. this algorithm).</p>
  32716. <p>The <dfn id=dom-context-2d-commit><code>commit()</code></dfn> method must run the
  32717. following steps:</p>
  32718. <ol><li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode>context bitmap
  32719. mode</a> is <a href=#concept-canvas-bound id=2dcontext:concept-canvas-bound>fixed</a>, throw an
  32720. <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>
  32721. <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
  32722. 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
  32723. 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
  32724. immediately drawn.)</p>
  32725. <hr>
  32726. <p>When the user agent is to <dfn id=concept-canvas-set-bitmap-dimensions>set bitmap
  32727. dimensions</dfn> to <var>width</var> and <var>height</var>, it must run the
  32728. following steps:</p>
  32729. <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
  32730. 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
  32731. bitmap</a> is a different bitmap than the <a href=#output-bitmap id=2dcontext:output-bitmap-8>output bitmap</a>, then resize the
  32732. <a href=#output-bitmap id=2dcontext:output-bitmap-9>output bitmap</a> to the new <var>width</var> and <var>height</var>
  32733. and clear it to fully transparent black.<li>
  32734. <p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-2>context bitmap
  32735. mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-2>fixed</a>, then run these substeps:</p>
  32736. <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
  32737. 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
  32738. bitmap mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-3>fixed</a> and the numeric value of
  32739. the <var>canvas</var>' <code id=2dcontext:attr-canvas-width-2><a href=#attr-canvas-width>width</a></code> content attribute
  32740. 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
  32741. 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
  32742. bitmap mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-4>fixed</a> and the numeric value of
  32743. the <var>canvas</var>' <code id=2dcontext:attr-canvas-height-2><a href=#attr-canvas-height>height</a></code> content attribute
  32744. 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
  32745. 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>
  32746. </ol>
  32747. <div class=example>
  32748. <p>Only one square appears to be drawn in the following example:</p>
  32749. <pre>// canvas is a reference to a &lt;canvas> element
  32750. var context = canvas.getContext('2d');
  32751. context.fillRect(0,0,50,50);
  32752. canvas.setAttribute('width', '300'); // clears the canvas
  32753. context.fillRect(0,100,50,50);
  32754. canvas.width = canvas.width; // clears the canvas
  32755. context.fillRect(100,0,50,50); // only this square remains</pre>
  32756. </div>
  32757. <hr>
  32758. <p>When the user agent is to run the <dfn id=concept-canvas-unbinding-steps>unbinding
  32759. steps</dfn> for a rendering context, it must run the following steps:</p>
  32760. <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
  32761. 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
  32762. 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
  32763. bitmap</a>.</ol>
  32764. <p>When the user agent is to run the <dfn id=concept-canvas-binding-steps>binding steps</dfn>
  32765. 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
  32766. must run the following steps:</p>
  32767. <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
  32768. 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
  32769. the dimensions of <var>target</var>'s bitmap and clear it to fully transparent
  32770. 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>
  32771. <hr>
  32772. <p>The <dfn id=dom-context-2d-canvas><code>canvas</code></dfn> attribute must return the
  32773. value it was initialised to when the object was created.</p>
  32774. <p>The <dfn id=dom-context-2d-width><code>width</code></dfn> attribute, on getting, must
  32775. return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>, in CSS pixels. On
  32776. setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-3>set bitmap dimensions</a>
  32777. 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
  32778. CSS pixels, respectively.</p>
  32779. <p>The <dfn id=dom-context-2d-height><code>height</code></dfn> attribute, on getting, must
  32780. return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a>, in CSS pixels. On
  32781. setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-4>set bitmap dimensions</a>
  32782. 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
  32783. new value, respectively.</p>
  32784. <hr>
  32785. <p>Except where otherwise specified, for the 2D context interface, <strong>any method call with a
  32786. numeric argument whose value is infinite or a NaN value must be ignored</strong>.</p>
  32787. <p>Whenever the CSS value <code>currentColor</code> is used as a colour in the
  32788. <code id=2dcontext:canvasrenderingcontext2d-22><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> API, the "computed value of the 'color' property" for the
  32789. purposes of determining the computed value of the <code>currentColor</code> keyword is
  32790. the value described by the appropriate entry in the following list:</p>
  32791. <dl><dt>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-5>context bitmap
  32792. 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>
  32793. 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
  32794. value of the <code>currentColor</code> keyword is the computed value of the 'color'
  32795. 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
  32796. the appropriate attribute is set, or when the method is called; not when the colour is rendered or
  32797. 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
  32798. value of the <code>currentColor</code> keyword is fully opaque black. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></dl>
  32799. <p>In the case of <code id=2dcontext:dom-canvasgradient-addcolorstop-2><a href=#dom-canvasgradient-addcolorstop>addColorStop()</a></code> on
  32800. <code id=2dcontext:canvasgradient-3><a href=#canvasgradient>CanvasGradient</a></code>, the "computed value of the 'color' property" for the purposes of
  32801. determining the computed value of the <code>currentColor</code> keyword is always fully
  32802. opaque black (there is no associated element). <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
  32803. <p class=note>This is because <code id=2dcontext:canvasgradient-4><a href=#canvasgradient>CanvasGradient</a></code> objects are
  32804. <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
  32805. <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
  32806. "element in question" at the time that the colour is specified.</p>
  32807. <p class=note>Similar concerns exist with font-related properties; the rules for those are
  32808. described in detail in the relevant section below.</p>
  32809. <hr>
  32810. <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>
  32811. algorithm by which to determine if a point is inside or outside a path.</p>
  32812. <p>The value "<dfn id=dom-context-2d-fillrule-nonzero><code>nonzero</code></dfn>" value
  32813. indicates the non-zero winding rule, wherein
  32814. a point is considered to be outside a shape if the number of times a half-infinite straight
  32815. line drawn from that point crosses the shape's path going in one direction is equal to the
  32816. number of times it crosses the path going in the other direction.
  32817. </p>
  32818. <p>The "<dfn id=dom-context-2d-fillrule-evenodd><code>evenodd</code></dfn>" value indicates
  32819. the even-odd rule, wherein
  32820. a point is considered to be outside a shape if the number of times a half-infinite straight
  32821. line drawn from that point crosses the shape's path is even.
  32822. </p>
  32823. <p>If a point is not outside a shape, it is inside the shape.</p>
  32824. <h6 id=implementation-notes>4.12.4.2.1 Implementation notes</h6>
  32825. <p><i>This section is non-normative.</i></p>
  32826. <p>Although the way the specification is written it might sound like an implementation needs to
  32827. track up to four bitmaps per canvas or rendering context — one <a href=#scratch-bitmap id=implementation-notes:scratch-bitmap>scratch bitmap</a>,
  32828. 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>,
  32829. and one bitmap for the actually currently rendered image — user agents can in fact generally
  32830. optimise this to only one or two.</p>
  32831. <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
  32832. bitmap</a>, is only directly observable if it is read, and therefore implementations can,
  32833. instead of updating this bitmap, merely remember the sequence of drawing operations that have been
  32834. applied to it until such time as the bitmap's actual data is needed (for example because of a call
  32835. 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>
  32836. factory method). In many cases, this will be more memory efficient.</p>
  32837. <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
  32838. 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,
  32839. 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>
  32840. <p>Additional bitmaps are sometimes needed, e.g. to enable fast drawing when the canvas is being
  32841. painted at a different size than its intrinsic size, or to enable double buffering so that the
  32842. rendering commands from the <a href=#scratch-bitmap id=implementation-notes:scratch-bitmap-3>scratch bitmap</a> can be applied without the rendering being
  32843. updated midway.</p>
  32844. <h6 id=the-canvas-state>4.12.4.2.2 The canvas state</h6>
  32845. <p>Each <code id=the-canvas-state:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> rendering context maintains a stack of drawing
  32846. states. <dfn id=drawing-state>Drawing states</dfn> consist of:</p>
  32847. <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>
  32848. <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
  32849. 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
  32850. reset using the <code id=the-canvas-state:dom-context-2d-beginpath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The bitmaps
  32851. 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>
  32852. <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>
  32853. <p>Pushes the current state onto the stack.</p>
  32854. <dt><var>context</var> . <code id=the-canvas-state:dom-context-2d-restore><a href=#dom-context-2d-restore>restore</a></code>()<dd>
  32855. <p>Pops the top state on the stack, restoring the context to that state.</p>
  32856. </dl>
  32857. <p>The <dfn id=dom-context-2d-save><code>save()</code></dfn> method must push a copy of the
  32858. current drawing state onto the drawing state stack.</p>
  32859. <p>The <dfn id=dom-context-2d-restore><code>restore()</code></dfn> method must pop the top
  32860. entry in the drawing state stack, and reset the drawing state it describes. If there is no saved
  32861. state, the method must do nothing.</p>
  32862. <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
  32863. clear the drawing state stack and everything that <a href=#drawing-state id=the-canvas-state:drawing-state>drawing state</a> consists of to
  32864. initial values.</p>
  32865. <h6 id=drawingstyle-objects>4.12.4.2.3 <code id=drawingstyle-objects:drawingstyle><a href=#drawingstyle>DrawingStyle</a></code> objects</h6>
  32866. <p>All the line styles (line width, caps, joins, and dash patterns) and text styles (fonts)
  32867. described in the next two sections apply to <code id=drawingstyle-objects:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects and to
  32868. <code id=drawingstyle-objects:drawingstyle-2><a href=#drawingstyle>DrawingStyle</a></code> objects. This section defines the constructor used to obtain a
  32869. <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>
  32870. objects to control how text and paths are rasterised and stroked.</p>
  32871. <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>
  32872. <p>Creates a new <code id=drawingstyle-objects:drawingstyle-4><a href=#drawingstyle>DrawingStyle</a></code> object, optionally using a specific element for
  32873. resolving relative keywords and sizes in font specifications.</p>
  32874. </dl>
  32875. <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>
  32876. <p>The <dfn id=dom-drawingstyle><code>DrawingStyle()</code></dfn> constructor, when invoked,
  32877. must return a newly created <code id=drawingstyle-objects:drawingstyle-6><a href=#drawingstyle>DrawingStyle</a></code> object. If the constructor was passed an
  32878. 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
  32879. 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
  32880. 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>
  32881. 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
  32882. <code id=drawingstyle-objects:window><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is found.
  32883. 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>,
  32884. and the <a href=#styles-scope-object id=drawingstyle-objects:styles-scope-object-3>styles scope object</a> is the worker.</p>
  32885. <h6 id=line-styles>4.12.4.2.4 Line styles</h6>
  32886. <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>
  32887. <p>Returns the current line width.</p>
  32888. <p>Can be set, to change the line width. Values that are not finite values greater than zero are
  32889. ignored.</p>
  32890. <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>
  32891. <p>Returns the current line cap style.</p>
  32892. <p>Can be set, to change the line cap style.</p>
  32893. <p>The possible line cap styles are "<code>butt"</code>", "<code>round"</code>", and "<code>square"</code>". Other values are ignored.</p>
  32894. <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>
  32895. <p>Returns the current line join style.</p>
  32896. <p>Can be set, to change the line join style.</p>
  32897. <p>The possible line join styles are "<code>bevel"</code>", "<code>round"</code>", and "<code>miter"</code>". Other values are ignored.</p>
  32898. <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>
  32899. <p>Returns the current miter limit ratio.</p>
  32900. <p>Can be set, to change the miter limit ratio. Values that are not finite values greater than
  32901. zero are ignored.</p>
  32902. <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>
  32903. <p>Sets the current line dash pattern (as used when stroking). The argument is a list of
  32904. distances for which to alternately have the line on and the line off.</p>
  32905. <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>
  32906. <p>Returns a copy of the current line dash pattern. The array returned will always have an even
  32907. number of entries (i.e. the pattern is normalized).</p>
  32908. <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>
  32909. <p>Returns the phase offset (in the same units as the line dash pattern).</p>
  32910. <p>Can be set, to change the phase offset. Values that are not finite values are ignored.</p>
  32911. </dl>
  32912. <p>Objects that implement the <code id=line-styles:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface have attributes and
  32913. methods (defined in this section) that control how lines are treated by the object.</p>
  32914. <p>The <dfn id=dom-context-2d-linewidth><code>lineWidth</code></dfn> attribute gives the
  32915. width of lines, in coordinate space units. On getting, it must return the current value. On
  32916. setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged;
  32917. other values must change the current value to the new value.</p>
  32918. <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  32919. <code id=line-styles:dom-context-2d-linewidth-3><a href=#dom-context-2d-linewidth>lineWidth</a></code> attribute must initially have the value
  32920. 1.0.</p>
  32921. <hr>
  32922. <p>The <dfn id=dom-context-2d-linecap><code>lineCap</code></dfn> attribute defines the type
  32923. 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>
  32924. <p>On getting, it must return the current value. On setting, if the new value is one of the
  32925. 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
  32926. must ignored, leaving the value unchanged.</p>
  32927. <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-3><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  32928. <code id=line-styles:dom-context-2d-linecap-3><a href=#dom-context-2d-linecap>lineCap</a></code> attribute must initially have the value
  32929. "<code>butt"</code>".</p>
  32930. <hr>
  32931. <p>The <dfn id=dom-context-2d-linejoin><code>lineJoin</code></dfn> attribute defines the type
  32932. of corners that UAs will place where two lines meet. The three valid values are
  32933. "<code>bevel"</code>", "<code>round"</code>", and "<code>miter"</code>".</p>
  32934. <p>On getting, it must return the current value. On setting, if the new value is one of the
  32935. 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
  32936. must be ignored, leaving the value unchanged.</p>
  32937. <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-4><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  32938. <code id=line-styles:dom-context-2d-linejoin-3><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute must initially have the value
  32939. "<code>miter"</code>".</p>
  32940. <hr>
  32941. <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
  32942. 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
  32943. the current value. On setting, zero, negative, infinite, and NaN values must be ignored, leaving
  32944. the value unchanged; other values must change the current value to the new value.</p>
  32945. <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-5><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  32946. <code id=line-styles:dom-context-2d-miterlimit-3><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute must initially have the value
  32947. 10.0.</p>
  32948. <hr>
  32949. <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
  32950. 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
  32951. be empty.</p>
  32952. <p>When the <dfn id=dom-context-2d-setlinedash><code>setLineDash()</code></dfn> method is
  32953. invoked, it must run the following steps:</p>
  32954. <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
  32955. if any value is negative (less than zero), then abort these steps (without throwing an exception;
  32956. user agents could show a message on a developer console, though, as that would be helpful for
  32957. debugging).<li><p>If the number of elements in <var>a</var> is odd, then let <var>a</var>
  32958. 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>
  32959. <p>When the <dfn id=dom-context-2d-getlinedash><code>getLineDash()</code></dfn> method is
  32960. 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
  32961. list</a>, in the same order.</p>
  32962. <p>It is sometimes useful to change the "phase" of the dash pattern, e.g. to achieve a "marching
  32963. ants" effect. The phase can be set using the <dfn id=dom-context-2d-linedashoffset><code>lineDashOffset</code></dfn> attribute. On getting, it must
  32964. return the current value. On setting, infinite and NaN values must be ignored, leaving the value
  32965. unchanged; other values must change the current value to the new value.</p>
  32966. <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-7><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  32967. <code id=line-styles:dom-context-2d-linedashoffset-3><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code> attribute must initially have
  32968. the value 0.0.</p>
  32969. <hr>
  32970. <p>When a user agent is to <dfn id=trace-a-path>trace a path</dfn>, given an object <var>style</var>
  32971. that implements the <code id=line-styles:canvasdrawingstyles-8><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface, it must run the following
  32972. algorithm. This algorithm returns a new <a href=#concept-path id=line-styles:concept-path>path</a>.</p>
  32973. <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
  32974. just one point).<li><p>Replace each point in each subpath of <var>path</var> other than the first point
  32975. and the last point of each subpath by a <i>join</i> that joins the line leading to that point to
  32976. the line leading out of that point, such that the subpaths all consist of two points (a starting
  32977. point with a line leading out of it, and an ending point with a line leading into it), one or
  32978. more lines (connecting the points and the joins), and zero or more joins (each connecting one
  32979. line to another), connected together such that each subpath is a series of one or more lines with
  32980. 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
  32981. the last point and the first point of that subpath; change the last point to a join (from the
  32982. previously last line to the newly added closing line), and change the first point to a join (from
  32983. the newly added closing line to the first line).</p>
  32984. <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
  32985. 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>
  32986. <li><p>For each subpath <var>subpath</var> in <var>path</var>, run the
  32987. following substeps. These substeps mutate the subpaths in <var>path</var> <i>in
  32988. vivo</i>.</p>
  32989. <ol><li><p>Let <var>subpath width</var> be the length of all the lines of <var>subpath</var>, in coordinate space units.</p>
  32990. <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
  32991. units.<li>
  32992. <p>While <var>offset</var> is greater than <var>pattern width</var>,
  32993. decrement it by <var>pattern width</var>.</p>
  32994. <p>While <var>offset</var> is less than zero, increment it by <var>pattern
  32995. width</var>.</p>
  32996. <li><p>Define <var>L</var> to be a linear coordinate line defined along all lines in
  32997. <var>subpath</var>, such that the start of the first line in the subpath is defined
  32998. 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>
  32999. and <i>zero-on</i>).<li><p><i>Dash on</i>: Let <var>segment length</var> be
  33000. the value of the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-6>dash
  33001. 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>,
  33002. then end these substeps for this subpath and start them again for the next subpath; if there
  33003. 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
  33004. 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
  33005. <i>post-cut</i>.<li><p>If <var>start</var> is less than zero, then let <var>start</var> be
  33006. zero.<li><p>If <var>position</var> is greater than <var>subpath width</var>,
  33007. 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>
  33008. <p>Jump to the first appropriate step:</p>
  33009. <dl class=switch><dt>If <var>segment length</var> is zero and <var>current state</var> is
  33010. <i>off</i><dd>
  33011. <p>Do nothing, just continue to the next step.</p>
  33012. <dt>If <var>current state</var> is <i>off</i><dd>
  33013. <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;
  33014. 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>
  33015. <p>The point has a <i>directionality</i> for the purposes of drawing line caps (see below).
  33016. The directionality is the direction that the original line had at that point (i.e. when <var>L</var> was defined above).</p>
  33017. <dt>Otherwise<dd>
  33018. <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
  33019. 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
  33020. two, and then remove all line segments, joins, points, and subpaths that are between <var>start</var> and <var>end</var>.</p>
  33021. <p>If <var>start</var> and <var>end</var> are the same point, then this
  33022. results in just the line being cut in two and two points being inserted there, with nothing
  33023. being removed, unless a join also happens to be at that point, in which case the join must
  33024. be removed.</p>
  33025. </dl>
  33026. <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
  33027. the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-8>dash list</a>, then let <var>index</var> be
  33028. 0.<li><p>Return to the step labeled <i>dash on</i>.</ol>
  33029. <li>
  33030. <p><i>Convert</i>: This is the step that converts the path to a new path that represents its
  33031. stroke.</p>
  33032. <p>Create a new <a href=#concept-path id=line-styles:concept-path-2>path</a> that describes the edge of the areas
  33033. that would be covered if a straight line of length equal to the <var>styles</var>
  33034. <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
  33035. 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
  33036. described previously and elaborated below, and replacing each join with the join necessary to
  33037. satisfy the <var>styles</var> <code id=line-styles:dom-context-2d-linejoin-5><a href=#dom-context-2d-linejoin>lineJoin</a></code>
  33038. type, as defined below.</p>
  33039. <p><strong>Caps</strong>: Each point has a flat edge perpendicular to the direction of the line
  33040. 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
  33041. 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
  33042. 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
  33043. perpendicular to the direction of the line coming out of the point, must be added at each
  33044. point.</p>
  33045. <p>Points with no lines coming out of them must have two caps placed back-to-back as if it was
  33046. really two points connected to each other by an infinitesimally short straight line in the
  33047. direction of the point's <i>directionality</i> (as defined above).</p>
  33048. <p><strong>Joins</strong>: In addition to the point where a join occurs, two additional points
  33049. are relevant to each join, one for each line: the two corners found half the line width away
  33050. from the join point, one perpendicular to each line, each on the side furthest from the other
  33051. line.</p>
  33052. <p>A triangle connecting these two opposite corners with a straight line, with the third point
  33053. 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
  33054. rendered. The three aforementioned values have the following meanings:</p>
  33055. <p>The "<code>bevel"</code>" value means that this is all that is rendered at
  33056. joins.</p>
  33057. <p>The "<code>round"</code>" value means that an arc connecting the two aforementioned
  33058. corners of the join, abutting (and not overlapping) the aforementioned triangle, with the
  33059. diameter equal to the line width and the origin at the point of the join, must be added at
  33060. joins.</p>
  33061. <p>The "<code>miter"</code>" value means that a second triangle must (if it can given
  33062. the miter length) be added at the join, with one line being the line between the two
  33063. aforementioned corners, abutting the first triangle, and the other two being continuations of
  33064. the outside edges of the two joining lines, as long as required to intersect without going over
  33065. the miter length.</p>
  33066. <p>The miter length is the distance from the point where the join occurs to the intersection of
  33067. the line edges on the outside of the join. The miter limit ratio is the maximum allowed ratio of
  33068. the miter length to half the line width. If the miter length would cause the miter limit ratio
  33069. (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
  33070. triangle must not be added.</p>
  33071. <p>The subpaths in the newly created path must be oriented such that for any point, the number
  33072. of times a half-infinite straight line drawn from that point crosses a subpath is even if and
  33073. only if the number of times a half-infinite straight line drawn from that same point crosses a
  33074. subpath going in one direction is equal to the number of times it crosses a subpath going in the
  33075. other direction.</p>
  33076. <li><p>Return the newly created path.</ol>
  33077. <h6 id=text-styles>4.12.4.2.5 Text styles</h6>
  33078. <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>
  33079. <p>Returns the current font settings.</p>
  33080. <p>Can be set, to change the font. The syntax is the same as for the CSS 'font' property; values
  33081. that cannot be parsed as CSS font values are ignored.</p>
  33082. <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>
  33083. element.</p>
  33084. <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>
  33085. <p>Returns the current text alignment settings.</p>
  33086. <p>Can be set, to change the alignment. The possible values are and their meanings are given
  33087. below. Other values are ignored. The default is "<code>start</code>".</p>
  33088. <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>
  33089. <p>Returns the current baseline alignment settings.</p>
  33090. <p>Can be set, to change the baseline alignment. The possible values and their meanings are
  33091. 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>
  33092. <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>
  33093. <p>Returns the current directionality.</p>
  33094. <p>Can be set, to change the directionality. The possible values and their meanings are given
  33095. 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>
  33096. </dl>
  33097. <p>Objects that implement the <code id=text-styles:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface have attributes (defined
  33098. in this section) that control how text is laid out (rasterised or outlined) by the object. Such
  33099. objects can also have a <dfn id=font-style-source-object>font style source object</dfn>. For
  33100. <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
  33101. <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>
  33102. 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
  33103. <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
  33104. context</a> of the <code id=text-styles:window><a href=#window>Window</a></code> object on which the interface object of the
  33105. <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
  33106. 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
  33107. 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
  33108. object</a>.</p>
  33109. <p>The <dfn id=dom-context-2d-font><code>font</code></dfn> IDL attribute, on setting, must
  33110. be parsed the same way as the 'font' property of CSS (but without supporting property-independent
  33111. style sheet syntax like 'inherit'), and the resulting font must be assigned to the context, with
  33112. the 'line-height' component forced to 'normal', with the 'font-size' component converted to CSS
  33113. pixels, and with system fonts being computed to explicit values. If the new value is syntactically
  33114. incorrect (including using property-independent style sheet syntax like 'inherit' or 'initial'),
  33115. then it must be ignored, without assigning a new font value. <a href=#refsCSS>[CSS]</a></p>
  33116. <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
  33117. 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
  33118. <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
  33119. 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
  33120. 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
  33121. that font in scope at the time the font is to be used, then it must be treated as if it was an
  33122. unknown font, falling back to another as described by the relevant CSS specifications. <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
  33123. <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
  33124. no 'line-height' component). <a href=#refsCSSOM>[CSSOM]</a></p>
  33125. <div class=example>
  33126. <p>For example, after the following statement:</p>
  33127. <pre>context.font = 'italic 400 12px/2 Unknown Font, sans-serif';</pre>
  33128. <p>...the expression <code>context.font</code> would evaluate to the string "<code>italic 12px "Unknown Font", sans-serif</code>". The "400"
  33129. font-weight doesn't appear because that is the default value. The line-height doesn't appear
  33130. because it is forced to "normal", the default value.</p>
  33131. </div>
  33132. <p>When the object implementing the <code id=text-styles:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
  33133. font of the context must be set to 10px sans-serif. When the 'font-size' component is set to
  33134. lengths using percentages, 'em' or 'ex' units, or the 'larger' or 'smaller' keywords, these must
  33135. 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
  33136. source object</a> at the time that the attribute is set, if it is an element. When the
  33137. 'font-weight' component is set to the relative values 'bolder' and 'lighter', these must be
  33138. 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
  33139. source object</a> at the time that the attribute is set, if it is an element. If the computed
  33140. 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>
  33141. 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
  33142. interpreted relative to the normal-weight 10px sans-serif default.</p>
  33143. <p>The <dfn id=dom-context-2d-textalign><code>textAlign</code></dfn> IDL attribute, on
  33144. 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
  33145. value. Otherwise, the new value must be ignored. When the object implementing the
  33146. <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>
  33147. <p>The <dfn id=dom-context-2d-textbaseline><code>textBaseline</code></dfn> IDL attribute, on
  33148. 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
  33149. new value. Otherwise, the new value must be ignored. When the object implementing the
  33150. <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
  33151. <code id=text-styles:dom-context-2d-textbaseline-alphabetic-3><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>.</p>
  33152. <p>The <dfn id=dom-context-2d-direction><code>direction</code></dfn> IDL attribute, on
  33153. 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
  33154. new value. Otherwise, the new value must be ignored. When the object implementing the
  33155. <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>
  33156. <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
  33157. as follows:</p>
  33158. <dl><dt><dfn id=dom-context-2d-textalign-start><code>start</code></dfn>
  33159. <dd><p>Align to the start edge of the text (left side in left-to-right text, right side in
  33160. right-to-left text).<dt><dfn id=dom-context-2d-textalign-end><code>end</code></dfn>
  33161. <dd><p>Align to the end edge of the text (right side in left-to-right text, left side in
  33162. right-to-left text).<dt><dfn id=dom-context-2d-textalign-left><code>left</code></dfn>
  33163. <dd><p>Align to the left.<dt><dfn id=dom-context-2d-textalign-right><code>right</code></dfn>
  33164. <dd><p>Align to the right.<dt><dfn id=dom-context-2d-textalign-center><code>center</code></dfn>
  33165. <dd><p>Align to the center.</dl>
  33166. <p>The <code id=text-styles:dom-context-2d-textbaseline-4><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
  33167. attribute's allowed keywords correspond to alignment points in the
  33168. font:</p>
  33169. <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>
  33170. <p>The keywords map to these alignment points as follows:</p>
  33171. <dl><dt><dfn id=dom-context-2d-textbaseline-top><code>top</code></dfn>
  33172. <dd>The top of the em square<dt><dfn id=dom-context-2d-textbaseline-hanging><code>hanging</code></dfn>
  33173. <dd>The hanging baseline<dt><dfn id=dom-context-2d-textbaseline-middle><code>middle</code></dfn>
  33174. <dd>The middle of the em square<dt><dfn id=dom-context-2d-textbaseline-alphabetic><code>alphabetic</code></dfn>
  33175. <dd>The alphabetic baseline<dt><dfn id=dom-context-2d-textbaseline-ideographic><code>ideographic</code></dfn>
  33176. <dd>The ideographic baseline<dt><dfn id=dom-context-2d-textbaseline-bottom><code>bottom</code></dfn>
  33177. <dd>The bottom of the em square</dl>
  33178. <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
  33179. as follows:</p>
  33180. <dl><dt><dfn id=dom-context-2d-direction-ltr><code>ltr</code></dfn>
  33181. <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>
  33182. <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>
  33183. <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>
  33184. as appropriate.</dl>
  33185. <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
  33186. optional length <var>maxWidth</var>. It returns an array of glyph shapes, each positioned
  33187. on a common coordinate space, a <var>physical alignment</var> whose value is one of
  33188. <i>left</i>, <i>right</i>, and <i>center</i>, and an inline box. (Most callers of this
  33189. algorithm ignore the <var>physical alignment</var> and the inline box.)</p>
  33190. <ol><li><p>If <var>maxWidth</var> was provided but is less than or equal to zero, return an
  33191. 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
  33192. by that object's <code id=text-styles:dom-context-2d-font-4><a href=#dom-context-2d-font>font</a></code> attribute.<li>
  33193. <p>Apply the appropriate step from the following list to determine the value of <var>direction</var>:</p>
  33194. <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
  33195. 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
  33196. <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>
  33197. <li><p>Form a hypothetical infinitely-wide CSS line box containing a single inline box containing
  33198. the text <var>text</var>, with all the properties at their initial values except the
  33199. 'font' property of the inline box set to <var>font</var>, the 'direction' property of
  33200. the inline box set to <var>direction</var>, and the 'white-space' property set to 'pre'.
  33201. <a href=#refsCSS>[CSS]</a><li><p>If <var>maxWidth</var> was provided and the hypothetical width of the inline box
  33202. in the hypothetical line box is greater than <var>maxWidth</var> CSS pixels, then change
  33203. <var>font</var> to have a more condensed font (if one is available or if a reasonably
  33204. readable one can be synthesized by applying a horizontal scale factor to the font) or a smaller
  33205. font, and return to the previous step.<li>
  33206. <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>
  33207. <p>Horizontal position:</p>
  33208. <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
  33209. '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
  33210. 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
  33211. 'rtl'<dd>Let the <var>anchor point</var>'s horizontal position be the right edge of the
  33212. 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
  33213. and right edges of the inline box, and let <var>physical alignment</var> be <i>center</i>.</dl>
  33214. <p>Vertical position:</p>
  33215. <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
  33216. 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
  33217. 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
  33218. 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
  33219. 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
  33220. 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
  33221. the first available font of the inline box.</dl>
  33222. <li>
  33223. <p>Let <var>result</var> be an array constructed by iterating over each glyph in the
  33224. inline box from left to right (if any), adding to the array, for each glyph, the shape of the
  33225. glyph as it is in the inline box, positioned on a coordinate space using CSS pixels with its
  33226. origin is at the <var>anchor point</var>.</p>
  33227. <li><p>Return <var>result</var>, <var>physical alignment</var>, and the inline
  33228. box.</ol>
  33229. <h6 id=building-paths>4.12.4.2.6 Building paths</h6>
  33230. <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
  33231. more subpaths. Each subpath consists of a list of one or more points, connected by straight or
  33232. curved <dfn id=line-segments>line segments</dfn>, and a flag indicating whether the subpath is closed or not. A
  33233. closed subpath is one where the last point of the subpath is connected to the first point of the
  33234. subpath by a straight line. Subpaths with only one point are ignored when painting the path.</p>
  33235. <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
  33236. flag is set, certain APIs create a new subpath rather than extending the previous one. When a
  33237. <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
  33238. set.</p>
  33239. <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>
  33240. <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>
  33241. <p>Creates a new subpath with the given point.</p>
  33242. <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>
  33243. <p>Marks the current subpath as closed, and starts a new subpath with a point the same as the
  33244. start and end of the newly closed subpath.</p>
  33245. <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>
  33246. <p>Adds the given point to the current subpath, connected to the previous one by a straight
  33247. line.</p>
  33248. <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>
  33249. <p>Adds the given point to the current subpath, connected to the previous one by a quadratic
  33250. Bézier curve with the given control point.</p>
  33251. <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>
  33252. <p>Adds the given point to the current subpath, connected to the previous one by a cubic
  33253. Bézier curve with the given control points.</p>
  33254. <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>
  33255. <p>Adds an arc with the given control points and radius to the current subpath, connected to the
  33256. previous point by a straight line.</p>
  33257. <p>If two radii are provided, the first controls the width of the arc's ellipse, and the second
  33258. controls the height. If only one is provided, or if they are the same, the arc is from a circle.
  33259. In the case of an ellipse, the rotation argument controls the clockwise inclination of the
  33260. ellipse relative to the x-axis.</p>
  33261. <p>Throws an <code id=building-paths:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
  33262. <figure class=diagrams>
  33263. <img width=357 src=http://images.whatwg.org/arcTo1.png height=254 alt="">
  33264. <img width=468 src=http://images.whatwg.org/arcTo2.png height=310 alt="">
  33265. <img width=513 src=http://images.whatwg.org/arcTo3.png height=233 alt="">
  33266. </figure>
  33267. <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>
  33268. <p>Adds points to the subpath such that the arc described by the circumference of the circle
  33269. described by the arguments, starting at the given start angle and ending at the given end angle,
  33270. going in the given direction (defaulting to clockwise), is added to the path, connected to the
  33271. previous point by a straight line.</p>
  33272. <p>Throws an <code id=building-paths:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
  33273. <figure class=diagrams>
  33274. <img width=590 src=http://images.whatwg.org/arc1.png height=255 alt="">
  33275. </figure>
  33276. <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>
  33277. <p>Adds points to the subpath such that the arc described by the circumference of the ellipse
  33278. described by the arguments, starting at the given start angle and ending at the given end angle,
  33279. going in the given direction (defaulting to clockwise), is added to the path, connected to the
  33280. previous point by a straight line.</p>
  33281. <p>Throws an <code id=building-paths:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
  33282. <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>
  33283. <p>Adds a new closed subpath to the path, representing the given rectangle.</p>
  33284. </dl>
  33285. <p>The following methods allow authors to manipulate the <a href=#concept-path id=building-paths:concept-path-5>paths</a>
  33286. of objects implementing the <code id=building-paths:canvaspathmethods-3><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface.</p>
  33287. <p>For <code id=building-paths:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects, the points passed to the methods, and the
  33288. 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
  33289. according to the <a href=#transformations id=building-paths:transformations>current transformation matrix</a>
  33290. before being added to the path.</p>
  33291. <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
  33292. first (and only) point.</p>
  33293. <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
  33294. 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
  33295. 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
  33296. <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>
  33297. <p>The <dfn id=dom-context-2d-closepath><code>closePath()</code></dfn> method must do nothing
  33298. if the object's path has no subpaths. Otherwise, it must mark the last subpath as closed, create a
  33299. new subpath whose first point is the same as the previous subpath's first point, and finally add
  33300. this new subpath to the path.</p>
  33301. <p class=note>If the last subpath had more than one point in its list of points, then this is
  33302. equivalent to adding a straight line connecting the last point back to the first point, thus
  33303. "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>
  33304. <p>New points and the lines connecting them are added to subpaths using the methods described
  33305. below. In all cases, the methods only modify the last subpath in the object's path.</p>
  33306. <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
  33307. 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
  33308. (<var>x</var>, <var>y</var>) to the subpath.</p>
  33309. <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
  33310. point in the subpath to the given point (<var>x</var>, <var>y</var>) using a
  33311. 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>
  33312. <p>The <dfn id=dom-context-2d-beziercurveto><code>bezierCurveTo(<var>cp1x</var>,
  33313. <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
  33314. subpath</a> for <span>(<var>cp1x</var>, <var>cp1y</var>)</span>, and
  33315. 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>,
  33316. <var>cp1y</var>) and (<var>cp2x</var>, <var>cp2y</var>). Then, it must
  33317. add the point (<var>x</var>, <var>y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>
  33318. <hr>
  33319. <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>,
  33320. <var>radiusY</var>, <var>rotation</var>)</code></dfn> method must first
  33321. <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
  33322. subpath, as described below.</p>
  33323. <p>Negative values for <var>radiusX</var> or <var>radiusY</var> must cause the
  33324. implementation to throw an <code id=building-paths:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception. If <var>radiusY</var>
  33325. is omitted, user agents must act as if it had the same value as <var>radiusX</var>.</p>
  33326. <p>Let the point (<var>x0</var>, <var>y0</var>) be the last point in the
  33327. subpath, transformed by the inverse of the <a href=#transformations id=building-paths:transformations-2>current
  33328. transformation matrix</a> (so that it is in the same coordinate system as the points passed to
  33329. the method).</p>
  33330. <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
  33331. both <var>radiusX</var> and <var>radiusY</var> are zero, then the method must
  33332. add the point (<var>x1</var>, <var>y1</var>) to the subpath, and connect that
  33333. point to the previous point (<var>x0</var>, <var>y0</var>) by a straight
  33334. line.</p>
  33335. <p>Otherwise, if the points (<var>x0</var>, <var>y0</var>), (<var>x1</var>, <var>y1</var>), and (<var>x2</var>, <var>y2</var>)
  33336. all lie on a single straight line, then the method must add the point (<var>x1</var>,
  33337. <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>
  33338. <p>Otherwise, let <var>The Arc</var> be the shortest arc given by circumference of the
  33339. 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
  33340. to the half-infinite line that crosses the point (<var>x0</var>, <var>y0</var>)
  33341. and ends at the point (<var>x1</var>, <var>y1</var>), and that has a different
  33342. 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
  33343. points at which this ellipse touches these two lines are called the start and end tangent points
  33344. respectively. The method must connect the point (<var>x0</var>, <var>y0</var>)
  33345. to the start tangent point by a straight line, adding the start tangent point to the subpath, and
  33346. then must connect the start tangent point to the end tangent point by <var>The Arc</var>,
  33347. adding the end tangent point to the subpath.</p>
  33348. <hr>
  33349. <p>The <dfn id=dom-context-2d-arc><code>arc(<var>x</var>, <var>y</var>,
  33350. <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>
  33351. <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.
  33352. 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
  33353. <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
  33354. 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>
  33355. <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
  33356. proceed as follows. First, if the object's path has any subpaths, then the method must add a
  33357. straight line from the last point in the subpath to the start point of the arc. Then, it must add
  33358. the start and end points of the arc to the subpath, and connect them with an arc. The arc and its
  33359. start and end points are defined as follows:</p>
  33360. <p>Consider an ellipse that has its origin at (<var>x</var>, <var>y</var>), that
  33361. 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
  33362. inclined <var>rotation</var> radians clockwise from the x-axis.</p>
  33363. <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>
  33364. and <span><var>startAngle</var>-<var>endAngle</var></span> is equal
  33365. to or greater than <span>2π</span>, then the arc is the whole circumference of this
  33366. ellipse, and the point at <var>startAngle</var> along this circle's circumference,
  33367. measured in radians clockwise from the ellipse's semi-major axis, acts as both the start point and
  33368. the end point.</p>
  33369. <p>Otherwise, the points at <var>startAngle</var> and <var>endAngle</var>
  33370. along this circle's circumference, measured in radians clockwise from the ellipse's semi-major
  33371. axis, are the start and end points respectively, and the arc is the path along the circumference
  33372. 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
  33373. the ellipse, as opposed to being simply angles from zero, the arc can never cover an angle greater
  33374. than <span>2π</span> radians.</p>
  33375. <p class=note>Even if the arc covers the entire circumference of the ellipse and there are no
  33376. 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>
  33377. <p>Negative values for <var>radiusX</var> or <var>radiusY</var> must cause the
  33378. implementation to throw an <code id=building-paths:indexsizeerror-5><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  33379. <hr>
  33380. <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
  33381. a new subpath containing just the four points (<var>x</var>, <var>y</var>),
  33382. (<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
  33383. points connected by straight lines, and must then mark the subpath as closed. It must then create
  33384. a new subpath with the point (<var>x</var>, <var>y</var>) as the only point in
  33385. the subpath.</p>
  33386. <h6 id=path2d-objects>4.12.4.2.7 <code id=path2d-objects:path2d><a href=#path2d>Path2D</a></code> objects</h6>
  33387. <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
  33388. <code id=path2d-objects:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects. In addition to many of the APIs described in
  33389. 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
  33390. paths.</p>
  33391. <dl class=domintro><dt><var>path</var> = new <code id=path2d-objects:dom-path2d><a href=#dom-path2d>Path2D</a></code>()<dd>
  33392. <p>Creates a new empty <code id=path2d-objects:path2d-4><a href=#path2d>Path2D</a></code> object.</p>
  33393. <dt><var>path</var> = new <code id=path2d-objects:dom-path2d-copy><a href=#dom-path2d-copy>Path2D</a></code>(<var>path</var>)<dd>
  33394. <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>
  33395. <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>
  33396. <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>
  33397. <dt><var>path</var> = new <code id=path2d-objects:dom-path2d-withdata><a href=#dom-path2d-withdata>Path2D</a></code>(<var>d</var>)<dd>
  33398. <p>Creates a new path with the path described by the argument, interpreted as SVG path data. <a href=#refsSVG>[SVG]</a></p>
  33399. <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>
  33400. <p>Adds to the path the path given by the argument.</p>
  33401. <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
  33402. <code id=path2d-objects:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>
  33403. <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>
  33404. <p>Adds to the path a series of subpaths corresponding to the given text. If the arguments give
  33405. a coordinate, the text is drawn horizontally at the given coordinates. If the arguments give a
  33406. path, the text is drawn along the path. If a maximum width is provided, the text will be scaled
  33407. to fit that width if necessary.</p>
  33408. <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
  33409. <code id=path2d-objects:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>
  33410. </dl>
  33411. <p>The <dfn id=dom-path2d><code>Path2D()</code></dfn> constructor, when invoked, must return a
  33412. newly created <code id=path2d-objects:path2d-7><a href=#path2d>Path2D</a></code> object.</p>
  33413. <hr>
  33414. <p>The <dfn id=dom-path2d-copy><code>Path2D(<var>path</var>)</code></dfn>
  33415. constructor, when invoked, must return a newly created <code id=path2d-objects:path2d-8><a href=#path2d>Path2D</a></code> object, to which the
  33416. subpaths of the argument are added. (In other words, it returns a copy of the argument.)</p>
  33417. <hr>
  33418. <p>The <dfn id=dom-path2d-merge><code>Path2D(<var>paths</var>, <var>fillRule</var>)</code></dfn> constructor, when invoked, must run the following
  33419. steps:</p>
  33420. <ol><li>
  33421. <p>Run the appropriate step from the following list, based on the constructor's sectond
  33422. argument:</p>
  33423. <dl class=switch><dt>If it is "nonzero"<dd>
  33424. <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path>path</a> that
  33425. consists of a set of non-overlapping subpaths that exactly outline the points from which, in
  33426. any of the <a href=#concept-path id=path2d-objects:concept-path-2>paths</a> provided in the constructor's first
  33427. argument, the number of times a half-infinite straight line drawn from that point crosses a
  33428. subpath going in one direction is not equal to the number of times it crosses a subpath going
  33429. in the other direction.</p>
  33430. <dt>If it is "evenodd"<dd>
  33431. <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-3>path</a> that
  33432. consists of a set of non-overlapping subpaths that exactly outline the points from which, in
  33433. any of the <a href=#concept-path id=path2d-objects:concept-path-4>paths</a> provided in the constructor's first
  33434. argument, the number of times a half-infinite straight line drawn from that point crosses that
  33435. path is odd.</p>
  33436. </dl>
  33437. <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
  33438. the number of times a half-infinite straight line drawn from that point crosses a subpath is
  33439. even if and only if the number of times a half-infinite straight line drawn from that same point
  33440. crosses a subpath going in one direction is equal to the number of times it crosses a subpath
  33441. going in the other direction.</p>
  33442. <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>
  33443. 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>
  33444. <hr>
  33445. <p>The <dfn id=dom-path2d-withdata><code>Path2D(<var>d</var>)</code></dfn>
  33446. constructor must run the following steps:</p>
  33447. <ol><li>
  33448. <p>Parse and interpret the <var>d</var> argument according to the SVG specification's
  33449. rules for path data, thus obtaining an SVG path. <a href=#refsSVG>[SVG]</a></p>
  33450. <p class=note>The resulting path could be empty. SVG defines error handling rules for parsing
  33451. and applying path data.</p>
  33452. <li><p>Let (<var>x</var>, <var>y</var>) be the last point in the SVG
  33453. 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,
  33454. to that <code id=path2d-objects:path2d-12><a href=#path2d>Path2D</a></code> object. </p>
  33455. <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>
  33456. <hr>
  33457. <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>
  33458. <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
  33459. 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
  33460. <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
  33461. 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>
  33462. <hr>
  33463. <p>The <dfn id=dom-path2d-addpathbystrokingpath><code>addPathByStrokingPath(<var>b</var>, <var>styles</var>, <var>transform</var>)</code></dfn>
  33464. method, when invoked on a <code id=path2d-objects:path2d-17><a href=#path2d>Path2D</a></code> object <var>a</var>, must run the
  33465. following steps:</p>
  33466. <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
  33467. 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
  33468. <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
  33469. line styles.</p>
  33470. <li><p>Let (<var>x</var>, <var>y</var>) be the last point in the last subpath
  33471. 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>
  33472. <hr>
  33473. <p>The <dfn id=dom-path2d-addtext><code>addText()</code></dfn> and <dfn id=dom-path2d-addpathbystrokingtext><code>addPathByStrokingText()</code></dfn> methods each
  33474. come in two variants: one rendering text at a given coordinate, and one rendering text along a
  33475. given path. In both cases, the methods take a <code id=path2d-objects:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for
  33476. 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>
  33477. <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
  33478. argument an (<var>x</var>, <var>y</var>) coordinate is invoked, the method
  33479. must run the following algorithm:</p>
  33480. <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
  33481. <code id=path2d-objects:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var>maxWidth</var>
  33482. argument was provided, that argument. Let <var>glyphs</var> be the result.</p>
  33483. <li><p>Move all the shapes in <var>glyphs</var> to the right by <var>x</var>
  33484. 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>
  33485. describing the shapes given in <var>glyphs</var>, with each CSS pixel in the coordinate
  33486. space of <var>glyphs</var> mapped to one coordinate space unit in <var>glyph
  33487. paths</var>. Subpaths in <var>glyph paths</var> must wind clockwise, regardless of how
  33488. the user agent's font subsystem renders fonts and regardless of how the fonts themselves are
  33489. defined.</p>
  33490. <li><p>Transform all the coordinates and lines in <var>glyph paths</var> by the
  33491. 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
  33492. <a href=#concept-path id=path2d-objects:concept-path-6>path</a> in <var>glyph paths</var>, using the
  33493. <code id=path2d-objects:canvasdrawingstyles-3><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for the line styles.</p>
  33494. <li id=mergeGlyphs>
  33495. <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-7>path</a> that
  33496. consists of a set of non-overlapping subpaths that exactly outline the points from which, in any
  33497. of the <a href=#concept-path id=path2d-objects:concept-path-8>paths</a> in <var>glyph paths</var>, the number
  33498. of times a half-infinite straight line drawn from that point crosses that path is odd.</p>
  33499. <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
  33500. the number of times a half-infinite straight line drawn from that point crosses a subpath is
  33501. even if and only if the number of times a half-infinite straight line drawn from that same point
  33502. crosses a subpath going in one direction is equal to the number of times it crosses a subpath
  33503. going in the other direction.</p>
  33504. <div class=example>
  33505. <p>For example, suppose <var>text</var> consists of two overlapping glyphs "Q" and
  33506. "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
  33507. outside of the letter shape, and one for the inside of the letter shape. There are points that,
  33508. according to the even-odd fill rule, are filled in both shapes simultaneously: where they
  33509. overlap. As such, the subpaths from the two glyphs actually cross each other.</p>
  33510. <p><img src=http://images.whatwg.org/Qp-overlap.png alt=""></p>
  33511. <p>The resulting <var>merged path</var> in such a situation would have just one path
  33512. for these two letters, with a total of just three subpaths (one big outer outline, one for the
  33513. inside of the "Q", and one for inside of the "p"). This single path would have no subpaths that
  33514. cross each other.</p>
  33515. <p><img src=http://images.whatwg.org/Qp-overlap-outline.png alt=""></p>
  33516. </div>
  33517. <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>
  33518. 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>
  33519. <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
  33520. 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>
  33521. <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
  33522. 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
  33523. 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
  33524. <code id=path2d-objects:canvasdrawingstyles-4><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var>maxWidth</var>
  33525. argument was provided, that argument. Let <var>glyphs</var> be the resulting array, and
  33526. <var>physical alignment</var> be the resulting alignment value.</p>
  33527. <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
  33528. first point of that subpath.<li><p>Define <var>L</var> to be a linear coordinate line for of all the subpaths in
  33529. <var>path</var>, with additional lines drawn between the last point and the first point
  33530. of each closed subpath, such that the first point of the first subpath is defined as point 0, and
  33531. the last point of the last subpath, if the last subpath is not closed, or the second occurrence
  33532. first point of that subpath, if it is closed, is defined as point <var>width</var>.<li>
  33533. <p>Let <var>offset</var> be determined according to the appropriate step below:</p>
  33534. <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>
  33535. <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>
  33536. <p>For each glyph <var>glyph</var> in the <var>glyphs</var> array, run these
  33537. substeps:</p>
  33538. <ol><li><p>Let <var>dx</var> be the <var>x</var>-coordinate of the horizontal
  33539. center of the bounding box of the shape described by <var>glyph</var>, in CSS
  33540. pixels.<li><p>If <var>dx</var> is negative or greater than <var>width</var>, skip
  33541. the remainder of these substeps for this glyph.<li><p>Recast <var>dx</var> to coordinate spaces units in <var>path</var>.
  33542. (This just changes the dimensionality of <var>dx</var>, not its numeric value.)</p>
  33543. <li><p>Find the point <var>p</var> on <var>path</var> (or implied closing
  33544. lines in <var>path</var>) that corresponds to the position <var>dx</var> on
  33545. the coordinate line <var>L</var>.</p>
  33546. <li><p>Let <var>θ</var> be the clockwise angle from the positive x-axis to the
  33547. 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
  33548. 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
  33549. 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>.
  33550. Subpaths in <var>glyph subpaths</var> must wind clockwise, regardless of how the user
  33551. agent's font subsystem renders fonts and regardless of how the fonts themselves are
  33552. defined.</p>
  33553. <li><p>Transform all the coordinates and lines in <var>glyph subpaths</var> by the
  33554. 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
  33555. the line styles.</p>
  33556. <li><p>Add all the subpaths in <var>glyph subpaths</var> to <var>transformed path list</var>.</ol>
  33557. <li>
  33558. <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-9>path</a> that
  33559. consists of a set of non-overlapping subpaths that exactly outline the points from which, in any
  33560. of the <a href=#concept-path id=path2d-objects:concept-path-10>paths</a> in <var>transformed path list</var>,
  33561. the number of times a half-infinite straight line drawn from that point crosses that path is
  33562. odd.</p>
  33563. <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
  33564. the number of times a half-infinite straight line drawn from that point crosses a subpath is
  33565. even if and only if the number of times a half-infinite straight line drawn from that same point
  33566. crosses a subpath going in one direction is equal to the number of times it crosses a subpath
  33567. going in the other direction.</p>
  33568. <p class=note>See <a href=#mergeGlyphs>the equivalent step in the earlier algorithm</a> for
  33569. an example of this step. It's even more likely that there will be overlap with this method,
  33570. since neighboring glyphs are likely to be rotated relative to each other.</p>
  33571. <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>
  33572. <h6 id=transformations>4.12.4.2.8 <dfn>Transformations</dfn></h6>
  33573. <p>Each <code id=transformations:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object has a <i>current transformation matrix</i>,
  33574. as well as methods (described in this section) to manipulate it. When a
  33575. <code id=transformations:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, its transformation matrix must be
  33576. initialised to the identity transform.</p>
  33577. <p>The transformation matrix is applied to coordinates when creating the <a href=#current-default-path id=transformations:current-default-path>current default
  33578. path</a>, and when painting text, shapes, and <code id=transformations:path2d><a href=#path2d>Path2D</a></code> objects, on
  33579. <code id=transformations:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects.</p>
  33580. <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
  33581. remains mostly for historical reasons.</p>
  33582. <p>The transformations must be performed in reverse order.</p>
  33583. <p class=note>For instance, if a scale transformation that doubles the width is applied to the
  33584. canvas, followed by a rotation transformation that rotates drawing operations by a quarter turn,
  33585. and a rectangle twice as wide as it is tall is then drawn on the canvas, the actual result will be
  33586. a square.</p>
  33587. <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>
  33588. <p>Returns the transformation matrix, as an <code id=transformations:svgmatrix-2><a href=#svgmatrix>SVGMatrix</a></code> object.</p>
  33589. <p>Can be set, to change the transformation matrix.</p>
  33590. <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>
  33591. <p>Changes the transformation matrix to apply a scaling transformation with the given characteristics.</p>
  33592. <dt><var>context</var> . <code id=transformations:dom-context-2d-rotate><a href=#dom-context-2d-rotate>rotate</a></code>(<var>angle</var>)<dd>
  33593. <p>Changes the transformation matrix to apply a rotation transformation with the given characteristics. The angle is in radians.</p>
  33594. <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>
  33595. <p>Changes the transformation matrix to apply a translation transformation with the given characteristics.</p>
  33596. <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>
  33597. <p>Changes the transformation matrix to apply the matrix given by the arguments as described below.</p>
  33598. <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>
  33599. <p>Changes the transformation matrix <em>to</em> the matrix given by the arguments as described below.</p>
  33600. <dt><var>context</var> . <code id=transformations:dom-context-2d-resettransform><a href=#dom-context-2d-resettransform>resetTransform</a></code>()<dd>
  33601. <p>Changes the transformation matrix to the identity transform.</p>
  33602. </dl>
  33603. <p>The <dfn id=dom-context-2d-currenttransform><code>currentTransform</code></dfn>, on
  33604. getting, must return the last object that it was set to. On setting, its value must be changed to
  33605. the new value, and the transformation matrix must be updated to match the matrix described by the
  33606. 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
  33607. created <code id=transformations:svgmatrix-3><a href=#svgmatrix>SVGMatrix</a></code> object. When the transformation matrix is mutated by the methods
  33608. described in this section, the last <code id=transformations:svgmatrix-4><a href=#svgmatrix>SVGMatrix</a></code> object to which the attribute has been
  33609. set must be mutated in a corresponding fashion.</p>
  33610. <p>The <dfn id=dom-context-2d-scale><code>scale(<var>x</var>, <var>y</var>)</code></dfn>
  33611. method must add the scaling transformation described by the arguments to the transformation
  33612. matrix. The <var>x</var> argument represents the scale factor in the horizontal direction and the
  33613. <var>y</var> argument represents the scale factor in the vertical direction. The factors are
  33614. multiples.</p>
  33615. <p>The <dfn id=dom-context-2d-rotate><code>rotate(<var>angle</var>)</code></dfn> method must
  33616. add the rotation transformation described by the argument to the transformation matrix. The
  33617. <var>angle</var> argument represents a clockwise rotation angle expressed in radians.</p>
  33618. <p>The <dfn id=dom-context-2d-translate><code>translate(<var>x</var>,
  33619. <var>y</var>)</code></dfn> method must add the translation transformation described by the
  33620. arguments to the transformation matrix. The <var>x</var> argument represents the translation
  33621. distance in the horizontal direction and the <var>y</var> argument represents the translation
  33622. distance in the vertical direction. The arguments are in coordinate space units.</p>
  33623. <p>The <dfn id=dom-context-2d-transform><code>transform(<var>a</var>, <var>b</var>,
  33624. <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)</code></dfn> method must replace the
  33625. current transformation matrix with the result of multiplying the current transformation matrix
  33626. with the matrix described by:</p>
  33627. <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>
  33628. <p class=note>The arguments <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,
  33629. <var>e</var>, and <var>f</var> are sometimes called <var>m11</var>, <var>m12</var>,
  33630. <var>m21</var>, <var>m22</var>, <var>dx</var>, and <var>dy</var> or <var>m11</var>,
  33631. <var>m21</var>, <var>m12</var>, <var>m22</var>, <var>dx</var>, and <var>dy</var>. Care should be
  33632. taken in particular with the order of the second and third arguments (<var>b</var> and
  33633. <var>c</var>) as their order varies from API to API and APIs sometimes use the notation
  33634. <var>m12</var>/<var>m21</var> and sometimes <var>m21</var>/<var>m12</var> for those positions.</p>
  33635. <p>The <dfn id=dom-context-2d-settransform><code>setTransform(<var>a</var>, <var>b</var>,
  33636. <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)</code></dfn> method must reset the current
  33637. 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>,
  33638. <var>d</var>, <var>e</var>, <var>f</var>)</code> method with the same arguments.</p>
  33639. <p>The <dfn id=dom-context-2d-resettransform><code>resetTransform()</code></dfn> method must
  33640. reset the current transform to the identity matrix.</p>
  33641. <h6 id=image-sources-for-2d-rendering-contexts>4.12.4.2.9 Image sources for 2D rendering contexts</h6>
  33642. <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
  33643. <code id=image-sources-for-2d-rendering-contexts:canvasimagesource><a href=#canvasimagesource>CanvasImageSource</a></code> as an argument.</p>
  33644. <p>This union type allows objects implementing any of the following interfaces to be used as image
  33645. sources:</p>
  33646. <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>
  33647. <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
  33648. image-representing types, including <code id=image-sources-for-2d-rendering-contexts:imagedata><a href=#imagedata>ImageData</a></code>.</p>
  33649. <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>
  33650. 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
  33651. user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
  33652. <i>aborted</i>:</p>
  33653. <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
  33654. is in the <a href=#img-error id=image-sources-for-2d-rendering-contexts:img-error>broken</a> state, then throw an
  33655. <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>
  33656. <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
  33657. is not <a href=#img-good id=image-sources-for-2d-rendering-contexts:img-good>fully decodable</a>, or if the <var>image</var>
  33658. 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
  33659. 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
  33660. an intrinsic width or intrinsic height (or both) equal to zero, then return <i>bad</i> and abort
  33661. these steps.</p>
  33662. <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
  33663. either a horizontal dimension or a vertical dimension equal to zero, then return <i>bad</i> and
  33664. abort these steps.</p>
  33665. <li><p>Return <i>good</i>.</ol>
  33666. <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
  33667. element's image must be used as the source image.</p>
  33668. <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
  33669. <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
  33670. one that the format defines is to be used when animation is not supported or is disabled), or, if
  33671. there is no such image, the first frame of the animation, when rendering the image for
  33672. <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> APIs.</p>
  33673. <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
  33674. 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
  33675. invoked must be used as the source image when rendering the image for
  33676. <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>
  33677. (i.e. after any aspect-ratio correction has been applied).</p>
  33678. <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
  33679. element's bitmap must be used as the source image.</p>
  33680. <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
  33681. 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>
  33682. <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
  33683. rendered</a> and that element has been resized, the original image data of the source image
  33684. 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
  33685. <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
  33686. 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>
  33687. APIs).</p>
  33688. <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
  33689. object's bitmap image data must be used as the source image.</p>
  33690. <p><dfn id=the-image-argument-is-not-origin-clean>The <var>image argument</var> is not origin-clean</dfn> if it is an
  33691. <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
  33692. 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
  33693. 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
  33694. <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>
  33695. <h6 id=fill-and-stroke-styles>4.12.4.2.10 Fill and stroke styles</h6>
  33696. <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>
  33697. <p>Returns the current style used for filling shapes.</p>
  33698. <p>Can be set, to change the fill style.</p>
  33699. <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
  33700. <code id=fill-and-stroke-styles:canvaspattern><a href=#canvaspattern>CanvasPattern</a></code> object. Invalid values are ignored.</p>
  33701. <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>
  33702. <p>Returns the current style used for stroking shapes.</p>
  33703. <p>Can be set, to change the stroke style.</p>
  33704. <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
  33705. <code id=fill-and-stroke-styles:canvaspattern-2><a href=#canvaspattern>CanvasPattern</a></code> object. Invalid values are ignored.</p>
  33706. </dl>
  33707. <p>The <dfn id=dom-context-2d-fillstyle><code>fillStyle</code></dfn> attribute represents the
  33708. colour or style to use inside shapes, and the <dfn id=dom-context-2d-strokestyle><code>strokeStyle</code></dfn> attribute represents the colour
  33709. or style to use for the lines around the shapes.</p>
  33710. <p>Both attributes can be either strings, <code id=fill-and-stroke-styles:canvasgradient-3><a href=#canvasgradient>CanvasGradient</a></code>s, or
  33711. <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 &lt;color> values</a> and the colour assigned, and
  33712. <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
  33713. &lt;color> value</a>, then it must be ignored, and the attribute must retain its previous
  33714. value.
  33715. 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
  33716. 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
  33717. false.
  33718. </p>
  33719. <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
  33720. is <a href=#live id=fill-and-stroke-styles:live>live</a>, meaning that changes made to the object after the assignment do affect
  33721. subsequent stroking or filling of shapes.</p>
  33722. <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
  33723. <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
  33724. returned. (Such objects are opaque and therefore only useful for assigning to other attributes or
  33725. for comparison to other gradients or patterns.)</p>
  33726. <p>The <dfn id=serialisation-of-a-colour>serialisation of a colour</dfn> for a colour value is a string, computed as follows: if
  33727. it has alpha equal to 1.0, then the string is a lowercase six-digit hex value, prefixed with a "#"
  33728. character (U+0023 NUMBER SIGN), with the first two digits representing the red component, the next
  33729. two digits representing the green component, and the last two digits representing the blue
  33730. 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
  33731. has alpha less than 1.0, and the string is the colour value in the CSS <code>rgba()</code>
  33732. functional-notation format: the literal string "<code>rgba</code>" (U+0072 U+0067 U+0062
  33733. U+0061) followed by a U+0028 LEFT PARENTHESIS, a base-ten integer in the range 0-255 representing
  33734. 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
  33735. U+002C COMMA and U+0020 SPACE, an integer for the green component, a comma and a space, an integer
  33736. for the blue component, another comma and space, a U+0030 DIGIT ZERO, if the alpha value is
  33737. greater than zero then a U+002E FULL STOP (representing the decimal point), if the alpha value is
  33738. 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
  33739. the alpha, and finally a U+0029
  33740. RIGHT PARENTHESIS. User agents must express the fractional part of the alpha value, if any, with
  33741. the level of precision necessary for the alpha value, when reparsed, to be interpreted as the same
  33742. alpha value.</p>
  33743. <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
  33744. must initially have the string value <code>#000000</code>.</p>
  33745. <p>When the value is a colour, it must not be affected by the transformation matrix when used to
  33746. draw on bitmaps.</p>
  33747. <hr>
  33748. <p>There are two types of gradients, linear gradients and radial gradients, both represented by
  33749. objects implementing the opaque <code id=fill-and-stroke-styles:canvasgradient-7><a href=#canvasgradient>CanvasGradient</a></code> interface.</p>
  33750. <p id=interpolation>Once a gradient has been created (see below), stops are placed along it to
  33751. define how the colours are distributed along the gradient. The colour of the
  33752. gradient at each stop is the colour specified for that stop. Between each such stop, the colours and
  33753. the alpha component must be linearly interpolated over the RGBA space without premultiplying the
  33754. alpha value to find the colour to use at that offset. Before the first stop, the colour must be the
  33755. colour of the first stop. After the last stop, the colour must be the colour of the last stop. When
  33756. there are no stops, the gradient is transparent black.</p>
  33757. <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>
  33758. <p>Adds a colour stop with the given colour to the gradient at the given offset. 0.0 is the offset
  33759. at one end of the gradient, 1.0 is the offset at the other end.</p>
  33760. <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
  33761. <code id=fill-and-stroke-styles:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception if the colour cannot be parsed.</p>
  33762. <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>
  33763. <p>Returns a <code id=fill-and-stroke-styles:canvasgradient-8><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
  33764. linear gradient that paints along the line given by the
  33765. coordinates represented by the arguments.</p>
  33766. <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>
  33767. <p>Returns a <code id=fill-and-stroke-styles:canvasgradient-9><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
  33768. radial gradient that paints along the cone given by the circles
  33769. represented by the arguments.</p>
  33770. <p>If either of the radii are negative, throws an
  33771. <code id=fill-and-stroke-styles:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
  33772. </dl>
  33773. <p>The <dfn id=dom-canvasgradient-addcolorstop><code>addColorStop(<var>offset</var>,
  33774. <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
  33775. new stop to a gradient. If the <var>offset</var> is less than 0 or greater than 1 then an
  33776. <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
  33777. <a href=#parsed-as-a-css-color-value id=fill-and-stroke-styles:parsed-as-a-css-color-value-3>parsed as a CSS &lt;color> value</a>, then a <code id=fill-and-stroke-styles:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception must
  33778. 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 &lt;color> value. If multiple stops are added at the same offset
  33779. on a gradient, they must be placed in the order added, with the first one closest to the start of
  33780. the gradient, and each subsequent one infinitesimally further along towards the end point (in
  33781. effect causing all but the first and last stop added at each point to be ignored).</p>
  33782. <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>
  33783. initialised with the specified line.</p>
  33784. <p>Linear gradients must be rendered such that all points on a line perpendicular to the line that
  33785. crosses the start and end points have the colour at the point where those two lines cross (with the
  33786. colours coming from the <a href=#interpolation>interpolation and extrapolation</a> described
  33787. 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>
  33788. <p>If <span><var>x0</var> = <var>x1</var></span> and <span><var>y0</var> = <var>y1</var></span>, then the linear
  33789. gradient must paint nothing.</p>
  33790. <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
  33791. three representing the start circle with origin (<var>x0</var>, <var>y0</var>)
  33792. and radius <var>r0</var>, and the last three representing the end circle with origin
  33793. (<var>x1</var>, <var>y1</var>) and radius <var>r1</var>. The values are
  33794. in coordinate space units. If either of <var>r0</var> or <var>r1</var> are
  33795. negative, an <code id=fill-and-stroke-styles:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown. Otherwise, the method must
  33796. return a radial <code id=fill-and-stroke-styles:canvasgradient-12><a href=#canvasgradient>CanvasGradient</a></code> initialised with the two specified circles.</p>
  33797. <p>Radial gradients must be rendered by following these steps:</p>
  33798. <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
  33799. paint nothing. Abort these steps.<li>
  33800. <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>
  33801. <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>
  33802. <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>
  33803. <p>Let the colour at <var>ω</var> be the colour at that position on the gradient
  33804. (with the colours coming from the <a href=#interpolation>interpolation and extrapolation</a>
  33805. described above).</p>
  33806. <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
  33807. radius <span>r(<var>ω</var>)</span> at position (<span>x(<var>ω</var>)</span>, <span>y(<var>ω</var>)</span>), with the
  33808. colour at <var>ω</var>, but only painting on the parts of the bitmap that have not
  33809. yet been painted on by earlier circles in this step for this rendering of the gradient.</ol>
  33810. <p class=note>This effectively creates a cone, touched by the two circles defined in the
  33811. creation of the gradient, with the part of the cone before the start circle (0.0) using the colour
  33812. of the first offset, the part of the cone after the end circle (1.0) using the colour of the last
  33813. offset, and areas outside the cone untouched by the gradient (transparent black).</p>
  33814. <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>
  33815. <p>Gradients must be painted only where the relevant stroking or filling effects requires that
  33816. they be drawn.</p>
  33817. <hr>
  33818. <p>Patterns are represented by objects implementing the opaque <code id=fill-and-stroke-styles:canvaspattern-8><a href=#canvaspattern>CanvasPattern</a></code>
  33819. interface.</p>
  33820. <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>
  33821. <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
  33822. direction(s) given by the <var>repetition</var> argument.</p>
  33823. <p>The allowed values for <var>repetition</var> are <code>repeat</code> (both
  33824. directions), <code>repeat-x</code> (horizontal only), <code>repeat-y</code>
  33825. (vertical only), and <code>no-repeat</code> (neither). If the <var>repetition</var> argument is empty, the value <code>repeat</code> is used.</p>
  33826. <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no
  33827. data, throws an <code id=fill-and-stroke-styles:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
  33828. <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>
  33829. <p>Sets the transformation matrix that will be used when rendering the pattern during a fill or
  33830. stroke painting operation.</p>
  33831. </dl>
  33832. <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
  33833. must run the following steps:</p>
  33834. <ol><li><p>Let <var>image</var> be the first argument and <var>repetition</var> be
  33835. 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
  33836. returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
  33837. abort these steps. If it returns <i>bad</i>, then return null and abort these steps. Otherwise it
  33838. 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>
  33839. <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
  33840. "<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>
  33841. 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>
  33842. 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
  33843. <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
  33844. origin-clean</dfn>.<li><p>Return the <code id=fill-and-stroke-styles:canvaspattern-12><a href=#canvaspattern>CanvasPattern</a></code> object.</ol>
  33845. <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
  33846. 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
  33847. not affect the pattern(s) rendered by the <code id=fill-and-stroke-styles:canvaspattern-14><a href=#canvaspattern>CanvasPattern</a></code> object.</p>
  33848. <p>Patterns have a transformation matrix, which controls how the pattern is used when it is
  33849. painted. Initially, a pattern's transformation matrix must be the identity transform.</p>
  33850. <p>When the <dfn id=dom-canvaspattern-settransform><code>setTransform()</code></dfn> method
  33851. is invoked on the pattern, the user agent must replace the pattern's transformation matrix with
  33852. 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>
  33853. <p>When a pattern is to be rendered within an area, the user agent must run the following steps to
  33854. determine what is rendered:</p>
  33855. <ol><li><p>Create an infinite transparent black bitmap.<li>
  33856. <p>Place a copy of the image on the bitmap, anchored such that its top left corner is at the
  33857. origin of the coordinate space, with one coordinate space unit per CSS pixel of the image, then
  33858. place repeated copies of this image horizontally to the left and right, if the repetition
  33859. behavior is "<code>repeat-x</code>", or vertically up and down, if the repetition
  33860. behavior is "<code>repeat-y</code>", or in all four directions all over the bitmap, if
  33861. the repetition behavior is "<code>repeat</code>".</p>
  33862. <p>If the original image data is a bitmap image, the value painted at a point in the area of the
  33863. 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
  33864. false, the image must be rendered using nearest-neighbor interpolation. Otherwise, the user agent
  33865. may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). When
  33866. such a filtering algorithm requires a pixel value from outside the original image data, it must
  33867. instead use the value from wrapping the pixel's coordinates to the original image's dimensions.
  33868. (That is, the filter uses 'repeat' behavior, regardless of the value of the pattern's repetition
  33869. behavior.)</p>
  33870. <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
  33871. transparent black.<li><p>The resulting bitmap is what is to be rendered, with the same origin and same
  33872. scale.</ol>
  33873. <hr>
  33874. <p>If a radial gradient or repeated pattern is used when the transformation matrix is singular,
  33875. the resulting style must be transparent black (otherwise the gradient or pattern would be
  33876. collapsed to a point or line, leaving the other pixels undefined). Linear gradients and solid
  33877. colours always define all points even with singular tranformation matrices.</p>
  33878. <h6 id=drawing-rectangles-to-the-bitmap>4.12.4.2.11 Drawing rectangles to the bitmap</h6>
  33879. <p>There are three methods that immediately draw rectangles to the bitmap. They each take four
  33880. arguments; the first two give the <var>x</var> and <var>y</var> coordinates of
  33881. the top left of the rectangle, and the second two give the width <var>w</var> and height
  33882. <var>h</var> of the rectangle, respectively.</p>
  33883. <p>The <a href=#transformations id=drawing-rectangles-to-the-bitmap:transformations>current transformation matrix</a> must be
  33884. applied to the following four coordinates, which form the path that must then be closed to get the
  33885. 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>
  33886. <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
  33887. 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
  33888. 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>
  33889. <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>
  33890. <p>Clears all pixels on the bitmap in the given rectangle to transparent black.</p>
  33891. <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>
  33892. <p>Paints the given rectangle onto the bitmap, using the current fill style.</p>
  33893. <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>
  33894. <p>Paints the box that outlines the given rectangle onto the bitmap, using the current stroke
  33895. style.</p>
  33896. </dl>
  33897. <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
  33898. following steps:</p>
  33899. <ol><li><p>Let <var>pixels</var> be the set of pixels in the specified rectangle that also
  33900. 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
  33901. 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
  33902. <a href=#scratch-bitmap id=drawing-rectangles-to-the-bitmap:scratch-bitmap>scratch bitmap</a>.</ol>
  33903. <p class=note>If either height or width are zero, this method has no effect, since the set of
  33904. pixels would be empty.</p>
  33905. <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
  33906. 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
  33907. either height or width are zero, this method has no effect.</p>
  33908. <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
  33909. result of <a href=#trace-a-path id=drawing-rectangles-to-the-bitmap:trace-a-path>tracing the path</a> described below, using the
  33910. <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>
  33911. <p>If both <var>w</var> and <var>h</var> are zero, the path has a single subpath
  33912. with just one point (<var>x</var>, <var>y</var>), and no lines, and this method
  33913. 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
  33914. case).</p>
  33915. <p>If just one of either <var>w</var> or <var>h</var> is zero, then the path has
  33916. 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>
  33917. <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>,
  33918. <span><var>y</var></span>+<var>h</var>), and (<span><var>x</var></span>, <span><var>y</var>+<var>h</var></span>),
  33919. connected to each other in that order by straight lines.</p>
  33920. <h6 id=drawing-text-to-the-bitmap>4.12.4.2.12 Drawing text to the bitmap</h6>
  33921. <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>
  33922. <p>Fills or strokes (respectively) the given text at the given position. If a maximum width is
  33923. provided, the text will be scaled to fit that width if necessary.</p>
  33924. <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>
  33925. <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
  33926. font.</p>
  33927. <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>
  33928. <p>Returns the measurement described below.</p>
  33929. </dl>
  33930. <p>The <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> interface provides the following methods for
  33931. rendering text.</p>
  33932. <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
  33933. arguments, <var>text</var>, <var>x</var>, <var>y</var>, and optionally
  33934. <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>,
  33935. 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
  33936. methods are called, the user agent must run the following steps:</p>
  33937. <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
  33938. <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, and, if the <var>maxWidth</var> argument
  33939. was provided, that argument. Let <var>glyphs</var> be the result.</p>
  33940. <li><p>Move all the shapes in <var>glyphs</var> to the right by <var>x</var>
  33941. CSS pixels and down by <var>y</var> CSS pixels.<li>
  33942. <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
  33943. in the coordinate space of <var>glyphs</var> mapped to one coordinate space unit.</p>
  33944. <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>
  33945. 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
  33946. ignored.</p>
  33947. <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
  33948. 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>
  33949. <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>
  33950. 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
  33951. 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
  33952. 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
  33953. bitmap</a>'s <a href=#concept-canvas-origin-clean id=drawing-text-to-the-bitmap:concept-canvas-origin-clean>origin-clean</a> flag to
  33954. false.</ol>
  33955. <p>The <dfn id=dom-context-2d-measuretext><code>measureText()</code></dfn> method takes one
  33956. argument, <var>text</var>. When the method is invoked, the user agent must run the
  33957. <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
  33958. <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
  33959. 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.
  33960. 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
  33961. <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
  33962. <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
  33963. particular glyph in it before falling back to another font), then the method must throw a
  33964. <code id=drawing-text-to-the-bitmap:securityerror><a href=#securityerror>SecurityError</a></code> exception.
  33965. Otherwise, it must return the new <code id=drawing-text-to-the-bitmap:textmetrics-3><a href=#textmetrics>TextMetrics</a></code> object.
  33966. <a href=#refsCSS>[CSS]</a>
  33967. <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>
  33968. </p>
  33969. <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>
  33970. <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
  33971. rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left
  33972. from the given alignment point.
  33973. <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
  33974. 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
  33975. with slanted fonts where characters overhang their advance width.</p>
  33976. <dt><dfn id=dom-textmetrics-actualboundingboxright><code>actualBoundingBoxRight</code></dfn> attribute<dd>
  33977. <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
  33978. rectangle of the given text, in CSS pixels; positive numbers indicating a distance going right
  33979. from the given alignment point.</p>
  33980. <dt><dfn id=dom-textmetrics-fontboundingboxascent><code>fontBoundingBoxAscent</code></dfn> attribute<dd>
  33981. <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
  33982. bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers
  33983. indicating a distance going up from the given baseline.</p>
  33984. <p class=note>This value and the next are useful when rendering a background that must have a
  33985. 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
  33986. its corresponding attribute for the descent) are useful when drawing a bounding box around
  33987. specific text.</p>
  33988. <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
  33989. bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers
  33990. indicating a distance going down from the given baseline.<dt><dfn id=dom-textmetrics-actualboundingboxascent><code>actualBoundingBoxAscent</code></dfn> attribute<dd>
  33991. <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
  33992. rectangle of the given text, in CSS pixels; positive numbers indicating a distance going up from
  33993. the given baseline.
  33994. <p class=note>This number can vary greatly based on the input text, even if the first font
  33995. 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
  33996. "o" from an alphabetic baseline would be less than that of an uppercase "F". The value can
  33997. 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
  33998. the given text is just a single comma "<code>,</code>" would likely (unless the font is
  33999. quite unusual) be negative.</p>
  34000. <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
  34001. rectangle of the given text, in CSS pixels; positive numbers indicating a distance going down
  34002. 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
  34003. squares in the line box, in CSS pixels; positive numbers indicating that the given baseline is
  34004. below the top of that em square (so this value will usually be positive). Zero if the given
  34005. baseline is the top of that em square; half the font size if the given baseline is the middle of
  34006. 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
  34007. squares in the line box, in CSS pixels; positive numbers indicating that the given baseline is
  34008. below the bottom of that em square (so this value will usually be negative). (Zero if the given
  34009. 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
  34010. line box, in CSS pixels; positive numbers indicating that the given baseline is below the hanging
  34011. 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
  34012. the line box, in CSS pixels; positive numbers indicating that the given baseline is below the
  34013. 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
  34014. the line box, in CSS pixels; positive numbers indicating that the given baseline is below the
  34015. ideographic baseline. (Zero if the given baseline is the ideographic baseline.)</dl>
  34016. <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
  34017. <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
  34018. 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
  34019. to use the bounding box values described above if this is an issue.</p>
  34020. <p class=note>A future version of the 2D context API may provide a way to render fragments of
  34021. documents, rendered using CSS, straight to the canvas. This would be provided in preference to a
  34022. dedicated way of doing multiline layout.</p>
  34023. <h6 id=drawing-paths-to-the-canvas>4.12.4.2.13 Drawing paths to the canvas</h6>
  34024. <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
  34025. 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
  34026. path</a> is a <a href=#concept-path id=drawing-paths-to-the-canvas:concept-path>path</a>, as described above.</p>
  34027. <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>
  34028. <p>Resets the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-3>current default path</a>.</p>
  34029. <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>
  34030. <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
  34031. current fill style, obeying the given fill rule.</p>
  34032. <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>
  34033. <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
  34034. current stroke style.</p>
  34035. <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>
  34036. <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
  34037. default path</a> or the given path, following the platform conventions for focus rings.</p>
  34038. <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>
  34039. <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
  34040. focus rings in a particular manner (for example, high contrast focus rings), draws a focus ring
  34041. 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>
  34042. <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.
  34043. This can thus be used to determine when to draw a focus ring (see <a href=#drawCustomFocusRingExample>the example</a> below).</p>
  34044. <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>
  34045. <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
  34046. useful on devices with small screens, where the whole canvas might not be visible at once.</p>
  34047. <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>
  34048. <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
  34049. path, using the given fill rule to determine what points are in the path.</p>
  34050. <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>
  34051. <p>Unconstrains the clipping region.</p>
  34052. <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>
  34053. <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
  34054. path, using the given fill rule to determine what points are in the path.</p>
  34055. <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>
  34056. <p>Returns true if the given point would be in the region covered by the stroke of the
  34057. <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>
  34058. </dl>
  34059. <p>The <dfn id=dom-context-2d-beginpath><code>beginPath()</code></dfn> method must empty the
  34060. 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
  34061. zero subpaths.</p>
  34062. <p>Where the following method definitions use the term <i>intended path</i>, it means the
  34063. <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>
  34064. otherwise.</p>
  34065. <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
  34066. 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
  34067. 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
  34068. <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
  34069. 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
  34070. applying it when it is painted as well would result in a double transformation.)</p>
  34071. <p>The <dfn id=dom-context-2d-fill><code>fill()</code></dfn> method must fill all the
  34072. 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
  34073. 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
  34074. subpaths must be implicitly closed when being filled (without affecting the actual subpaths).</p>
  34075. <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
  34076. <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
  34077. 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>
  34078. <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,
  34079. overlapping parts of the paths in one stroke operation are treated as if their union was what was
  34080. painted.</p>
  34081. <p class=note>The stroke <em>style</em> is affected by the transformation during painting, even
  34082. 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>
  34083. <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
  34084. 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
  34085. 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
  34086. of transformations is described above and varies based on which path is being used.)</p>
  34087. <hr>
  34088. <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>
  34089. <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
  34090. whose context the method is associated, then abort these steps.<li>
  34091. <p>If the user has requested the use of particular focus rings (e.g. high-contrast focus rings),
  34092. or if the <var>element</var> would have a focus ring drawn around it, then draw a focus
  34093. ring of the appropriate style along the intended path, following platform conventions.</p>
  34094. <p class=note>Some platforms only draw focus rings around elements that have been focused from
  34095. the keyboard, and not those focused from the mouse. Other platforms simply don't draw focus
  34096. rings around some elements at all unless relevant accessibility features are enabled. This API
  34097. is intended to follow these conventions. User agents that implement distinctions based on the
  34098. 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
  34099. the call was triggered (if any).</p>
  34100. <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
  34101. <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
  34102. <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
  34103. region</a>. (The effect of transformations is described above and varies based on which path
  34104. is being used.)</p>
  34105. <li>
  34106. <p>Optionally, run the appropriate step from the following list:</p>
  34107. <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
  34108. 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
  34109. <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
  34110. actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
  34111. the bitmap given by the intended path.</dl>
  34112. </ol>
  34113. <p>The <dfn id=dom-context-2d-drawcustomfocusring><code>drawCustomFocusRing(<var>element</var>)</code></dfn> method, when invoked, must run the following steps:</p>
  34114. <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
  34115. whose context the method is associated, then return false and abort these steps.<li><p>Let <var>result</var> be true.<li>
  34116. <p>If the user has requested the use of particular focus rings (e.g. high-contrast focus rings),
  34117. then draw a focus ring of the appropriate style along the intended path, and set <var>result</var> to false.</p>
  34118. <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
  34119. <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
  34120. <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
  34121. region</a>. (The effect of transformations is described above and varies based on which path
  34122. is being used.)</p>
  34123. <li>
  34124. <p>Optionally, run the appropriate step from the following list:</p>
  34125. <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
  34126. 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
  34127. 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
  34128. actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
  34129. the bitmap given by the intended path.</dl>
  34130. <li><p>Return <var>result</var>.</ol>
  34131. <p>User agents should not implicitly close open subpaths in the intended path when drawing the
  34132. focus ring.</p>
  34133. <p class=note>This might be a moot point, however. For example, if the focus ring is drawn as an
  34134. axis-aligned bounding rectangle around the points in the intended path, then whether the subpaths
  34135. are closed or not has no effect. This specification intentionally does not specify precisely how
  34136. focus rings are to be drawn: user agents are expected to honor their platform's native
  34137. conventions.</p>
  34138. <hr>
  34139. <p>The <dfn id=dom-context-2d-scrollpathintoview><code>scrollPathIntoView()</code></dfn>
  34140. 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
  34141. 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>
  34142. that run the following steps:</p>
  34143. <ol><li><p>Let <var>the specified rectangle</var> be the rectangle of the bounding box of
  34144. the intended path.<li><p>Let <var>notional child</var> be a hypothetical element that is a rendered child
  34145. 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
  34146. 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
  34147. view</a> with the <var>align to top flag</var> set.</p>
  34148. <li><p>Optionally, <a href=#inform>inform the user</a> that the caret or selection (or both)
  34149. cover <var>the specified rectangle</var> of the canvas. If the
  34150. <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
  34151. 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
  34152. optionally inform the user.</ol>
  34153. <p id=inform>"Inform the user", as used in this section, does not imply any persistent state
  34154. change. It could mean, for instance, calling a system accessibility API to notify assistive
  34155. technologies such as magnification tools so that the user's magnifier moves to the given area of
  34156. the canvas. However, it does not associate the path with the element, or provide a region for
  34157. tactile feedback, etc. To persistently associate a region with information provided to
  34158. accessibility tools, use the <code id=drawing-paths-to-the-canvas:dom-context-2d-addhitregion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>
  34159. API.</p>
  34160. <hr>
  34161. <p>The <dfn id=dom-context-2d-clip><code>clip()</code></dfn> method must create a new
  34162. <dfn id=clipping-region>clipping region</dfn> by calculating the intersection of the current clipping region and the
  34163. 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
  34164. clipping region, without affecting the actual subpaths. The new clipping region replaces the
  34165. current clipping region.</p>
  34166. <p>When the context is initialized, the clipping region must be set to the largest infinite
  34167. surface (i.e. by default, no clipping occurs).</p>
  34168. <p>The <dfn id=dom-context-2d-resetclip><code>resetClip()</code></dfn> method must create a
  34169. 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
  34170. replaces the current clipping region.</p>
  34171. <hr>
  34172. <p>The <dfn id=dom-context-2d-ispointinpath><code>isPointInPath()</code></dfn> method must
  34173. return true if the point given by the <var>x</var> and <var>y</var> coordinates
  34174. passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the
  34175. 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>
  34176. indicated by the <var>fillRule</var> argument; and must return false otherwise. Open
  34177. subpaths must be implicitly closed when computing the area inside the path, without affecting the
  34178. actual subpaths. Points on the path itself must be considered to be inside the path. If either of
  34179. the arguments is infinite or NaN, then the method must return false.</p>
  34180. <hr>
  34181. <p>The <dfn id=dom-context-2d-ispointinstroke><code>isPointInStroke()</code></dfn> method
  34182. must return true if the point given by the <var>x</var> and <var>y</var>
  34183. coordinates passed to the method, when treated as coordinates in the canvas coordinate space
  34184. 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
  34185. <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.
  34186. Points on the resulting path must be considered to be inside the path. If either of the arguments
  34187. is infinite or NaN, then the method must return false.</p>
  34188. <hr>
  34189. <div id=drawCustomFocusRingExample class=example>
  34190. <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
  34191. highlighted:</p>
  34192. <pre>&lt;canvas height=400 width=750>
  34193. &lt;label>&lt;input type=checkbox id=showA> Show As&lt;/label>
  34194. &lt;label>&lt;input type=checkbox id=showB> Show Bs&lt;/label>
  34195. &lt;!-- ... -->
  34196. &lt;/canvas>
  34197. &lt;script>
  34198. function drawCheckbox(context, element, x, y, paint) {
  34199. context.save();
  34200. context.font = '10px sans-serif';
  34201. context.textAlign = 'left';
  34202. context.textBaseline = 'middle';
  34203. var metrics = context.measureText(element.labels[0].textContent);
  34204. if (paint) {
  34205. <strong> context.beginPath();
  34206. context.strokeStyle = 'black';
  34207. context.rect(x-5, y-5, 10, 10);
  34208. context.stroke();
  34209. context.addHitRegion({ control: element });
  34210. </strong> if (element.checked) {
  34211. <strong> context.fillStyle = 'black';
  34212. context.fill();
  34213. </strong> }
  34214. context.fillText(element.labels[0].textContent, x+5, y);
  34215. }
  34216. <strong> context.beginPath();
  34217. context.rect(x-7, y-7, 12 + metrics.width+2, 14);
  34218. if (paint &amp;&amp; context.drawCustomFocusRing(element)) {
  34219. context.strokeStyle = 'silver';
  34220. context.stroke();
  34221. }
  34222. </strong> context.restore();
  34223. }
  34224. function drawBase() { /* ... */ }
  34225. function drawAs() { /* ... */ }
  34226. function drawBs() { /* ... */ }
  34227. function redraw() {
  34228. var canvas = document.getElementsByTagName('canvas')[0];
  34229. var context = canvas.getContext('2d');
  34230. context.clearRect(0, 0, canvas.width, canvas.height);
  34231. drawCheckbox(context, document.getElementById('showA'), 20, 40, true);
  34232. drawCheckbox(context, document.getElementById('showB'), 20, 60, true);
  34233. drawBase();
  34234. if (document.getElementById('showA').checked)
  34235. drawAs();
  34236. if (document.getElementById('showB').checked)
  34237. drawBs();
  34238. }
  34239. function processClick(event) {
  34240. var canvas = document.getElementsByTagName('canvas')[0];
  34241. var context = canvas.getContext('2d');
  34242. var x = event.clientX;
  34243. var y = event.clientY;
  34244. var node = event.target;
  34245. while (node) {
  34246. x -= node.offsetLeft - node.scrollLeft;
  34247. y -= node.offsetTop - node.scrollTop;
  34248. node = node.offsetParent;
  34249. }
  34250. drawCheckbox(context, document.getElementById('showA'), 20, 40, false);
  34251. if (<strong>context.isPointInPath(x, y)</strong>)
  34252. document.getElementById('showA').checked = !(document.getElementById('showA').checked);
  34253. drawCheckbox(context, document.getElementById('showB'), 20, 60, false);
  34254. if (<strong>context.isPointInPath(x, y)</strong>)
  34255. document.getElementById('showB').checked = !(document.getElementById('showB').checked);
  34256. redraw();
  34257. }
  34258. document.getElementsByTagName('canvas')[0].addEventListener('focus', redraw, true);
  34259. document.getElementsByTagName('canvas')[0].addEventListener('blur', redraw, true);
  34260. document.getElementsByTagName('canvas')[0].addEventListener('change', redraw, true);
  34261. document.getElementsByTagName('canvas')[0].addEventListener('click', processClick, false);
  34262. redraw();
  34263. &lt;/script></pre>
  34264. </div>
  34265. <h6 id=drawing-images>4.12.4.2.14 Drawing images</h6>
  34266. <p>To draw images, the <dfn id=dom-context-2d-drawimage><code>drawImage</code></dfn> method
  34267. can be used.</p>
  34268. <p>This method can be invoked with three different sets of arguments:</p>
  34269. <ul class=brief><li><code>drawImage(<var>image</var>, <var>dx</var>, <var>dy</var>)</code>
  34270. <li><code>drawImage(<var>image</var>, <var>dx</var>, <var>dy</var>, <var>dw</var>, <var>dh</var>)</code>
  34271. <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>
  34272. </ul>
  34273. <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>
  34274. <p>Draws the given image onto the canvas. The arguments are
  34275. interpreted as follows:</p>
  34276. <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>
  34277. <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no
  34278. data, throws an <code id=drawing-images:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
  34279. </dl>
  34280. <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
  34281. agent must run the following steps:</p>
  34282. <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
  34283. returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
  34284. abort these steps. If it returns <i>bad</i>, then abort these steps without drawing anything.
  34285. Otherwise it returns <i>good</i>; continue with these steps.<li>
  34286. <p>Establish the source and destination rectangles as follows:</p>
  34287. <p>If not specified, the <var>dw</var> and <var>dh</var> arguments must default to the values of
  34288. <var>sw</var> and <var>sh</var>, interpreted such that one CSS pixel in the image is treated as
  34289. one unit in the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap>scratch bitmap</a>'s coordinate space. If the <var>sx</var>,
  34290. <var>sy</var>, <var>sw</var>, and <var>sh</var> arguments are omitted, they must default to 0,
  34291. 0, the image's intrinsic width in image pixels, and the image's intrinsic height in image
  34292. pixels, respectively. If the image has no intrinsic dimensions, the <i>concrete object size</i>
  34293. 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>"
  34294. algorithm, with the <i>specified size</i> having neither a definite width nor height, nor any
  34295. additional contraints, the object's intrinsic properties being those of the <var>image</var>
  34296. 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
  34297. bitmap</a>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
  34298. <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>),
  34299. (<var>sx</var>, <span><var>sy</var>+<var>sh</var></span>).</p>
  34300. <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>),
  34301. (<var>dx</var>, <span><var>dy</var>+<var>dh</var></span>).</p>
  34302. <p>When the source rectangle is outside the source image, the source rectangle must be clipped
  34303. to the source image and the destination rectangle must be clipped in the same proportion.</p>
  34304. <p class=note>When the destination rectangle is outside the destination image (the
  34305. <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
  34306. discarded, as if the destination was an infinite canvas whose rendering was clipped to the
  34307. dimensions of the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-5>scratch bitmap</a>.</p>
  34308. <li><p>If one of the <var>sw</var> or <var>sh</var> arguments is zero, abort
  34309. these steps. Nothing is painted.<li>
  34310. <p>Paint the region of the <var>image</var> argument specified by the source rectangle
  34311. on the region of the rendering context's <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-6>scratch bitmap</a> specified by the
  34312. destination rectangle, after applying the <a href=#transformations id=drawing-images:transformations>current
  34313. transformation matrix</a> to the destination rectangle.</p>
  34314. <p>The image data must be processed in the original direction, even if the dimensions given are
  34315. negative. </p>
  34316. <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
  34317. true, the user agent should attempt to apply a smoothing algorithm to the image data when it is
  34318. scaled. Otherwise, the image must be rendered using nearest-neighbor interpolation.</p>
  34319. <p class=note>This specification does not define the precise algorithm to use when scaling an
  34320. 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
  34321. true.</p>
  34322. <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
  34323. drawn onto itself, the <a href=#drawing-model id=drawing-images:drawing-model>drawing model</a> requires the source to be copied before the
  34324. 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
  34325. bitmap</a> onto overlapping parts of itself.</p>
  34326. <p>If the original image data is a bitmap image, the value painted at a point in the destination
  34327. rectangle is computed by filtering the original image data. The user agent may use any filtering
  34328. algorithm (for example bilinear interpolation or nearest-neighbor). When the filtering algorithm
  34329. requires a pixel value from outside the original image data, it must instead use the value from
  34330. the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
  34331. algorithm requires a pixel value from outside the source rectangle but inside the original image
  34332. data, then the value from the original image data must be used.</p>
  34333. <p class=note>Thus, scaling an image in parts or in whole will have the same effect. This does
  34334. mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
  34335. the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
  34336. surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
  34337. <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>
  34338. <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
  34339. 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>
  34340. <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
  34341. <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
  34342. to false.</ol>
  34343. <h6 id=hit-regions>4.12.4.2.15 Hit regions</h6>
  34344. <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
  34345. bitmap.</p>
  34346. <p>Each <dfn id=hit-region>hit region</dfn> consists of the following information:</p>
  34347. <ul><li><p>A <dfn id="hit-region's-set-of-pixels">set of pixels</dfn> on the bitmap for which this
  34348. region is responsible.<li><p>A <dfn id="hit-region's-bounding-circumference">bounding circumference</dfn> on the
  34349. 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
  34350. created.<li><p>Optionally, a non-empty string representing an <dfn id="hit-region's-id">ID</dfn> for
  34351. 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
  34352. of either a CSS cursor value, or the string "<code>inherit</code>" meaning that the
  34353. 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
  34354. not, is to be used instead.<li>
  34355. <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>
  34356. <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>
  34357. node, to which, in certain conditions, the user agent will route events, and from which the user
  34358. agent will determine the state of the hit region for the purposes of accessibility tools. (The
  34359. 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>
  34360. <p>An <dfn id="hit-region's-unbacked-region-description">unbacked region description</dfn>
  34361. consists of the following:</p>
  34362. <ul class=brief><li><p>Optionally, a <dfn id="hit-region's-label">label</dfn>.</p>
  34363. <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,
  34364. could be the empty string.</ul>
  34365. </ul>
  34366. <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>
  34367. <p>Adds a hit region to the bitmap. The argument is an object with the following members:</p>
  34368. <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
  34369. 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
  34370. 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
  34371. <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
  34372. 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
  34373. 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
  34374. <code id=hit-regions:dom-hitregionoptions-parentid><a href=#dom-hitregionoptions-parentid>parentID</a></code> member), if any, or to use the
  34375. <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
  34376. routed, and which accessibility tools are to use as a surrogate for describing and interacting
  34377. 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
  34378. 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
  34379. there is no control.</dl>
  34380. <p>Hit regions can be used for a variety of purposes:</p>
  34381. <ul><li>With an ID, they can make hit detection easier by having the user agent check which region
  34382. 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.
  34383. 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>
  34384. 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
  34385. 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
  34386. have different cursors, with the user agent automatically switching between them.</ul>
  34387. <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>
  34388. <p>Removes a hit region (and all its descendants) from the canvas bitmap. The argument is the ID
  34389. of a region added using <code id=hit-regions:dom-context-2d-addhitregion-3><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</p>
  34390. <p>The pixels that were covered by this region and its descendants are effectively cleared by
  34391. this operation, leaving the regions non-interactive. In particular, regions that occupied the
  34392. same pixels before the removed regions were added, overlapping them, do not resume their
  34393. previous role.</p>
  34394. <dt><var>context</var> . <code id=hit-regions:dom-context-2d-clearhitregions><a href=#dom-context-2d-clearhitregions>clearHitRegions</a></code>()<dd>
  34395. <p>Removes all hit regions from the canvas bitmap.</p>
  34396. </dl>
  34397. <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
  34398. 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
  34399. <a href=#ancestor-region id=hit-regions:ancestor-region>ancestor region</a>.</p>
  34400. <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
  34401. <a href=#hit-region id=hit-regions:hit-region-5>hit region</a> or nothing):</p>
  34402. <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
  34403. 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>
  34404. <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
  34405. <a href=#hit-region id=hit-regions:hit-region-8>hit region</a> or nothing):</p>
  34406. <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
  34407. region</a> and abort these steps.<li><p>Otherwise, return nothing.</ol>
  34408. <p><dfn id=the-control-represented-by-a-region>The control represented by a region</dfn> <var>region</var> for a
  34409. <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
  34410. algorithm (which can return an element or nothing):</p>
  34411. <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>,
  34412. 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
  34413. 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
  34414. element</a>, then return nothing and abort these steps.<li><p>Otherwise, return <var>control</var>.</ol>
  34415. <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>
  34416. element <var>ancestor</var> is the value returned by the following algorithm:</p>
  34417. <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
  34418. 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
  34419. 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
  34420. 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>
  34421. element, if any; if there isn't one, return 'auto'. <a href=#refsCSSUI>[CSSUI]</a></ol>
  34422. <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
  34423. <a href=#hit-region id=hit-regions:hit-region-11>hit region</a> or nothing):</p>
  34424. <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
  34425. <a href=#hit-region id=hit-regions:hit-region-13>hit region</a> and abort these steps.<li><p>Otherwise, return nothing.</ol>
  34426. <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>
  34427. <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>
  34428. <p>To <dfn id=garbage-collect-the-regions>garbage-collect the regions</dfn> of a bitmap <var>bitmap</var>, the user
  34429. agent must run the following steps:</p>
  34430. <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
  34431. 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
  34432. 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
  34433. 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>
  34434. <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
  34435. 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
  34436. reset, e.g. when a <code id=hit-regions:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is bound to or unbound from a
  34437. <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>
  34438. <hr>
  34439. <p>An element is a <dfn id=supported-interactive-canvas-fallback-element>supported interactive canvas fallback element</dfn> if it is one of the
  34440. following:</p>
  34441. <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
  34442. <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>
  34443. 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
  34444. 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
  34445. 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
  34446. <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>,
  34447. <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>,
  34448. <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>
  34449. <hr>
  34450. <p>When the <dfn id=dom-context-2d-addhitregion><code>addHitRegion()</code></dfn> method is
  34451. invoked, the user agent must run the following steps:</p>
  34452. <ol><li><p>Let <var>arguments</var> be the dictionary object provided as the method's
  34453. 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
  34454. path</var> be the <code id=hit-regions:dom-hitregionoptions-path-2><a href=#dom-hitregionoptions-path>path</a></code> member's value. Otherwise,
  34455. 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
  34456. path</a>.<li><p>Transform all the coordinates and lines in <var>source path</var> by the current
  34457. 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
  34458. 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
  34459. <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
  34460. 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
  34461. 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
  34462. 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
  34463. 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
  34464. 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
  34465. bitmap</a>, if any. If the <code id=hit-regions:dom-hitregionoptions-parentid-5><a href=#dom-hitregionoptions-parentid>parentID</a></code> member
  34466. is null or no such region currently exists, let <var>parent region</var> be
  34467. 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
  34468. instead.<li>
  34469. <p>If any of the following conditions are met, throw a <code id=hit-regions:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception
  34470. and abort these steps.</p>
  34471. <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
  34472. <code id=hit-regions:dom-hitregionoptions-label-3><a href=#dom-hitregionoptions-label>label</a></code> member's value is either null or the
  34473. 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
  34474. <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
  34475. 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>
  34476. of the <var>parent region</var>.</ul>
  34477. <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
  34478. <var>parent region</var> is null, then throw a <code id=hit-regions:notfounderror><a href=#notfounderror>NotFoundError</a></code> exception and
  34479. abort these steps.<li>
  34480. <p>If any of the following conditions are met, throw a <code id=hit-regions:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and
  34481. abort these steps.</p>
  34482. <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
  34483. <a href=#ascii-case-insensitive id=hit-regions:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>inherit</code>", nor a
  34484. 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
  34485. <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
  34486. <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>
  34487. <li>
  34488. <p>Let <var>region</var> be a newly created <a href=#hit-region id=hit-regions:hit-region-18>hit region</a>, with its
  34489. information configured as follows:</p>
  34490. <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>
  34491. <dd><p>The <var>specified pixels</var>
  34492. <dt><a href="#hit-region's-bounding-circumference" id="hit-regions:hit-region's-bounding-circumference">Hit region's bounding circumference</a>
  34493. <dd><p>A user-agent-defined shape that wraps the pixels contained in <var>source
  34494. path</var>. (In the simplest case, this can just be the bounding rectangle; this specification
  34495. allows it to be any shape in order to allow other interfaces.)
  34496. <dt><a href="#hit-region's-id" id="hit-regions:hit-region's-id-2">Hit region's ID</a>
  34497. <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
  34498. <a href="#hit-region's-id" id="hit-regions:hit-region's-id-3">id</a>.
  34499. <dt><a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-8">Hit region's parent</a>
  34500. <dd><p>If <var>parent region</var> is not null: <var>parent region</var>.
  34501. Otherwise, <var>region</var> has no <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-9">parent</a>.
  34502. <dt><a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-3">Hit region's child count</a>
  34503. <dd><p>Initially zero.
  34504. <dt><a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification-3">Hit region's cursor specification</a>
  34505. <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>".
  34506. <dt><a href="#hit-region's-control" id="hit-regions:hit-region's-control-6">Hit region's control</a>
  34507. <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>.
  34508. <dt><a href="#hit-region's-label" id="hit-regions:hit-region's-label">Hit region's label</a>
  34509. <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>
  34510. has no <a href="#hit-region's-label" id="hit-regions:hit-region's-label-2">label</a>.
  34511. <dt><a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role">Hit region's ARIA role</a>
  34512. <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).
  34513. 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.
  34514. Otherwise, <var>region</var> has no <a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role-2">ARIA
  34515. role</a>.
  34516. </dl>
  34517. <li>
  34518. <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
  34519. 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
  34520. the <a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification-4">hit region's cursor specification</a>.</p>
  34521. <p class=note>For example, if the user agent prefetches cursor values, this would cause that
  34522. 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>
  34523. <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
  34524. <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
  34525. 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
  34526. 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
  34527. 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
  34528. region list</a>.</ol>
  34529. <p>When the <dfn id=dom-context-2d-removehitregion><code>removeHitRegion()</code></dfn>
  34530. method is invoked, the user agent must run the following steps:</p>
  34531. <ol><li>
  34532. <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
  34533. 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
  34534. currently exists, abort these steps.</p>
  34535. <p class=note>If the method's argument is the empty string, then no region will match.</p>
  34536. <li><p>Remove <var>region</var>, and all <a href=#hit-region id=hit-regions:hit-region-20>hit regions</a> for
  34537. 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
  34538. 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
  34539. 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
  34540. bitmap</a>.</ol>
  34541. <p>When the <dfn id=dom-context-2d-clearhitregions><code>clearHitRegions()</code></dfn>
  34542. method is invoked, the user agent must remove all the <a href=#hit-region id=hit-regions:hit-region-21>hit regions</a>
  34543. 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>
  34544. <hr>
  34545. <p>The <code id=hit-regions:mouseevent-2><a href=#mouseevent>MouseEvent</a></code> interface is extended to support hit regions:</p>
  34546. <pre class=idl>partial interface <a href=#mouseevent id=MouseEvent-partial>MouseEvent</a> {
  34547. readonly attribute DOMString? <a href=#dom-mouseevent-region id=hit-regions:dom-mouseevent-region-2>region</a>;
  34548. };
  34549. partial dictionary <a href=#mouseeventinit id=hit-regions:mouseeventinit>MouseEventInit</a> {
  34550. DOMString? region;
  34551. };</pre>
  34552. <dl class=domintro><dt><var>event</var> . <code id=hit-regions:dom-mouseevent-region-3><a href=#dom-mouseevent-region>region</a></code><dd>
  34553. <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
  34554. ID</a>, if it has one.</p>
  34555. <p>Otherwise, returns null.</p>
  34556. </dl>
  34557. <p>The <dfn id=dom-mouseevent-region><code>region</code></dfn> attribute on
  34558. <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
  34559. 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
  34560. ID</a> if the mouse was over a hit region when the event was fired.</p>
  34561. <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
  34562. 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
  34563. <code>MouseEvent</code> rerouting steps</a> immediately prior to dispatching the event. This does not affect default actions (so for instance, if the
  34564. 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>
  34565. <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
  34566. steps</a>, which also invoke these steps.</p>
  34567. <p>The <dfn id=canvas-mouseevent-rerouting-steps>canvas <code>MouseEvent</code> rerouting steps</dfn> are as follows. If these steps
  34568. say to <i>act as normal</i>, that means that the event must be fired as it would have had these
  34569. requirements not been applied.</p>
  34570. <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
  34571. 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
  34572. 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
  34573. <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
  34574. 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>
  34575. 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
  34576. the above steps.</ol>
  34577. <hr>
  34578. <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>
  34579. <pre class=idl>partial interface <a href=#touch id=Touch-partial>Touch</a> {
  34580. readonly attribute DOMString? <a href=#dom-touch-region id=hit-regions:dom-touch-region>region</a>;
  34581. };</pre>
  34582. <dl class=domintro><dt><var>touch</var> . <code id=hit-regions:dom-touch-region-2><a href=#dom-touch-region>region</a></code><dd>
  34583. <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
  34584. 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>
  34585. <p>Otherwise, returns null.</p>
  34586. </dl>
  34587. <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>
  34588. object representing a <a href=#touch-point id=hit-regions:touch-point-2>touch point</a> <var>T</var> must return the value
  34589. obtained by running the following algorithm when <var>T</var> was first placed on the
  34590. surface: <a href=#refsTOUCH>[TOUCH]</a></p>
  34591. <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
  34592. 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
  34593. 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
  34594. 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
  34595. <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
  34596. 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>
  34597. <hr>
  34598. <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
  34599. agents should render the pointing device cursor according to the cursor specification described by
  34600. <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
  34601. on the <code id=hit-regions:the-canvas-element-24><a href=#the-canvas-element>canvas</a></code> element's bitmap.</p>
  34602. <hr>
  34603. <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>
  34604. 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>
  34605. elements.</p>
  34606. <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
  34607. 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
  34608. 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
  34609. 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
  34610. bounding circumference</a> gives the region of the screen to use when representing the node (if
  34611. appropriate).</p>
  34612. <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
  34613. 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
  34614. region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
  34615. 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,
  34616. is given by the <a href="#hit-region's-label" id="hit-regions:hit-region's-label-3">hit region's label</a>.</p>
  34617. <p>For the purposes of accessibility tools, when an element <var>C</var> is a descendant
  34618. 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
  34619. 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>
  34620. element's bitmap, then the element's position relative to the document should be presented as if
  34621. 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>
  34622. <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
  34623. 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
  34624. region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
  34625. 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,
  34626. is given by the <a href="#hit-region's-label" id="hit-regions:hit-region's-label-4">hit region's label</a>.</p>
  34627. <p class=note>Thus, for instance, a user agent on a touch-screen device could provide haptic
  34628. 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
  34629. 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
  34630. virtual accessibility focus separate from the keyboard input focus could allow the user to
  34631. navigate through the hit regions, using the virtual DOM tree described above to enable
  34632. 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
  34633. <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
  34634. bounding circumference</a> could be used to determine what area of the display to magnify.</p>
  34635. <h6 id=pixel-manipulation>4.12.4.2.16 <dfn>Pixel manipulation</dfn></h6>
  34636. <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>
  34637. <p>Returns an <code id=pixel-manipulation:imagedata><a href=#imagedata>ImageData</a></code> object with the given dimensions. All the pixels in the
  34638. returned object are transparent black.</p>
  34639. <p>Throws an <code id=pixel-manipulation:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if either of the width or height
  34640. arguments are zero.</p>
  34641. <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>
  34642. <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
  34643. pixels in the returned object are transparent black.</p>
  34644. <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>
  34645. <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>
  34646. <p>As each pixel in the data is represented by four numbers, the length of the data needs to be
  34647. a multiple of four times the given width. If the height is provided as well, then the length
  34648. needs to be exactly the width times the height times 4.</p>
  34649. <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
  34650. interpreted consistently, or if either dimension is zero.</p>
  34651. <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>
  34652. <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
  34653. the bitmap.</p>
  34654. <p>Throws an <code id=pixel-manipulation:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either of the width or height
  34655. arguments are zero.</p>
  34656. <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>
  34657. <p>Returns the actual dimensions of the data in the <code id=pixel-manipulation:imagedata-5><a href=#imagedata>ImageData</a></code> object, in
  34658. pixels.</p>
  34659. <dt><var>imagedata</var> . <code id=pixel-manipulation:dom-imagedata-data><a href=#dom-imagedata-data>data</a></code><dd>
  34660. <p>Returns the one-dimensional array containing the data in RGBA order, as integers in the range
  34661. 0 to 255.</p>
  34662. <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>
  34663. <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
  34664. rectangle is provided, only the pixels from that rectangle are painted.</p>
  34665. <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
  34666. well as the shadow attributes, are ignored for the purposes of this method call; pixels in the
  34667. canvas are replaced wholesale, with no composition, alpha blending, no shadows, etc.</p>
  34668. <p>Throws a <code id=pixel-manipulation:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the arguments are not finite.</p>
  34669. <p>Throws an <code id=pixel-manipulation:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <var>imagedata</var>
  34670. object's data has been <a href=#concept-transferable-neutered id=pixel-manipulation:concept-transferable-neutered>neutered</a>.</p>
  34671. </dl>
  34672. <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
  34673. instantiate new <code id=pixel-manipulation:imagedata-7><a href=#imagedata>ImageData</a></code> objects.</p>
  34674. <p>When the <code id=pixel-manipulation:dom-imagedata-3><a href=#dom-imagedata>ImageData()</a></code> constructor is invoked with two
  34675. numeric arguments <var>sw</var> and <var>sh</var>, it must return a new
  34676. <code id=pixel-manipulation:imagedata-8><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with a width equal to
  34677. <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
  34678. <code id=pixel-manipulation:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception instead.</p>
  34679. <p>When the <code id=pixel-manipulation:dom-imagedata-4><a href=#dom-imagedata>ImageData()</a></code> constructor is invoked with its first
  34680. argument being an <code id=pixel-manipulation:uint8clampedarray-2><a href=#uint8clampedarray>Uint8ClampedArray</a></code> <var>source</var> and its second and
  34681. (optionally) third argument(s) being numeric arguments <var>sw</var> and <var>sh</var>, it must run the following steps:
  34682. <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
  34683. <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>
  34684. <li>
  34685. <p>If <var>length</var> is not an integral multiple of <var>sw</var>,
  34686. throw an <code id=pixel-manipulation:indexsizeerror-5><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</p>
  34687. <p class=note>At this step, the length is guaranteed to be greater than zero (otherwise the
  34688. second step above would have aborted the steps), so if <var>sw</var> is zero, this
  34689. step will throw the exception and abort these steps.</p>
  34690. <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
  34691. <var>height</var>, then throw an <code id=pixel-manipulation:indexsizeerror-6><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these
  34692. steps.<li>
  34693. <p>Return a new <code id=pixel-manipulation:imagedata-9><a href=#imagedata>ImageData</a></code> object whose width is <var>sw</var>, whose
  34694. height is <var>height</var>, and whose data is <var>source</var>.</p>
  34695. <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
  34696. first argument to the constructor.</p>
  34697. </ol>
  34698. <p>When the <code id=pixel-manipulation:dom-context-2d-createimagedata-3><a href=#dom-context-2d-createimagedata>createImageData()</a></code> method is
  34699. invoked with two numeric arguments <var>sw</var> and <var>sh</var>, it must
  34700. return a new <code id=pixel-manipulation:imagedata-10><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with a width
  34701. equal to the absolute magnitude of <var>sw</var> and a height equal to the absolute
  34702. magnitude of <var>sh</var>, if both <var>sw</var> and <var>sh</var>
  34703. are non-zero. If one or both of <var>sw</var> and <var>sh</var> are zero, then
  34704. the constructor must throw an <code id=pixel-manipulation:indexsizeerror-7><a href=#indexsizeerror>IndexSizeError</a></code> exception instead.</p>
  34705. <p>When the <code id=pixel-manipulation:dom-context-2d-createimagedata-4><a href=#dom-context-2d-createimagedata>createImageData()</a></code> method is
  34706. invoked with a single <var>imagedata</var> argument, it must return a new
  34707. <code id=pixel-manipulation:imagedata-11><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with the same dimensions
  34708. as the <code id=pixel-manipulation:imagedata-12><a href=#imagedata>ImageData</a></code> object passed as the argument.</p>
  34709. <p>The <dfn id=dom-context-2d-getimagedata><code>getImageData(<var>sx</var>,
  34710. <var>sy</var>, <var>sw</var>, <var>sh</var>)</code></dfn> method must,
  34711. if either the <var>sw</var> or <var>sh</var> arguments are zero, throw an
  34712. <code id=pixel-manipulation:indexsizeerror-8><a href=#indexsizeerror>IndexSizeError</a></code> exception; otherwise,
  34713. 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>
  34714. flag is set to false, it must throw a <code id=pixel-manipulation:securityerror><a href=#securityerror>SecurityError</a></code> exception;
  34715. otherwise, it must return an <code id=pixel-manipulation:imagedata-13><a href=#imagedata>ImageData</a></code> object with width <var>sw</var> and
  34716. height <var>sh</var> representing the <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-2>scratch bitmap</a> for the area of that
  34717. 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>,
  34718. <span><var>sy</var>+<var>sh</var></span>), (<var>sx</var>,
  34719. <span><var>sy</var>+<var>sh</var></span>), in the bitmap's
  34720. coordinate space units. Pixels outside the <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-3>scratch bitmap</a> must be returned as
  34721. transparent black. Pixels must be returned as non-premultiplied alpha values.</p>
  34722. <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
  34723. row in the image data, their <dfn id=dom-imagedata-height><code>height</code></dfn>
  34724. 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
  34725. provided, is initialised to a new <code id=pixel-manipulation:uint8clampedarray-4><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object. The
  34726. <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
  34727. <code>ArrayBuffer</code></a> for its storage, and must have a zero start offset and a length
  34728. equal to the length of its storage, in bytes. The <a href=#canvas-pixel-arraybuffer id=pixel-manipulation:canvas-pixel-arraybuffer-2>Canvas Pixel
  34729. <code>ArrayBuffer</code></a> must contain the image data. At least one pixel's worth of image
  34730. data must be returned. <a href=#refsECMA262>[ECMA262]</a></p>
  34731. <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
  34732. represented in left-to-right order, row by row top to bottom, starting with the top left, with
  34733. each pixel's red, green, blue, and alpha components being given in that order for each pixel. Each
  34734. component of each pixel represented in this array must be in the range 0..255, representing the 8
  34735. bit value for that component. The components must be assigned consecutive indices starting with 0
  34736. for the top left pixel's red component. <a href=#refsECMA262>[ECMA262]</a></p>
  34737. <p>The <dfn id=dom-context-2d-putimagedata><code>putImageData()</code></dfn> method writes
  34738. 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
  34739. 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>
  34740. <p>When the last four arguments to this method are omitted, they must be assumed to have the
  34741. 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>
  34742. member of the <var>imagedata</var> structure, respectively.</p>
  34743. <p>When invoked, the method must act as follows:</p>
  34744. <ol><li>
  34745. <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>
  34746. exception and abort these steps.</p>
  34747. <li>
  34748. <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>
  34749. <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>
  34750. <li>
  34751. <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>
  34752. <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>
  34753. <li>
  34754. <p>If <span><var>dirtyX</var>+<var>dirtyWidth</var></span> is greater
  34755. 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>
  34756. <p>If <span><var>dirtyY</var>+<var>dirtyHeight</var></span> is
  34757. 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
  34758. <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>
  34759. <li>
  34760. <p>If, after those changes, either <var>dirtyWidth</var> or <var>dirtyHeight</var> is negative or zero, stop these steps without affecting any
  34761. bitmaps.</p>
  34762. <li><p>For all integer values of <var>x</var> and <var>y</var> where <span><var>dirtyX</var> ≤ <var>x</var> &lt; <span><var>dirtyX</var>+<var>dirtyWidth</var></span></span> and <span><var>dirtyY</var> ≤ <var>y</var> &lt; <span><var>dirtyY</var>+<var>dirtyHeight</var></span></span>, copy the
  34763. four channels of the pixel with coordinate (<var>x</var>, <var>y</var>) in
  34764. the <var>imagedata</var> data structure's <a href=#canvas-pixel-arraybuffer id=pixel-manipulation:canvas-pixel-arraybuffer-3>Canvas Pixel
  34765. <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>
  34766. <p>The handling of pixel rounding when the specified coordinates are not integers is not defined
  34767. by this specification, except that the following must result in no visible changes to the
  34768. rendering:</p>
  34769. <pre>context.putImageData(context.getImageData(x, y, w, h), p, q);</pre>
  34770. <p>...for any value of <var>x</var>, <var>y</var>, <var>w</var>, and
  34771. <var>h</var> and where <var>p</var> is the smaller of <var>x</var>
  34772. and the sum of <var>x</var> and <var>w</var>, and <var>q</var> is
  34773. 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>
  34774. <pre>context.createImageData(w, h);
  34775. context.getImageData(0, 0, w, h);</pre>
  34776. <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
  34777. value of <var>w</var> and <var>h</var>. In other words, while user agents may
  34778. round the arguments of these methods, any rounding performed must be performed consistently for
  34779. all of the methods described in this section. (The constructors only work with integer
  34780. values.)</p>
  34781. <p class=note>Due to the lossy nature of converting to and from premultiplied alpha colour
  34782. 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
  34783. <code id=pixel-manipulation:dom-context-2d-getimagedata-2><a href=#dom-context-2d-getimagedata>getImageData()</a></code> as different values.</p>
  34784. <p>The current path, <a href=#transformations id=pixel-manipulation:transformations>transformation matrix</a>,
  34785. <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
  34786. 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
  34787. affect the methods described in this section.</p>
  34788. <div class=example>
  34789. <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
  34790. draw onto it.</p>
  34791. <pre>// canvas is a reference to a &lt;canvas> element
  34792. var context = canvas.getContext('2d');
  34793. // create a blank slate
  34794. var data = context.createImageData(canvas.width, canvas.height);
  34795. // create some plasma
  34796. FillPlasma(data, 'green'); // green plasma
  34797. // add a cloud to the plasma
  34798. AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle
  34799. // paint the plasma+cloud on the canvas
  34800. context.putImageData(data, 0, 0);
  34801. // support methods
  34802. function FillPlasma(data, color) { ... }
  34803. function AddCloud(data, x, y) { ... }</pre>
  34804. </div>
  34805. <div class=example>
  34806. <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
  34807. filter.</p>
  34808. <pre>&lt;!DOCTYPE HTML>
  34809. &lt;html>
  34810. &lt;head>
  34811. &lt;title>Edge detection demo&lt;/title>
  34812. &lt;script>
  34813. var image = new Image();
  34814. function init() {
  34815. image.onload = demo;
  34816. image.src = "image.jpeg";
  34817. }
  34818. function demo() {
  34819. var canvas = document.getElementsByTagName('canvas')[0];
  34820. var context = canvas.getContext('2d');
  34821. // draw the image onto the canvas
  34822. context.drawImage(image, 0, 0);
  34823. // get the image data to manipulate
  34824. var input = context.getImageData(0, 0, canvas.width, canvas.height);
  34825. // get an empty slate to put the data into
  34826. var output = context.createImageData(canvas.width, canvas.height);
  34827. // alias some variables for convenience
  34828. // notice that we are using input.width and input.height here
  34829. // as they might not be the same as canvas.width and canvas.height
  34830. // (in particular, they might be different on high-res displays)
  34831. var w = input.width, h = input.height;
  34832. var inputData = input.data;
  34833. var outputData = output.data;
  34834. // edge detection
  34835. for (var y = 1; y &lt; h-1; y += 1) {
  34836. for (var x = 1; x &lt; w-1; x += 1) {
  34837. for (var c = 0; c &lt; 3; c += 1) {
  34838. var i = (y*w + x)*4 + c;
  34839. outputData[i] = 127 + -inputData[i - w*4 - 4] - inputData[i - w*4] - inputData[i - w*4 + 4] +
  34840. -inputData[i - 4] + 8*inputData[i] - inputData[i + 4] +
  34841. -inputData[i + w*4 - 4] - inputData[i + w*4] - inputData[i + w*4 + 4];
  34842. }
  34843. outputData[(y*w + x)*4 + 3] = 255; // alpha
  34844. }
  34845. }
  34846. // put the image data back after manipulation
  34847. context.putImageData(output, 0, 0);
  34848. }
  34849. &lt;/script>
  34850. &lt;/head>
  34851. &lt;body onload="init()">
  34852. &lt;canvas>&lt;/canvas>
  34853. &lt;/body>
  34854. &lt;/html></pre>
  34855. </div>
  34856. <h6 id=compositing>4.12.4.2.17 Compositing</h6>
  34857. <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>
  34858. <p>Returns the current alpha value applied to rendering operations.</p>
  34859. <p>Can be set, to change the alpha value. Values outside of the range 0.0 .. 1.0 are
  34860. ignored.</p>
  34861. <dt><var>context</var> . <code id=compositing:dom-context-2d-globalcompositeoperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> [ = <var>value</var> ]<dd>
  34862. <p>Returns the current composition operation, from the values defined in the Compositing and
  34863. Blending specification. <a href=#refsCOMPOSITE>[COMPOSITE]</a>.</p>
  34864. <p>Can be set, to change the composition operation. Unknown values are ignored.</p>
  34865. </dl>
  34866. <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>
  34867. <p>The <dfn id=dom-context-2d-globalalpha><code>globalAlpha</code></dfn> attribute gives an
  34868. alpha value that is applied to shapes and images before they are composited onto the <a href=#scratch-bitmap id=compositing:scratch-bitmap>scratch
  34869. bitmap</a>. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional
  34870. transparency). If an attempt is made to set the attribute to a value outside this range, including
  34871. Infinity and Not-a-Number (NaN) values, the attribute must retain its previous value. When the
  34872. context is created, the <code id=compositing:dom-context-2d-globalalpha-3><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> attribute must
  34873. initially have the value 1.0.</p>
  34874. <p>The <dfn id=dom-context-2d-globalcompositeoperation><code>globalCompositeOperation</code></dfn> attribute
  34875. sets the current composition operator, which controls how shapes and images are drawn onto the
  34876. <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
  34877. applied. The possible values are those defined in the Compositing and Blending specification, and
  34878. include the values <dfn id=gcop-source-over><code>source-over</code></dfn>
  34879. and <dfn id=gcop-copy><code>copy</code></dfn>.
  34880. <a href=#refsCOMPOSITE>[COMPOSITE]</a></p>
  34881. <p>These values are all case-sensitive — they must be used exactly as defined. User agents
  34882. 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
  34883. given in the Compositing and Blending specification. <a href=#refsCOMPOSITE>[COMPOSITE]</a></p>
  34884. <p>On setting, if the user agent does not recognise the specified value, it must be ignored,
  34885. leaving the value of <code id=compositing:dom-context-2d-globalcompositeoperation-3><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> unaffected.
  34886. Otherwise, the attribute must be set to the given new value.</p>
  34887. <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
  34888. initially have the value <code id=compositing:gcop-source-over><a href=#gcop-source-over>source-over</a></code>.</p>
  34889. <h6 id=image-smoothing>4.12.4.2.18 Image smoothing</h6>
  34890. <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>
  34891. <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
  34892. their pixels don't line up exactly with the display, when scaling images up.</p>
  34893. <p>Can be set, to change whether images are smoothed (true) or not (false).</p>
  34894. </dl>
  34895. <p>The <dfn id=dom-context-2d-imagesmoothingenabled><code>imageSmoothingEnabled</code></dfn>
  34896. attribute, on getting, must return the last value it was set to. On setting, it must be set to the
  34897. new value. When the <code id=image-smoothing:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, the attribute must be
  34898. set to true.</p>
  34899. <h6 id=shadows>4.12.4.2.19 <dfn>Shadows</dfn></h6>
  34900. <p>All drawing operations are affected by the four global shadow attributes.</p>
  34901. <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>
  34902. <p>Returns the current shadow colour.</p>
  34903. <p>Can be set, to change the shadow colour. Values that cannot be parsed as CSS colours are ignored.</p>
  34904. <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>
  34905. <p>Returns the current shadow offset.</p>
  34906. <p>Can be set, to change the shadow offset. Values that are not finite numbers are ignored.</p>
  34907. <dt><var>context</var> . <code id=shadows:dom-context-2d-shadowblur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> [ = <var>value</var> ]<dd>
  34908. <p>Returns the current level of blur applied to shadows.</p>
  34909. <p>Can be set, to change the blur level. Values that are not finite numbers greater than or
  34910. equal to zero are ignored.</p>
  34911. </dl>
  34912. <p>The <dfn id=dom-context-2d-shadowcolor><code>shadowColor</code></dfn> attribute sets the
  34913. colour of the shadow.</p>
  34914. <p>When the context is created, the <code id=shadows:dom-context-2d-shadowcolor-2><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>
  34915. attribute initially must be fully-transparent black.</p>
  34916. <p>On getting, the <a href=#serialisation-of-a-colour id=shadows:serialisation-of-a-colour>serialisation of the colour</a>
  34917. must be returned.</p>
  34918. <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 &lt;color> value</a> and the
  34919. colour assigned. If the value cannot be parsed as a CSS &lt;color> value then it must be
  34920. ignored, and the attribute must retain its previous value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
  34921. <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
  34922. that the shadow will be offset in the positive horizontal and positive vertical distance
  34923. respectively. Their values are in coordinate space units. They are not affected by the current
  34924. transformation matrix.</p>
  34925. <p>When the context is created, the shadow offset attributes must initially have the value
  34926. 0.</p>
  34927. <p>On getting, they must return their current value. On setting, the attribute being set must be
  34928. set to the new value, except if the value is infinite or NaN, in which case the new value must be
  34929. ignored.</p>
  34930. <p>The <dfn id=dom-context-2d-shadowblur><code>shadowBlur</code></dfn> attribute specifies
  34931. the level of the blurring effect. (The units do not map to coordinate space units, and are not
  34932. affected by the current transformation matrix.)</p>
  34933. <p>When the context is created, the <code id=shadows:dom-context-2d-shadowblur-2><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>
  34934. attribute must initially have the value 0.</p>
  34935. <p>On getting, the attribute must return its current value. On setting the attribute must be set
  34936. to the new value, except if the value is negative, infinite or NaN, in which case the new value
  34937. must be ignored.</p>
  34938. <p><dfn id=when-shadows-are-drawn>Shadows are only drawn if</dfn> the opacity component of
  34939. 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
  34940. 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
  34941. 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>
  34942. <p class=critical>It is likely that this will change: browser vendors have indicated an interest
  34943. in changing the processing model for shadows such that they only draw when the composition
  34944. operator is "source-over" (the default). <a href=http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/thread.html#31457>Read
  34945. more...</a></p>
  34946. <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>
  34947. <ol><li><p>Let <var>A</var> be an infinite transparent black bitmap on which the source
  34948. 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
  34949. 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>
  34950. direction, and <code id=shadows:dom-context-2d-shadowoffsety-3><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> in the positive
  34951. <var>y</var> direction.<li>
  34952. <p>If <code id=shadows:dom-context-2d-shadowblur-4><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is greater than 0:</p>
  34953. <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>
  34954. as the standard deviation.</p> </ol>
  34955. <p>User agents may limit values of <var>σ</var> to an implementation-specific
  34956. maximum value to avoid exceeding hardware limitations during the Gaussian blur operation.</p>
  34957. <li><p>Set the red, green, and blue components of every pixel in <var>B</var> to the
  34958. 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
  34959. 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
  34960. <a href=#drawing-model id=shadows:drawing-model>drawing model</a> described below.</ol>
  34961. <p>If the current composition operation is <code id=shadows:gcop-copy><a href=#gcop-copy>copy</a></code>, shadows
  34962. effectively won't render (since the shape will overwrite the shadow).</p>
  34963. <h6 id=drawing-model>4.12.4.2.20 <dfn>Drawing model</dfn></h6>
  34964. <p>When a shape or image is painted, user agents must follow these steps, in the order given (or
  34965. act as if they do):</p>
  34966. <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,
  34967. and line styles must be honored, and the stroke must itself also be subjected to the current
  34968. 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>,
  34969. 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
  34970. <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
  34971. 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
  34972. <a href=#scratch-bitmap id=drawing-model:scratch-bitmap-2>scratch bitmap</a> using the current composition operator.</ol>
  34973. <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
  34974. <a href=#scratch-bitmap id=drawing-model:scratch-bitmap-4>scratch bitmap</a> must be discarded.</p>
  34975. <h6 id=best-practices>4.12.4.2.21 Best practices</h6>
  34976. <p><i>This section is non-normative.</i></p>
  34977. <p>When a canvas is interactive, authors should include focusable elements in the element's
  34978. fallback content corresponding to each focusable part of the canvas, as in the <a href=#drawCustomFocusRingExample>example above</a>.</p>
  34979. <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
  34980. tools, authors should use the <code id=best-practices:dom-context-2d-addhitregion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>
  34981. API. When rendering focus rings, to ensure that focus rings have the appearance of native focus
  34982. 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
  34983. element for which a ring is being drawn. This method only draws the focus ring if the element is
  34984. <a href=#focused id=best-practices:focused>focused</a>, so that it can simply be called whenever drawing the element, without
  34985. checking whether the element is focused or not first.</p>
  34986. <p id=no-text-editing-in-canvas-please>Authors should avoid implementing text editing controls
  34987. 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>
  34988. <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
  34989. text input).<li>Scrolling of the text field has to be implemented (horizontally for long lines, vertically
  34990. 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
  34991. reimplemented. This is close to impossible since each user might have different services
  34992. 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
  34993. 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
  34994. reimplemented.</ul>
  34995. <p>This is a huge amount of work, and authors are most strongly encouraged to avoid doing any of
  34996. 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
  34997. <code id=best-practices:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute.</p>
  34998. <h6 id=examples>4.12.4.2.22 Examples</h6>
  34999. <p><i>This section is non-normative.</i></p>
  35000. <div class=example>
  35001. <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>
  35002. <pre>&lt;canvas width="800" height="450">&lt;/canvas>
  35003. &lt;script>
  35004. var context = document.getElementsByTagName('canvas')[0].getContext('2d');
  35005. var lastX = context.canvas.width * Math.random();
  35006. var lastY = context.canvas.height * Math.random();
  35007. var hue = 0;
  35008. function line() {
  35009. context.save();
  35010. context.translate(context.canvas.width/2, context.canvas.height/2);
  35011. context.scale(0.9, 0.9);
  35012. context.translate(-context.canvas.width/2, -context.canvas.height/2);
  35013. context.beginPath();
  35014. context.lineWidth = 5 + Math.random() * 10;
  35015. context.moveTo(lastX, lastY);
  35016. lastX = context.canvas.width * Math.random();
  35017. lastY = context.canvas.height * Math.random();
  35018. context.bezierCurveTo(context.canvas.width * Math.random(),
  35019. context.canvas.height * Math.random(),
  35020. context.canvas.width * Math.random(),
  35021. context.canvas.height * Math.random(),
  35022. lastX, lastY);
  35023. hue = hue + 10 * Math.random();
  35024. context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
  35025. context.shadowColor = 'white';
  35026. context.shadowBlur = 10;
  35027. context.stroke();
  35028. context.restore();
  35029. }
  35030. setInterval(line, 50);
  35031. function blank() {
  35032. context.fillStyle = 'rgba(0,0,0,0.1)';
  35033. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  35034. }
  35035. setInterval(blank, 40);
  35036. &lt;/script></pre>
  35037. </div>
  35038. <div class=example>
  35039. <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
  35040. following example demonstrates this:</p>
  35041. <iframe src=/demos/canvas/blue-robot/index-idle.html width=396 height=216></iframe>
  35042. <p>Here is the source for this example:</p>
  35043. <pre>&lt;!DOCTYPE HTML>
  35044. &lt;title>Blue Robot Demo&lt;/title>
  35045. &lt;base href="http://www.whatwg.org/demos/canvas/blue-robot/">
  35046. &lt;style>
  35047. html { overflow: hidden; min-height: 200px; min-width: 380px; }
  35048. body { height: 200px; position: relative; margin: 8px; }
  35049. .buttons { position: absolute; bottom: 0px; left: 0px; margin: 4px; }
  35050. &lt;/style>
  35051. &lt;canvas width="380" height="200">&lt;/canvas>
  35052. &lt;script>
  35053. var Landscape = function (context, width, height) {
  35054. this.offset = 0;
  35055. this.width = width;
  35056. this.advance = function (dx) {
  35057. this.offset += dx;
  35058. };
  35059. this.horizon = height * 0.7;
  35060. // This creates the sky gradient (from a darker blue to white at the bottom)
  35061. this.sky = context.createLinearGradient(0, 0, 0, this.horizon);
  35062. this.sky.addColorStop(0.0, 'rgb(55,121,179)');
  35063. this.sky.addColorStop(0.7, 'rgb(121,194,245)');
  35064. this.sky.addColorStop(1.0, 'rgb(164,200,214)');
  35065. // this creates the grass gradient (from a darker green to a lighter green)
  35066. this.earth = context.createLinearGradient(0, this.horizon, 0, height);
  35067. this.earth.addColorStop(0.0, 'rgb(81,140,20)');
  35068. this.earth.addColorStop(1.0, 'rgb(123,177,57)');
  35069. this.paintBackground = function (context, width, height) {
  35070. // first, paint the sky and grass rectangles
  35071. context.fillStyle = this.sky;
  35072. context.fillRect(0, 0, width, this.horizon);
  35073. context.fillStyle = this.earth;
  35074. context.fillRect(0, this.horizon, width, height-this.horizon);
  35075. // then, draw the cloudy banner
  35076. // we make it cloudy by having the draw text off the top of the
  35077. // canvas, and just having the blurred shadow shown on the canvas
  35078. context.save();
  35079. context.translate(width-((this.offset+(this.width*3.2)) % (this.width*4.0))+0, 0);
  35080. context.shadowColor = 'white';
  35081. context.shadowOffsetY = 30+this.horizon/3; // offset down on canvas
  35082. context.shadowBlur = '5';
  35083. context.fillStyle = 'white';
  35084. context.textAlign = 'left';
  35085. context.textBaseline = 'top';
  35086. context.font = '20px sans-serif';
  35087. context.fillText('WHATWG ROCKS', 10, -30); // text up above canvas
  35088. context.restore();
  35089. // then, draw the background tree
  35090. context.save();
  35091. context.translate(width-((this.offset+(this.width*0.2)) % (this.width*1.5))+30, 0);
  35092. context.beginPath();
  35093. context.fillStyle = 'rgb(143,89,2)';
  35094. context.lineStyle = 'rgb(10,10,10)';
  35095. context.lineWidth = 2;
  35096. context.rect(0, this.horizon+5, 10, -50); // trunk
  35097. context.fill();
  35098. context.stroke();
  35099. context.beginPath();
  35100. context.fillStyle = 'rgb(78,154,6)';
  35101. context.arc(5, this.horizon-60, 30, 0, Math.PI*2); // leaves
  35102. context.fill();
  35103. context.stroke();
  35104. context.restore();
  35105. };
  35106. this.paintForeground = function (context, width, height) {
  35107. // draw the box that goes in front
  35108. context.save();
  35109. context.translate(width-((this.offset+(this.width*0.7)) % (this.width*1.1))+0, 0);
  35110. context.beginPath();
  35111. context.rect(0, this.horizon - 5, 25, 25);
  35112. context.fillStyle = 'rgb(220,154,94)';
  35113. context.lineStyle = 'rgb(10,10,10)';
  35114. context.lineWidth = 2;
  35115. context.fill();
  35116. context.stroke();
  35117. context.restore();
  35118. };
  35119. };
  35120. &lt;/script>
  35121. &lt;script>
  35122. var BlueRobot = function () {
  35123. this.sprites = new Image();
  35124. this.sprites.src = 'blue-robot.png'; // this sprite sheet has 8 cells
  35125. this.targetMode = 'idle';
  35126. this.walk = function () {
  35127. this.targetMode = 'walk';
  35128. };
  35129. this.stop = function () {
  35130. this.targetMode = 'idle';
  35131. };
  35132. this.frameIndex = {
  35133. 'idle': [0], // first cell is the idle frame
  35134. 'walk': [1,2,3,4,5,6], // the walking animation is cells 1-6
  35135. 'stop': [7], // last cell is the stopping animation
  35136. };
  35137. this.mode = 'idle';
  35138. this.frame = 0; // index into frameIndex
  35139. this.tick = function () {
  35140. // this advances the frame and the robot
  35141. // the return value is how many pixels the robot has moved
  35142. this.frame += 1;
  35143. if (this.frame >= this.frameIndex[this.mode].length) {
  35144. // we've reached the end of this animation cycle
  35145. this.frame = 0;
  35146. if (this.mode != this.targetMode) {
  35147. // switch to next cycle
  35148. if (this.mode == 'walk') {
  35149. // we need to stop walking before we decide what to do next
  35150. this.mode = 'stop';
  35151. } else if (this.mode == 'stop') {
  35152. if (this.targetMode == 'walk')
  35153. this.mode = 'walk';
  35154. else
  35155. this.mode = 'idle';
  35156. } else if (this.mode == 'idle') {
  35157. if (this.targetMode == 'walk')
  35158. this.mode = 'walk';
  35159. }
  35160. }
  35161. }
  35162. if (this.mode == 'walk')
  35163. return 8;
  35164. return 0;
  35165. },
  35166. this.paint = function (context, x, y) {
  35167. if (!this.sprites.complete) return;
  35168. // draw the right frame out of the sprite sheet onto the canvas
  35169. // we assume each frame is as high as the sprite sheet
  35170. // the x,y coordinates give the position of the bottom center of the sprite
  35171. context.drawImage(this.sprites,
  35172. this.frameIndex[this.mode][this.frame] * this.sprites.height, 0, this.sprites.height, this.sprites.height,
  35173. x-this.sprites.height/2, y-this.sprites.height, this.sprites.height, this.sprites.height);
  35174. };
  35175. };
  35176. &lt;/script>
  35177. &lt;script>
  35178. var canvas = document.getElementsByTagName('canvas')[0];
  35179. var context = canvas.getContext('2d');
  35180. var landscape = new Landscape(context, canvas.width, canvas.height);
  35181. var blueRobot = new BlueRobot();
  35182. // paint when the browser wants us to, using requestAnimationFrame()
  35183. function paint() {
  35184. context.clearRect(0, 0, canvas.width, canvas.height);
  35185. landscape.paintBackground(context, canvas.width, canvas.height);
  35186. blueRobot.paint(context, canvas.width/2, landscape.horizon*1.1);
  35187. landscape.paintForeground(context, canvas.width, canvas.height);
  35188. requestAnimationFrame(paint);
  35189. }
  35190. paint();
  35191. // but tick every 150ms, so that we don't slow down when we don't paint
  35192. setInterval(function () {
  35193. var dx = blueRobot.tick();
  35194. landscape.advance(dx);
  35195. }, 100);
  35196. &lt;/script>
  35197. &lt;p class="buttons">
  35198. &lt;input type=button value="Walk" onclick="blueRobot.walk()">
  35199. &lt;input type=button value="Stop" onclick="blueRobot.stop()">
  35200. &lt;footer>
  35201. &lt;small> Blue Robot Player Sprite by &lt;a href="http://johncolburn.deviantart.com/">JohnColburn&lt;/a>.
  35202. Licensed under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.&lt;/small>
  35203. &lt;small> This work is itself licensed under a &lt;a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative
  35204. Commons Attribution-ShareAlike 3.0 Unported License&lt;/a>.&lt;/small>
  35205. &lt;/footer>
  35206. </pre>
  35207. </div>
  35208. <h5 id=colour-spaces-and-colour-correction>4.12.4.3 Colour spaces and colour correction</h5>
  35209. <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
  35210. images with their own gamma correction and colour space information onto a bitmap, to convert the
  35211. 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>
  35212. object), and when rendering the actual canvas bitmap to the output device.</p>
  35213. <p class=note>Thus, in the 2D context, colours used to draw shapes onto the canvas will exactly
  35214. 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>
  35215. <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
  35216. information in the resources they return. Where the output format allows it, the colour of pixels
  35217. 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
  35218. 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>
  35219. <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
  35220. match the colour space used for processing any colours for that element in CSS.</p>
  35221. <p>The gamma correction and colour space information of images must be handled in such a way that
  35222. 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
  35223. 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
  35224. 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
  35225. correction.</p>
  35226. <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
  35227. dimensions, has no visible effect.</p>
  35228. <h5 id=serialising-bitmaps-to-a-file>4.12.4.4 Serialising bitmaps to a file</h5>
  35229. <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
  35230. with some given <var>arguments</var>, and optionally with a <var>native</var> flag set, it must
  35231. create an image file in the format given by the first value of <var>arguments</var>, or, if there
  35232. are no <var>arguments</var>, in the PNG format. <a href=#refsPNG>[PNG]</a></p>
  35233. <p>If the <var>native</var> flag is set, or if the bitmap has one pixel per coordinate space unit,
  35234. then the image file must have the same pixel data (before compression, if applicable) as the
  35235. bitmap, and if the file format used supports encoding resolution metadata, the resolution of that
  35236. bitmap (device pixels per coordinate space units being interpreted as image pixels per CSS pixel)
  35237. must be given as well.</p>
  35238. <p>Otherwise, the image file's pixel data must be the bitmap's pixel data scaled to one image
  35239. pixel per coordinate space unit, and if the file format used supports encoding resolution
  35240. metadata, the resolution must be given as 96dpi (one image pixel per CSS pixel).</p>
  35241. <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
  35242. must be treated as not supported.</p>
  35243. <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
  35244. 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
  35245. "<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
  35246. user agent track how the bitmap was generated, an unlikely, though potentially awesome,
  35247. feature).</p>
  35248. <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.
  35249. If the user agent does not support the requested type, it must create the file using the PNG
  35250. format. <a href=#refsPNG>[PNG]</a></p>
  35251. <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
  35252. lowercase</a> before establishing if they support that type.</p>
  35253. <p>For image types that do not support an alpha channel, the serialised image must be the bitmap
  35254. image composited onto a solid black background using the source-over operator.</p>
  35255. <p>If the first argument in <var>arguments</var> gives a type corresponding to one of the
  35256. types given in the first column of the following table, and the user agent supports that type,
  35257. then the subsequent arguments, if any, must be treated as described in the second cell of that
  35258. row.</p>
  35259. <table id=canvas-serialisation-arguments><caption>Arguments for serialisation methods</caption><thead><tr><th> Type <th> Other arguments <th> Reference
  35260. <tbody><tr><td> <code id=serialising-bitmaps-to-a-file:image/jpeg-2><a href=#image/jpeg>image/jpeg</a></code>
  35261. <td> The second argument, if it is a number in the range 0.0 to 1.0
  35262. 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
  35263. default value, as if the argument had been omitted.
  35264. <td> <a href=#refsJPEG>[JPEG]</a>
  35265. </table>
  35266. <p>For the purposes of these rules, an argument is considered to be a number if it is converted to
  35267. an IDL double value by the rules for handling arguments of type <code>any</code> in the
  35268. Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  35269. <p>Other arguments must be ignored and must not cause the user agent to throw an exception. A
  35270. future version of this specification will probably define other parameters to be passed to these
  35271. methods to allow authors to more carefully control compression settings, image metadata, etc.</p>
  35272. <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>
  35273. <p><i>This section is non-normative.</i></p>
  35274. <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
  35275. 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>
  35276. <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
  35277. indicating whether they are <a href=#concept-canvas-origin-clean id=security-with-canvas-elements:concept-canvas-origin-clean>origin-clean</a>. All
  35278. 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
  35279. true. The flag is set to false when cross-origin images or fonts are used.</p>
  35280. <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
  35281. throw a <code id=security-with-canvas-elements:securityerror><a href=#securityerror>SecurityError</a></code> exception rather than leak cross-origin data.</p>
  35282. <p>The flag can be reset in certain situations; for example, when a
  35283. <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
  35284. and its flag reset.</p>
  35285. <h3 id=common-idioms>4.13 Common idioms without dedicated elements</h3>
  35286. <h4 id=the-main-part-of-the-content>4.13.1 The main part of the content</h4>
  35287. <p>The main content of a page — not including headers and footers, navigation links,
  35288. sidebars, advertisements, and so forth — can be marked up in a variety of ways, depending on
  35289. the needs of the author.</p>
  35290. <p>The simplest solution is to not mark up the main content at all, and just leave it as implicit.
  35291. 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
  35292. the page, and the bits that aren't main content are excluded through the use of more appropriate
  35293. 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>
  35294. <div class=example>
  35295. <p>Here is a short Web page marked up along this minimalistic school of thought. The main content
  35296. 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
  35297. with elements to indicate that it's not part of the main content, in this case
  35298. <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>
  35299. <pre>&lt;!DOCTYPE HTML>
  35300. &lt;html>
  35301. &lt;head>
  35302. &lt;title> My Toys &lt;/title>
  35303. &lt;/head>
  35304. &lt;body>
  35305. &lt;header>
  35306. &lt;h1>My toys&lt;/h1>
  35307. &lt;/header>
  35308. &lt;nav>
  35309. &lt;p>&lt;a href="/">Home&lt;/a>&lt;/p>
  35310. &lt;p>&lt;a href="/contact">Contact&lt;/a>&lt;/p>
  35311. &lt;/nav>
  35312. <strong> &lt;p>I really like my chained book and my telephone. I'm not such a
  35313. fan of my big ball.&lt;/p>
  35314. &lt;p>Another toy I like is my mirror.&lt;/p></strong>
  35315. &lt;footer>
  35316. &lt;p>© copyright 2010 by the boy&lt;/p>
  35317. &lt;/footer>
  35318. &lt;/body>
  35319. &lt;/html></pre>
  35320. </div>
  35321. <p>If the main content is an independent unit of content that one could imagine syndicating
  35322. 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
  35323. content of the document.</p>
  35324. <div class=example>
  35325. <p>The document in the previous example is here recast as a blog post:</p>
  35326. <pre>&lt;!DOCTYPE HTML>
  35327. &lt;html>
  35328. &lt;head>
  35329. &lt;title> The Boy Blog: My Toys &lt;/title>
  35330. &lt;/head>
  35331. &lt;body>
  35332. &lt;header>
  35333. &lt;h1>The Boy Blog&lt;/h1>
  35334. &lt;/header>
  35335. &lt;nav>
  35336. &lt;p>&lt;a href="/">Home&lt;/a>&lt;/p>
  35337. &lt;p>&lt;a href="/contact">Contact&lt;/a>&lt;/p>
  35338. &lt;/nav>
  35339. <strong> &lt;article>
  35340. &lt;header>
  35341. &lt;h1>My toys&lt;/h1>
  35342. &lt;p>Published August 4th&lt;/p>
  35343. &lt;/header>
  35344. &lt;p>I really like my chained book and my telephone. I'm not such a
  35345. fan of my big ball.&lt;/p>
  35346. &lt;p>Another toy I like is my mirror.&lt;/p>
  35347. &lt;/article></strong>
  35348. &lt;footer>
  35349. &lt;p>© copyright 2010 by the boy&lt;/p>
  35350. &lt;/footer>
  35351. &lt;/body>
  35352. &lt;/html></pre>
  35353. </div>
  35354. <p>If the main content is not an independent unit of content so much as a section of a larger
  35355. 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
  35356. up the main content of the document.</p>
  35357. <div class=example>
  35358. <p>Here is the same document, but as a chapter in an online book:</p>
  35359. <pre>&lt;!DOCTYPE HTML>
  35360. &lt;html>
  35361. &lt;head>
  35362. &lt;title> Chapter 2: My Toys — The Book of the Boy &lt;/title>
  35363. &lt;/head>
  35364. &lt;body>
  35365. &lt;header>
  35366. &lt;hgroup>
  35367. &lt;h1>The Book of the Boy&lt;/h1>
  35368. &lt;h2>A book about boy stuff&lt;/h2>
  35369. &lt;/hgroup>
  35370. &lt;/header>
  35371. &lt;nav>
  35372. &lt;p>&lt;a href="/">Front Page&lt;/a>&lt;/p>
  35373. &lt;p>&lt;a href="/toc">Table of Contents&lt;/a>&lt;/p>
  35374. &lt;p>&lt;a href="/c1">Chapter 1&lt;/a> — &lt;a href="/c3">Chapter 3&lt;/a>&lt;/p>
  35375. &lt;/nav>
  35376. <strong> &lt;section>
  35377. &lt;h1>Chapter 2: My Toys&lt;/h1>
  35378. &lt;p>I really like my chained book and my telephone. I'm not such a
  35379. fan of my big ball.&lt;/p>
  35380. &lt;p>Another toy I like is my mirror.&lt;/p>
  35381. &lt;/section></strong>
  35382. &lt;/body>
  35383. &lt;/html></pre>
  35384. </div>
  35385. <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
  35386. content still needs an explicit element, for example for styling purposes, then the
  35387. <code id=the-main-part-of-the-content:the-main-element><a href=#the-main-element>main</a></code> element can be used.</p>
  35388. <div class=example>
  35389. <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
  35390. instead of leaving it implied:</p>
  35391. <pre>&lt;!DOCTYPE HTML>
  35392. &lt;html>
  35393. &lt;head>
  35394. &lt;title> My Toys &lt;/title>
  35395. &lt;style>
  35396. body > main { background: navy; color: yellow; }
  35397. &lt;/style>
  35398. &lt;/head>
  35399. &lt;body>
  35400. &lt;header>
  35401. &lt;h1>My toys&lt;/h1>
  35402. &lt;/header>
  35403. &lt;nav>
  35404. &lt;p>&lt;a href="/">Home&lt;/a>&lt;/p>
  35405. &lt;p>&lt;a href="/contact">Contact&lt;/a>&lt;/p>
  35406. &lt;/nav>
  35407. <strong> &lt;main>
  35408. &lt;p>I really like my chained book and my telephone. I'm not such a
  35409. fan of my big ball.&lt;/p>
  35410. &lt;p>Another toy I like is my mirror.&lt;/p>
  35411. &lt;/main></strong>
  35412. &lt;footer>
  35413. &lt;p>© copyright 2010 by the boy&lt;/p>
  35414. &lt;/footer>
  35415. &lt;/body>
  35416. &lt;/html></pre>
  35417. </div>
  35418. <h4 id=rel-up>4.13.2 Bread crumb navigation</h4>
  35419. <p>This specification does not provide a machine-readable way of describing bread-crumb navigation
  35420. 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>
  35421. element can be used to mark the section containing these paragraphs as being navigation
  35422. blocks.</p>
  35423. <div class=example>
  35424. <p>In the following example, the current page can be reached via two paths.</p>
  35425. <pre>&lt;nav>
  35426. &lt;p>
  35427. &lt;a href="/">Main&lt;/a> ▸
  35428. &lt;a href="/products/">Products&lt;/a> ▸
  35429. &lt;a href="/products/dishwashers/">Dishwashers&lt;/a> ▸
  35430. &lt;a>Second hand&lt;/a>
  35431. &lt;/p>
  35432. &lt;p>
  35433. &lt;a href="/">Main&lt;/a> ▸
  35434. &lt;a href="/second-hand/">Second hand&lt;/a> ▸
  35435. &lt;a>Dishwashers&lt;/a>
  35436. &lt;/p>
  35437. &lt;/nav></pre>
  35438. </div>
  35439. <h4 id=tag-clouds>4.13.3 Tag clouds</h4>
  35440. <p id=tag-cloud>This specification does not define any markup specifically for marking up lists
  35441. of keywords that apply to a group of pages (also known as <i>tag clouds</i>). In general, authors
  35442. 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
  35443. counts that are then hidden and turned into a presentational effect using a style sheet, or to use
  35444. SVG.</p>
  35445. <div class=example>
  35446. <p>Here, three tags are included in a short tag cloud:</p>
  35447. <pre>&lt;style>
  35448. @media screen, print, handheld, tv {
  35449. /* should be ignored by non-visual browsers */
  35450. .tag-cloud > li > span { display: none; }
  35451. .tag-cloud > li { display: inline; }
  35452. .tag-cloud-1 { font-size: 0.7em; }
  35453. .tag-cloud-2 { font-size: 0.9em; }
  35454. .tag-cloud-3 { font-size: 1.1em; }
  35455. .tag-cloud-4 { font-size: 1.3em; }
  35456. .tag-cloud-5 { font-size: 1.5em; }
  35457. }
  35458. &lt;/style>
  35459. ...
  35460. &lt;ul class="tag-cloud">
  35461. &lt;li class="tag-cloud-4">&lt;a title="28 instances" href="/t/apple">apple&lt;/a> &lt;span>(popular)&lt;/span>
  35462. &lt;li class="tag-cloud-2">&lt;a title="6 instances" href="/t/kiwi">kiwi&lt;/a> &lt;span>(rare)&lt;/span>
  35463. &lt;li class="tag-cloud-5">&lt;a title="41 instances" href="/t/pear">pear&lt;/a> &lt;span>(very popular)&lt;/span>
  35464. &lt;/ul></pre>
  35465. <p>The actual frequency of each tag is given using the <code id=tag-clouds:attr-title><a href=#attr-title>title</a></code>
  35466. attribute. A CSS style sheet is provided to convert the markup into a cloud of differently-sized
  35467. words, but for user agents that do not support CSS or are not visual, the markup contains
  35468. annotations like "(popular)" or "(rare)" to categorise the various tags by frequency, thus
  35469. enabling all users to benefit from the information.</p>
  35470. <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
  35471. particularly important: while the list is in fact ordered alphabetically, it would convey the
  35472. same information if ordered by, say, the length of the tag.</p>
  35473. <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
  35474. <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
  35475. to the page itself; they are just part of an index listing the tags themselves.</p>
  35476. </div>
  35477. <h4 id=conversations>4.13.4 Conversations</h4>
  35478. <p>This specification does not define a specific element for marking up conversations, meeting
  35479. minutes, chat transcripts, dialogues in screenplays, instant message logs, and other situations
  35480. where different players take turns in discourse.</p>
  35481. <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
  35482. punctuation. Authors who need to mark the speaker for styling purposes are encouraged to use
  35483. <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>
  35484. element can be used for marking up stage directions.</p>
  35485. <div class=example>
  35486. <p>This example demonstrates this using an extract from Abbot and Costello's famous sketch,
  35487. <cite>Who's on first</cite>:</p>
  35488. <pre>&lt;p> Costello: Look, you gotta first baseman?
  35489. &lt;p> Abbott: Certainly.
  35490. &lt;p> Costello: Who's playing first?
  35491. &lt;p> Abbott: That's right.
  35492. &lt;p> Costello becomes exasperated.
  35493. &lt;p> Costello: When you pay off the first baseman every month, who gets the money?
  35494. &lt;p> Abbott: Every dollar of it.</pre>
  35495. </div>
  35496. <div class=example>
  35497. <p>The following extract shows how an IM conversation log could be marked up, using the
  35498. <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
  35499. 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
  35500. <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).
  35501. Had the author wished to mark up the data using one of the date and time formats supported by the
  35502. <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
  35503. could be advantageous as it would allow data analysis tools to detect the timestamps
  35504. unambiguously, without coordination with the page author.</p>
  35505. <pre>&lt;p> &lt;data value="1319898155">14:22&lt;/data> &lt;b>egof&lt;/b> I'm not that nerdy, I've only seen 30% of the star trek episodes
  35506. &lt;p> &lt;data value="1319898192">14:23&lt;/data> &lt;b>kaj&lt;/b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
  35507. &lt;p> &lt;data value="1319898200">14:23&lt;/data> &lt;b>egof&lt;/b> it's unarguably
  35508. &lt;p> &lt;data value="1319898228">14:23&lt;/data> &lt;i>* kaj blinks&lt;/i>
  35509. &lt;p> &lt;data value="1319898260">14:24&lt;/data> &lt;b>kaj&lt;/b> you are not helping your case</pre>
  35510. </div>
  35511. <div class=example>
  35512. <p>HTML does not have a good way to mark up graphs, so descriptions of interactive conversations
  35513. from games are more difficult to mark up. This example shows one possible convention using
  35514. <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.
  35515. Another option to consider is describing the conversation in the form of a DOT file, and
  35516. outputting the result as an SVG image to place in the document. <a href=#refsDOT>[DOT]</a></p>
  35517. <pre>&lt;p> Next, you meet a fisherman. You can say one of several greetings:
  35518. &lt;dl>
  35519. &lt;dt> "Hello there!"
  35520. &lt;dd>
  35521. &lt;p> He responds with "Hello, how may I help you?"; you can respond with:
  35522. &lt;dl>
  35523. &lt;dt> "I would like to buy a fish."
  35524. &lt;dd> &lt;p> He sells you a fish and the conversation finishes.
  35525. &lt;dt> "Can I borrow your boat?"
  35526. &lt;dd>
  35527. &lt;p> He is surprised and asks "What are you offering in return?".
  35528. &lt;dl>
  35529. &lt;dt> "Five gold." (if you have enough)
  35530. &lt;dt> "Ten gold." (if you have enough)
  35531. &lt;dt> "Fifteen gold." (if you have enough)
  35532. &lt;dd> &lt;p> He lends you his boat. The conversation ends.
  35533. &lt;dt> "A fish." (if you have one)
  35534. &lt;dt> "A newspaper." (if you have one)
  35535. &lt;dt> "A pebble." (if you have one)
  35536. &lt;dd> &lt;p> "No thanks", he replies. Your conversation options
  35537. at this point are the same as they were after asking to borrow
  35538. his boat, minus any options you've suggested before.
  35539. &lt;/dl>
  35540. &lt;/dd>
  35541. &lt;/dl>
  35542. &lt;/dd>
  35543. &lt;dt> "Vote for me in the next election!"
  35544. &lt;dd> &lt;p> He turns away. The conversation finishes.
  35545. &lt;dt> "Sir, are you aware that your fish are running away?"
  35546. &lt;dd>
  35547. &lt;p> He looks at you skeptically and says "Fish cannot run, sir".
  35548. &lt;dl>
  35549. &lt;dt> "You got me!"
  35550. &lt;dd> &lt;p> The fisherman sighs and the conversation ends.
  35551. &lt;dt> "Only kidding."
  35552. &lt;dd> &lt;p> "Good one!" he retorts. Your conversation options at this
  35553. point are the same as those following "Hello there!" above.
  35554. &lt;dt> "Oh, then what are they doing?"
  35555. &lt;dd> &lt;p> He looks at his fish, giving you an opportunity to steal
  35556. his boat, which you do. The conversation ends.
  35557. &lt;/dl>
  35558. &lt;/dd>
  35559. &lt;/dl></pre>
  35560. </div>
  35561. <div class=example>
  35562. <p>In some games, conversations are simpler: each character merely has a fixed set of lines that
  35563. they say. In this example, a game FAQ/walkthrough lists some of the known possible responses for
  35564. each character:</p>
  35565. <pre>&lt;section>
  35566. &lt;h1>Dialogue&lt;/h1>
  35567. &lt;p>&lt;small>Some characters repeat their lines in order each time you interact
  35568. with them, others randomly pick from amongst their lines. Those who respond in
  35569. order have numbered entries in the lists below.&lt;/small>
  35570. &lt;h2>The Shopkeeper&lt;/h2>
  35571. &lt;ul>
  35572. &lt;li>How may I help you?
  35573. &lt;li>Fresh apples!
  35574. &lt;li>A loaf of bread for madam?
  35575. &lt;/ul>
  35576. &lt;h2>The pilot&lt;/h2>
  35577. &lt;p>Before the accident:
  35578. &lt;ul>
  35579. &lt;/li>I'm about to fly out, sorry!
  35580. &lt;/li>Sorry, I'm just waiting for flight clearance and then I'll be off!
  35581. &lt;/ul>
  35582. &lt;p>After the accident:
  35583. &lt;ol>
  35584. &lt;li>I'm about to fly out, sorry!
  35585. &lt;li>Ok, I'm not leaving right now, my plane is being cleaned.
  35586. &lt;li>Ok, it's not being cleaned, it needs a minor repair first.
  35587. &lt;li>Ok, ok, stop bothering me! Truth is, I had a crash.
  35588. &lt;/ol>
  35589. &lt;h2>Clan Leader&lt;/h2>
  35590. &lt;p>During the first clan meeting:
  35591. &lt;ul>
  35592. &lt;li>Hey, have you seen my daughter? I bet she's up to something nefarious again...
  35593. &lt;li>Nice weather we're having today, eh?
  35594. &lt;li>The name is Bailey, Jeff Bailey. How can I help you today?
  35595. &lt;li>A glass of water? Fresh from the well!
  35596. &lt;/ul>
  35597. &lt;p>After the earthquake:
  35598. &lt;ol>
  35599. &lt;li>Everyone is safe in the shelter, we just have to put out the fire!
  35600. &lt;li>I'll go and tell the fire brigade, you keep hosing it down!
  35601. &lt;/ol>
  35602. &lt;/section></pre>
  35603. </div>
  35604. <h4 id=footnotes>4.13.5 Footnotes</h4>
  35605. <p>HTML does not have a dedicated mechanism for marking up footnotes. Here are the suggested
  35606. alternatives.</p>
  35607. <hr>
  35608. <p>For short inline annotations, the <code id=footnotes:attr-title><a href=#attr-title>title</a></code> attribute could be used.</p>
  35609. <div class=example>
  35610. <p>In this example, two parts of a dialogue are annotated with footnote-like content using the
  35611. <code id=footnotes:attr-title-2><a href=#attr-title>title</a></code> attribute.</p>
  35612. <pre>&lt;p> &lt;b>Customer&lt;/b>: Hello! I wish to register a complaint. Hello. Miss?
  35613. &lt;p> &lt;b>Shopkeeper&lt;/b>: <strong>&lt;span title="Colloquial pronunciation of 'What do you'"</strong>
  35614. >Watcha&lt;/span> mean, miss?
  35615. &lt;p> &lt;b>Customer&lt;/b>: Uh, I'm sorry, I have a cold. I wish to make a complaint.
  35616. &lt;p> &lt;b>Shopkeeper&lt;/b>: Sorry, &lt;span <strong>title="This is, of course, a lie."</strong>>we're
  35617. closing for lunch&lt;/span>.</pre>
  35618. </div>
  35619. <p class=note>Unfortunately, relying on the <code id=footnotes:attr-title-3><a href=#attr-title>title</a></code> attribute is
  35620. currently discouraged as many user agents do not expose the attribute in an accessible manner as
  35621. required by this specification (e.g. requiring a pointing device such as a mouse to cause a
  35622. tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a
  35623. modern phone or tablet).</p>
  35624. <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
  35625. draw the reader's attention to the elements with the attribute.</p>
  35626. <div class=example>
  35627. <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>
  35628. <pre>[title] { border-bottom: thin dashed; }</pre>
  35629. </div>
  35630. <hr>
  35631. <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
  35632. in the document. The convention is that the contents of the link be a number in square
  35633. brackets.</p>
  35634. <div class=example>
  35635. <p>In this example, a footnote in the dialogue links to a paragraph below the dialogue. The
  35636. paragraph then reciprocally links back to the dialogue, allowing the user to return to the
  35637. location of the footnote.</p>
  35638. <pre>&lt;p> Announcer: Number 16: The &lt;i>hand&lt;/i>.
  35639. &lt;p> Interviewer: Good evening. I have with me in the studio tonight
  35640. Mr Norman St John Polevaulter, who for the past few years has been
  35641. contradicting people. Mr Polevaulter, why &lt;em>do&lt;/em> you
  35642. contradict people?
  35643. &lt;p> Norman: I don't. &lt;sup>&lt;a href="#fn1" id="r1">[1]&lt;/a>&lt;/sup>
  35644. &lt;p> Interviewer: You told me you did!
  35645. <em>...</em>
  35646. &lt;section>
  35647. &lt;p id="fn1">&lt;a href="#r1">[1]&lt;/a> This is, naturally, a lie,
  35648. but paradoxically if it were true he could not say so without
  35649. contradicting the interviewer and thus making it false.&lt;/p>
  35650. &lt;/section></pre>
  35651. </div>
  35652. <hr>
  35653. <p>For side notes, longer annotations that apply to entire sections of the text rather than just
  35654. specific words or sentences, the <code id=footnotes:the-aside-element><a href=#the-aside-element>aside</a></code> element should be used.</p>
  35655. <div class=example>
  35656. <p>In this example, a sidebar is given after a dialogue, giving it some context.</p>
  35657. <pre>&lt;p> &lt;span class="speaker">Customer&lt;/span>: I will not buy this record, it is scratched.
  35658. &lt;p> &lt;span class="speaker">Shopkeeper&lt;/span>: I'm sorry?
  35659. &lt;p> &lt;span class="speaker">Customer&lt;/span>: I will not buy this record, it is scratched.
  35660. &lt;p> &lt;span class="speaker">Shopkeeper&lt;/span>: No no no, this's'a tobacconist's.
  35661. &lt;aside>
  35662. &lt;p>In 1970, the British Empire lay in ruins, and foreign
  35663. nationalists frequented the streets — many of them Hungarians
  35664. (not the streets — the foreign nationals). Sadly, Alexander
  35665. Yalt has been publishing incompetently-written phrase books.
  35666. &lt;/aside></pre>
  35667. </div>
  35668. <hr>
  35669. <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
  35670. <code id=footnotes:the-caption-element><a href=#the-caption-element>caption</a></code> element, or in surrounding prose.</p>
  35671. <div class=example>
  35672. <p>In this example, a table has cells with footnotes that are given in prose. A
  35673. <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
  35674. its footnotes.</p>
  35675. <pre>&lt;figure>
  35676. &lt;figcaption>Table 1. Alternative activities for knights.&lt;/figcaption>
  35677. &lt;table>
  35678. &lt;tr>
  35679. &lt;th> Activity
  35680. &lt;th> Location
  35681. &lt;th> Cost
  35682. &lt;tr>
  35683. &lt;td> Dance
  35684. &lt;td> Wherever possible
  35685. &lt;td> £0&lt;sup>&lt;a href="#fn1">1&lt;/a>&lt;/sup>
  35686. &lt;tr>
  35687. &lt;td> Routines, chorus scenes&lt;sup>&lt;a href="#fn2">2&lt;/a>&lt;/sup>
  35688. &lt;td> Undisclosed
  35689. &lt;td> Undisclosed
  35690. &lt;tr>
  35691. &lt;td> Dining&lt;sup>&lt;a href="#fn3">3&lt;/a>&lt;/sup>
  35692. &lt;td> Camelot
  35693. &lt;td> Cost of ham, jam, and spam&lt;sup>&lt;a href="#fn4">4&lt;/a>&lt;/sup>
  35694. &lt;/table>
  35695. &lt;p id="fn1">1. Assumed.&lt;/p>
  35696. &lt;p id="fn2">2. Footwork impeccable.&lt;/p>
  35697. &lt;p id="fn3">3. Quality described as "well".&lt;/p>
  35698. &lt;p id="fn4">4. A lot.&lt;/p>
  35699. &lt;/figure></pre>
  35700. </div>
  35701. <h3 id=disabled-elements>4.14 Disabled elements</h3>
  35702. <p>An element is said to be <dfn id=concept-element-disabled>actually disabled</dfn> if it
  35703. one of the following:</p>
  35704. <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>
  35705. <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>
  35706. <h3 id=selectors>4.15 Matching HTML elements using selectors</h3>
  35707. <h4 id=case-sensitivity>4.15.1 Case-sensitivity</h4>
  35708. <p>The Selectors specification leaves the case-sensitivity of element names, attribute names, and
  35709. attribute values to be defined by the host language. <a href=#refsSELECTORS>[SELECTORS]</a></p>
  35710. <p class=note>The Selectors specification defines that ID and class selectors, when matched
  35711. 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
  35712. case-insensitive</a>.</p>
  35713. <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
  35714. <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
  35715. lowercase</a>. The same selector when compared to other elements must be compared according to
  35716. its original case. In both cases, the comparison is <a href=#case-sensitive id=case-sensitivity:case-sensitive>case-sensitive</a>.</p>
  35717. <p>When comparing the name part of a CSS attribute selector to the names of namespace-less
  35718. 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
  35719. 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
  35720. compared to other attributes must be compared according to its original case. In both cases, the
  35721. comparison is <a href=#case-sensitive id=case-sensitivity:case-sensitive-2>case-sensitive</a>.</p>
  35722. <p>Everything else (attribute values on <a href=#html-elements id=case-sensitivity:html-elements-3>HTML elements</a>, IDs and classes in
  35723. <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
  35724. names, and attribute values in <a href=#xml-documents id=case-sensitivity:xml-documents>XML documents</a>) must be treated as
  35725. <a href=#case-sensitive id=case-sensitivity:case-sensitive-3>case-sensitive</a> for the purposes of selector matching.</p>
  35726. <h4 id=pseudo-classes>4.15.2 Pseudo-classes</h4>
  35727. <p>There are a number of dynamic selectors that can be used with HTML. This section defines when
  35728. these selectors match HTML elements. <a href=#refsSELECTORS>[SELECTORS]</a> <a href=#refsCSSUI>[CSSUI]</a></p>
  35729. <dl><dt><dfn id=selector-link><code>:link</code></dfn><dt><dfn id=selector-visited><code>:visited</code></dfn><dd>
  35730. <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>
  35731. 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
  35732. 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>
  35733. <p>Other specifications might apply more specific rules regarding how these elements are to
  35734. match these pseudo-classes, to mitigate some privacy concerns that apply with straightforward
  35735. implementations of this requirement.</p>
  35736. <dt><dfn id=selector-active><code>:active</code></dfn><dd>
  35737. <p>The <code id=pseudo-classes:selector-active><a href=#selector-active>:active</a></code> pseudo-class is defined to match an element
  35738. <q cite=http://dev.w3.org/csswg/selectors3/#the-user-action-pseudo-classes-hover-act>while an
  35739. 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
  35740. element as <i>being activated</i> if it is:</p>
  35741. <ul><li>
  35742. <p>An element falling into one of the following categories between the time the user begins to
  35743. indicate an intent to trigger the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior>activation behavior</a> and either the
  35744. time the user stops indicating an intent to trigger the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior-2>activation
  35745. behavior</a>, or the time the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior-3>activation behavior</a> has finished
  35746. running, which ever comes first:</p>
  35747. <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>
  35748. 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>
  35749. 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>
  35750. 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
  35751. 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
  35752. 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>
  35753. <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>
  35754. element by pressing the space bar, the element would match this pseudo-class in between the
  35755. time that the element received the <code id=pseudo-classes:event-keydown><a href=#event-keydown>keydown</a></code> event and the
  35756. time the element received the <code id=pseudo-classes:event-keyup><a href=#event-keyup>keyup</a></code> event.</p>
  35757. <li>
  35758. <p>An element that the user indicates using a pointing device while that pointing device is in
  35759. the "down" state (e.g. for a mouse, between the time the mouse button is pressed and the time
  35760. it is depressed).</p>
  35761. <li>
  35762. <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>
  35763. </ul>
  35764. <dt><dfn id=selector-hover><code>:hover</code></dfn><dd>
  35765. <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
  35766. user <i>designates</i> an element with a pointing device</q>. For the purposes of defining the
  35767. <code id=pseudo-classes:selector-hover-2><a href=#selector-hover>:hover</a></code> pseudo-class only, an HTML user agent must consider
  35768. an element as being one that the user <i>designates</i> if it is:</p>
  35769. <ul><li>
  35770. <p>An element that the user indicates using a pointing device.</p>
  35771. <li>
  35772. <p>An element that has a descendant that the user indicates using a pointing device.</p>
  35773. <li>
  35774. <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
  35775. currently matching <a href=#selector-hover id=pseudo-classes:selector-hover-3>:hover</a>.</p>
  35776. </ul>
  35777. <div class=example>
  35778. <p>Consider in particular a fragment such as:</p>
  35779. <pre>&lt;p> &lt;label for=c> &lt;input id=a> &lt;/label> &lt;span id=b> &lt;input id=c> &lt;/span> &lt;/p></pre>
  35780. <p>If the user designates the element with ID "<code>a</code>" with their pointing
  35781. 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),
  35782. 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
  35783. with ID "<code>c</code>" will match the <a href=#selector-hover id=pseudo-classes:selector-hover-4>:hover</a>
  35784. pseudo-class. The element with ID "<code>a</code>" matches it from condition 1, the
  35785. <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
  35786. descendants is designated), and the element with ID "<code>c</code>" matches it
  35787. 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>"
  35788. does <em>not</em> match <a href=#selector-hover id=pseudo-classes:selector-hover-6>:hover</a>: its descendant is not
  35789. designated, even though it matches <a href=#selector-hover id=pseudo-classes:selector-hover-7>:hover</a>.</p>
  35790. </div>
  35791. <dt><dfn id=selector-focus><code>:focus</code></dfn><dd>
  35792. <p>For the purposes of the CSS ':focus' pseudo-class, an <dfn id=element-has-the-focus>element has the focus</dfn> when
  35793. 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
  35794. <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
  35795. 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>
  35796. <dt><dfn id=selector-enabled><code>:enabled</code></dfn><dd>
  35797. <p>The <code id=pseudo-classes:selector-enabled><a href=#selector-enabled>:enabled</a></code> pseudo-class must match any element
  35798. that is one of the following:</p>
  35799. <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>
  35800. <dt><dfn id=selector-disabled><code>:disabled</code></dfn><dd>
  35801. <p>The <code id=pseudo-classes:selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-class must match any element that
  35802. is <a href=#concept-element-disabled id=pseudo-classes:concept-element-disabled>actually disabled</a>.</p>
  35803. <dt><dfn id=selector-checked><code>:checked</code></dfn><dd>
  35804. <p>The <code id=pseudo-classes:selector-checked><a href=#selector-checked>:checked</a></code> pseudo-class must match any element
  35805. falling into one of the following categories:</p>
  35806. <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
  35807. 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
  35808. 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
  35809. 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
  35810. <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
  35811. 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>
  35812. <dt><dfn id=selector-indeterminate><code>:indeterminate</code></dfn><dd>
  35813. <p>The <code id=pseudo-classes:selector-indeterminate><a href=#selector-indeterminate>:indeterminate</a></code> pseudo-class must match any
  35814. element falling into one of the following categories:</p>
  35815. <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
  35816. 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
  35817. 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
  35818. 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>
  35819. content attribute</ul>
  35820. <dt><dfn id=selector-default><code>:default</code></dfn><dd>
  35821. <p>The <code id=pseudo-classes:selector-default><a href=#selector-default>:default</a></code> pseudo-class must match any element
  35822. falling into one of the following categories:</p>
  35823. <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
  35824. 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
  35825. <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>
  35826. attribute applies and that have a <code id=pseudo-classes:attr-input-checked-2><a href=#attr-input-checked>checked</a></code>
  35827. 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>
  35828. attribute</ul>
  35829. <dt><dfn id=selector-valid><code>:valid</code></dfn><dd>
  35830. <p>The <code id=pseudo-classes:selector-valid><a href=#selector-valid>:valid</a></code> pseudo-class must match any element falling
  35831. into one of the following categories:</p>
  35832. <ul><li>elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation>candidates for
  35833. constraint validation</a> and that <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid>satisfy their
  35834. 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
  35835. themselves are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-2>candidates for constraint
  35836. validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-2>satisfy their
  35837. 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
  35838. not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-3>satisfy their constraints</a></ul>
  35839. <dt><dfn id=selector-invalid><code>:invalid</code></dfn><dd>
  35840. <p>The <code id=pseudo-classes:selector-invalid><a href=#selector-invalid>:invalid</a></code> pseudo-class must match any element
  35841. falling into one of the following categories:</p>
  35842. <ul><li>elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-4>candidates for
  35843. constraint validation</a> but that do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-4>satisfy their
  35844. 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
  35845. that themselves are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-5>candidates for constraint
  35846. validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-5>satisfy their
  35847. 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
  35848. are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-6>candidates for constraint
  35849. validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-6>satisfy their
  35850. constraints</a></ul>
  35851. <dt><dfn id=selector-in-range><code>:in-range</code></dfn><dd>
  35852. <p>The <code id=pseudo-classes:selector-in-range><a href=#selector-in-range>:in-range</a></code> pseudo-class must match all elements
  35853. that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-7>candidates for constraint
  35854. 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
  35855. from an underflow</a> nor <a href=#suffering-from-an-overflow id=pseudo-classes:suffering-from-an-overflow>suffering from an overflow</a>.</p>
  35856. <dt><dfn id=selector-out-of-range><code>:out-of-range</code></dfn><dd>
  35857. <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
  35858. elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-8>candidates for constraint
  35859. 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
  35860. an underflow</a> or <a href=#suffering-from-an-overflow id=pseudo-classes:suffering-from-an-overflow-2>suffering from an overflow</a>.</p>
  35861. <dt><dfn id=selector-required><code>:required</code></dfn><dd>
  35862. <p>The <code id=pseudo-classes:selector-required><a href=#selector-required>:required</a></code> pseudo-class must match any element
  35863. falling into one of the following categories:</p>
  35864. <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>
  35865. 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>
  35866. <dt><dfn id=selector-optional><code>:optional</code></dfn><dd>
  35867. <p>The <code id=pseudo-classes:selector-optional><a href=#selector-optional>:optional</a></code> pseudo-class must match any element
  35868. falling into one of the following categories:</p>
  35869. <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>
  35870. 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>
  35871. <dt><dfn id=selector-read-only><code>:read-only</code></dfn><dt><dfn id=selector-read-write><code>:read-write</code></dfn><dd>
  35872. <p>The <code id=pseudo-classes:selector-read-write><a href=#selector-read-write>:read-write</a></code> pseudo-class must match any element
  35873. falling into one of the following categories, which for the purposes of Selectors are thus
  35874. considered <i>user-alterable</i>: <a href=#refsSELECTORS>[SELECTORS]</a></p>
  35875. <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>
  35876. 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
  35877. have the <code id=pseudo-classes:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code> attribute specified and that are not
  35878. <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>
  35879. 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>
  35880. <p>The <code id=pseudo-classes:selector-read-only><a href=#selector-read-only>:read-only</a></code> pseudo-class must match all other
  35881. <a href=#html-elements id=pseudo-classes:html-elements>HTML elements</a>.</p>
  35882. <dt><dfn id=selector-ltr><code>:dir(ltr)</code></dfn><dd>
  35883. <p>The <code id=pseudo-classes:selector-ltr><a href=#selector-ltr>:dir(ltr)</a></code> pseudo-class must match all elements whose
  35884. <a href=#the-directionality id=pseudo-classes:the-directionality>directionality</a> is '<a href=#concept-ltr id=pseudo-classes:concept-ltr>ltr</a>'.</p>
  35885. <dt><dfn id=selector-rtl><code>:dir(rtl)</code></dfn><dd>
  35886. <p>The <code id=pseudo-classes:selector-rtl><a href=#selector-rtl>:dir(rtl)</a></code> pseudo-class must match all elements whose
  35887. <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>
  35888. </dl>
  35889. <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>
  35890. pseudo-class.</p>
  35891. <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
  35892. detail in a language-agnostic fashion in the Selectors specification. <a href=#refsSELECTORS>[SELECTORS]</a></p>
  35893. <h2 id=microdata>5 <dfn>Microdata</dfn></h2>
  35894. <h3 id=introduction-7>5.1 Introduction</h3>
  35895. <h4 id=overview>5.1.1 Overview</h4>
  35896. <p><i>This section is non-normative.</i></p>
  35897. <p>Sometimes, it is desirable to annotate content with specific machine-readable labels, e.g. to
  35898. allow generic scripts to provide services that are customised to the page, or to enable content
  35899. from a variety of cooperating authors to be processed by a single script in a consistent
  35900. manner.</p>
  35901. <p>For this purpose, authors can use the microdata features described in this section. Microdata
  35902. allows nested groups of name-value pairs to be added to documents, in parallel with the existing
  35903. content.</p>
  35904. <h4 id=the-basic-syntax>5.1.2 The basic syntax</h4>
  35905. <p><i>This section is non-normative.</i></p>
  35906. <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
  35907. are represented by regular elements.</p>
  35908. <p>To create an item, the <code id=the-basic-syntax:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is used.</p>
  35909. <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
  35910. on one of the <a href=#concept-item id=the-basic-syntax:concept-item-2>item's</a> descendants.</p>
  35911. <div class=example>
  35912. <p>Here there are two items, each of which has the property "name":</p>
  35913. <pre>&lt;div itemscope>
  35914. &lt;p>My name is &lt;span itemprop="name">Elizabeth&lt;/span>.&lt;/p>
  35915. &lt;/div>
  35916. &lt;div itemscope>
  35917. &lt;p>My name is &lt;span itemprop="name">Daniel&lt;/span>.&lt;/p>
  35918. &lt;/div></pre>
  35919. </div>
  35920. <p>Markup without the microdata-related attributes does not have any effect on the microdata
  35921. model.</p>
  35922. <div class=example>
  35923. <p>These two examples are exactly equivalent, at a microdata level, as the previous two examples
  35924. respectively:</p>
  35925. <pre>&lt;div itemscope>
  35926. &lt;p>My &lt;em>name&lt;/em> is &lt;span itemprop="name">E&lt;strong>liz&lt;/strong>abeth&lt;/span>.&lt;/p>
  35927. &lt;/div>
  35928. &lt;section>
  35929. &lt;div itemscope>
  35930. &lt;aside>
  35931. &lt;p>My name is &lt;span itemprop="name">&lt;a href="/?user=daniel">Daniel&lt;/a>&lt;/span>.&lt;/p>
  35932. &lt;/aside>
  35933. &lt;/div>
  35934. &lt;/section></pre>
  35935. </div>
  35936. <p>Properties generally have values that are strings.</p>
  35937. <div class=example>
  35938. <p>Here the item has three properties:</p>
  35939. <pre>&lt;div itemscope>
  35940. &lt;p>My name is &lt;span itemprop="name">Neil&lt;/span>.&lt;/p>
  35941. &lt;p>My band is called &lt;span itemprop="band">Four Parts Water&lt;/span>.&lt;/p>
  35942. &lt;p>I am &lt;span itemprop="nationality">British&lt;/span>.&lt;/p>
  35943. &lt;/div></pre>
  35944. </div>
  35945. <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
  35946. 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
  35947. <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
  35948. resources.</p>
  35949. <div class=example>
  35950. <p>In this example, the item has one property, "image", whose value is a URL:</p>
  35951. <pre>&lt;div itemscope>
  35952. &lt;img itemprop="image" src="google-logo.png" alt="Google">
  35953. &lt;/div></pre>
  35954. </div>
  35955. <p>When a string value is in some machine-readable format unsuitable for human consumption, it is
  35956. 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>
  35957. element, with the human-readable version given in the element's contents.</p>
  35958. <div class=example>
  35959. <p>Here, there is an item with a property whose value is a product ID. The ID is not
  35960. human-friendly, so the product's name is used the human-visible text instead of the ID.</p>
  35961. <pre>&lt;h1 itemscope>
  35962. &lt;data itemprop="product-id" value="9678AOU879">The Instigator 2000&lt;/data>
  35963. &lt;/h1></pre>
  35964. </div>
  35965. <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>
  35966. <div class=example>
  35967. <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>
  35968. <pre>&lt;div itemscope itemtype="http://schema.org/Product">
  35969. &lt;span itemprop="name">Panasonic White 60L Refrigerator&lt;/span>
  35970. &lt;img src="panasonic-fridge-60l-white.jpg" alt="">
  35971. &lt;div itemprop="aggregateRating"
  35972. itemscope itemtype="http://schema.org/AggregateRating">
  35973. &lt;meter itemprop="ratingValue" min=0 value=3.5 max=5>Rated 3.5/5&lt;/meter>
  35974. (based on &lt;span itemprop="reviewCount">11&lt;/span> customer reviews)
  35975. &lt;/div>
  35976. &lt;/div></pre>
  35977. </div>
  35978. <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>
  35979. <div class=example>
  35980. <p>In this example, the item has one property, "birthday", whose value is a date:</p>
  35981. <pre>&lt;div itemscope>
  35982. I was born on &lt;time itemprop="birthday" datetime="2009-05-10">May 10th 2009&lt;/time>.
  35983. &lt;/div></pre>
  35984. </div>
  35985. <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>
  35986. <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>
  35987. <div class=example>
  35988. <p>In this example, the outer item represents a person, and the inner one represents a band:</p>
  35989. <pre>&lt;div itemscope>
  35990. &lt;p>Name: &lt;span itemprop="name">Amanda&lt;/span>&lt;/p>
  35991. &lt;p>Band: &lt;span itemprop="band" itemscope> &lt;span itemprop="name">Jazz Band&lt;/span> (&lt;span itemprop="size">12&lt;/span> players)&lt;/span>&lt;/p>
  35992. &lt;/div></pre>
  35993. <p>The outer item here has two properties, "name" and "band". The "name" is "Amanda", and the
  35994. "band" is an item in its own right, with two properties, "name" and "size". The "name" of the
  35995. band is "Jazz Band", and the "size" is "12".</p>
  35996. <p>The outer item in this example is a top-level microdata item.</p>
  35997. </div>
  35998. <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.
  35999. This attribute takes a list of IDs of elements to crawl in addition to crawling the children of
  36000. the element with the <code id=the-basic-syntax:attr-itemscope-4><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
  36001. <div class=example>
  36002. <p>This example is the same as the previous one, but all the properties are separated from their
  36003. <a href=#concept-item id=the-basic-syntax:concept-item-4>items</a>:</p>
  36004. <pre>&lt;div itemscope id="amanda" itemref="a b">&lt;/div>
  36005. &lt;p id="a">Name: &lt;span itemprop="name">Amanda&lt;/span>&lt;/p>
  36006. &lt;div id="b" itemprop="band" itemscope itemref="c">&lt;/div>
  36007. &lt;div id="c">
  36008. &lt;p>Band: &lt;span itemprop="name">Jazz Band&lt;/span>&lt;/p>
  36009. &lt;p>Size: &lt;span itemprop="size">12&lt;/span> players&lt;/p>
  36010. &lt;/div></pre>
  36011. <p>This gives the same result as the previous example. The first item has two properties, "name",
  36012. set to "Amanda", and "band", set to another item. That second item has two further properties,
  36013. "name", set to "Jazz Band", and "size", set to "12".</p>
  36014. </div>
  36015. <p>An <a href=#concept-item id=the-basic-syntax:concept-item-5>item</a> can have multiple properties with the same name and
  36016. different values.</p>
  36017. <div class=example>
  36018. <p>This example describes an ice cream, with two flavors:</p>
  36019. <pre>&lt;div itemscope>
  36020. &lt;p>Flavors in my favorite ice cream:&lt;/p>
  36021. &lt;ul>
  36022. &lt;li itemprop="flavor">Lemon sorbet&lt;/li>
  36023. &lt;li itemprop="flavor">Apricot sorbet&lt;/li>
  36024. &lt;/ul>
  36025. &lt;/div></pre>
  36026. <p>This thus results in an item with two properties, both "flavor", having the values "Lemon
  36027. sorbet" and "Apricot sorbet".</p>
  36028. </div>
  36029. <p>An element introducing a property can also introduce multiple properties at once, to avoid
  36030. duplication when some of the properties have the same value.</p>
  36031. <div class=example>
  36032. <p>Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to
  36033. the value "orange":</p>
  36034. <pre>&lt;div itemscope>
  36035. &lt;span itemprop="favorite-color favorite-fruit">orange&lt;/span>
  36036. &lt;/div></pre>
  36037. </div>
  36038. <p>It's important to note that there is no relationship between the microdata and the content of
  36039. the document where the microdata is marked up.</p>
  36040. <div class=example>
  36041. <p>There is no semantic difference, for instance, between the following two examples:</p>
  36042. <pre>&lt;figure>
  36043. &lt;img src="castle.jpeg">
  36044. &lt;figcaption>&lt;span itemscope>&lt;span itemprop="name">The Castle&lt;/span>&lt;/span> (1986)&lt;/figcaption>
  36045. &lt;/figure></pre>
  36046. <pre>&lt;span itemscope>&lt;meta itemprop="name" content="The Castle">&lt;/span>
  36047. &lt;figure>
  36048. &lt;img src="castle.jpeg">
  36049. &lt;figcaption>The Castle (1986)&lt;/figcaption>
  36050. &lt;/figure></pre>
  36051. <p>Both have a figure with a caption, and both, completely unrelated to the figure, have an item
  36052. with a name-value pair with the name "name" and the value "The Castle". The only difference is
  36053. that if the user drags the caption out of the document, in the former case, the item will be
  36054. included in the drag-and-drop data. In neither case is the image in any way associated with the
  36055. item.</p>
  36056. </div>
  36057. <h4 id=typed-items>5.1.3 Typed items</h4>
  36058. <p><i>This section is non-normative.</i></p>
  36059. <p>The examples in the previous section show how information could be marked up on a page that
  36060. doesn't expect its microdata to be re-used. Microdata is most useful, though, when it is used in
  36061. contexts where other authors and readers are able to cooperate to make new uses of the markup.</p>
  36062. <p>For this purpose, it is necessary to give each <a href=#concept-item id=typed-items:concept-item>item</a> a type,
  36063. such as "http://example.com/person", or "http://example.org/cat", or "http://band.example.net/".
  36064. Types are identified as <a href=#url id=typed-items:url>URLs</a>.</p>
  36065. <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>
  36066. <div class=example>
  36067. <p>Here, the item's type is "http://example.org/animals#cat":</p>
  36068. <pre>&lt;section itemscope itemtype="http://example.org/animals#cat">
  36069. &lt;h1 itemprop="name">Hedral&lt;/h1>
  36070. &lt;p itemprop="desc">Hedral is a male american domestic
  36071. shorthair, with a fluffy black fur with white paws and belly.&lt;/p>
  36072. &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
  36073. &lt;/section></pre>
  36074. <p>In this example the "http://example.org/animals#cat" item has three properties, a "name"
  36075. ("Hedral"), a "desc" ("Hedral is..."), and an "img" ("hedral.jpeg").</p>
  36076. </div>
  36077. <p>The type gives the context for the properties, thus selecting a vocabulary: a property named
  36078. "class" given for an item with the type "http://census.example/person" might refer to the economic
  36079. class of an individual, while a property named "class" given for an item with the type
  36080. "http://example.com/school/teacher" might refer to the classroom a teacher has been assigned.
  36081. 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
  36082. (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
  36083. "<code>classroom</code>" property). Multiple types defined to use the same vocabulary can
  36084. be given for a single item by listing the URLs as a space-separated list in the attribute' value.
  36085. An item cannot be given two types if they do not use the same vocabulary, however.</p>
  36086. <h4 id=global-identifiers-for-items>5.1.4 Global identifiers for items</h4>
  36087. <p><i>This section is non-normative.</i></p>
  36088. <p>Sometimes, an <a href=#concept-item id=global-identifiers-for-items:concept-item>item</a> gives information about a topic that has a
  36089. global identifier. For example, books can be identified by their ISBN number.</p>
  36090. <p>Vocabularies (as identified by the <code id=global-identifiers-for-items:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute) can
  36091. be designed such that <a href=#concept-item id=global-identifiers-for-items:concept-item-2>items</a> get associated with their global
  36092. 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>
  36093. <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>
  36094. <div class=example>
  36095. <p>Here, an item is talking about a particular book:</p>
  36096. <pre>&lt;dl itemscope
  36097. itemtype="http://vocab.example.net/book"
  36098. <strong>itemid="urn:isbn:0-330-34032-8"</strong>>
  36099. &lt;dt>Title
  36100. &lt;dd itemprop="title">The Reality Dysfunction
  36101. &lt;dt>Author
  36102. &lt;dd itemprop="author">Peter F. Hamilton
  36103. &lt;dt>Publication date
  36104. &lt;dd>&lt;time itemprop="pubdate" datetime="1996-01-26">26 January 1996&lt;/time>
  36105. &lt;/dl></pre>
  36106. <p>The "<code>http://vocab.example.net/book</code>" vocabulary in this example would
  36107. 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>
  36108. </div>
  36109. <h4 id=selecting-names-when-defining-vocabularies>5.1.5 Selecting names when defining vocabularies</h4>
  36110. <p><i>This section is non-normative.</i></p>
  36111. <p>Using microdata means using a vocabulary. For some purposes, an ad-hoc vocabulary is adequate.
  36112. For others, a vocabulary will need to be designed. Where possible, authors are encouraged to
  36113. re-use existing vocabularies, as this makes content re-use easier.</p>
  36114. <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,
  36115. conflicts with other vocabularies can be avoided by only using identifiers that correspond to
  36116. pages that the author has control over.</p>
  36117. <div class=example>
  36118. <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
  36119. they could select identifiers of the form
  36120. "http://example.com/~jon/name" and "http://example.com/~adam/name"
  36121. respectively.</p>
  36122. </div>
  36123. <p>Properties whose names are just plain words can only be used within the context of the types
  36124. for which they are intended; properties named using URLs can be reused in items of any type. If an
  36125. item has no type, and is not part of another item, then if its properties have names that are just
  36126. plain words, they are not intended to be globally unique, and are instead only intended for
  36127. limited use. Generally speaking, authors are encouraged to use either properties with globally
  36128. unique names (URLs) or ensure that their items are typed.</p>
  36129. <div class=example>
  36130. <p>Here, an item is an "http://example.org/animals#cat", and most of the properties have names
  36131. that are words defined in the context of that type. There are also a few additional properties
  36132. whose names come from other vocabularies.</p>
  36133. <pre>&lt;section itemscope itemtype="http://example.org/animals#cat">
  36134. &lt;h1 itemprop="name http://example.com/fn">Hedral&lt;/h1>
  36135. &lt;p itemprop="desc">Hedral is a male american domestic
  36136. shorthair, with a fluffy &lt;span
  36137. itemprop="http://example.com/color">black&lt;/span> fur with &lt;span
  36138. itemprop="http://example.com/color">white&lt;/span> paws and belly.&lt;/p>
  36139. &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
  36140. &lt;/section></pre>
  36141. <p>This example has one item with the type "http://example.org/animals#cat" and the following
  36142. properties:</p>
  36143. <table><thead><tr><td>Property
  36144. <td>Value
  36145. <tbody><tr><td>name
  36146. <td>Hedral
  36147. <tr><td>http://example.com/fn
  36148. <td>Hedral
  36149. <tr><td>desc
  36150. <td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.
  36151. <tr><td>http://example.com/color
  36152. <td>black
  36153. <tr><td>http://example.com/color
  36154. <td>white
  36155. <tr><td>img
  36156. <td>.../hedral.jpeg
  36157. </table>
  36158. </div>
  36159. <h4 id=using-the-microdata-dom-api>5.1.6 Using the microdata DOM API</h4>
  36160. <p><i>This section is non-normative.</i></p>
  36161. <p>The microdata becomes even more useful when scripts can use it to expose information to the
  36162. user, for example offering it in a form that can be used by other applications.</p>
  36163. <p>The <code id=using-the-microdata-dom-api:dom-document-getitems><a href=#dom-document-getitems>document.getItems(<var>typeNames</var>)</a></code>
  36164. 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
  36165. <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
  36166. is specified.</p>
  36167. <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
  36168. the relevant <code id=using-the-microdata-dom-api:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is found. These elements have
  36169. their <code id=using-the-microdata-dom-api:dom-itemscope><a href=#dom-itemscope>element.itemScope</a></code> IDL attribute set to true.</p>
  36170. <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>
  36171. <div class=example>
  36172. <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
  36173. used to obtain a list of all the top-level microdata items of a particular type given in the
  36174. document:</p>
  36175. <pre>var cats = document.getItems("http://example.com/feline");</pre>
  36176. </div>
  36177. <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
  36178. properties can be extracted using the <code id=using-the-microdata-dom-api:dom-properties><a href=#dom-properties>properties</a></code> IDL
  36179. attribute. This attribute returns an <code id=using-the-microdata-dom-api:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code>, which can be
  36180. enumerated to go through each element that adds one or more properties to the item. It can also be
  36181. indexed by name, which will return an object with a list of the elements that add properties with
  36182. that name.</p>
  36183. <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
  36184. attribute that returns its value.</p>
  36185. <div class=example>
  36186. <p>This sample gets the first item of type "http://example.net/user" and then pops up an alert
  36187. using the "name" property from that item.</p>
  36188. <pre>var user = document.getItems('http://example.net/user')[0];
  36189. alert('Hello ' + user.properties['name'][0].itemValue + '!');</pre>
  36190. </div>
  36191. <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
  36192. returns a <code id=using-the-microdata-dom-api:propertynodelist><a href=#propertynodelist>PropertyNodeList</a></code> object with all the matching properties. The
  36193. <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
  36194. <em>its</em> <code id=using-the-microdata-dom-api:dom-propertynodelist-getvalues><a href=#dom-propertynodelist-getvalues>getValues</a></code> method, which returns
  36195. an array of all the values.</p>
  36196. <div class=example>
  36197. <p>In an earlier example, a "http://example.org/animals#cat" item had two
  36198. "http://example.com/color" values. This script looks up the first such item and then lists all
  36199. its values.</p>
  36200. <pre>var cat = document.getItems('http://example.org/animals#cat')[0];
  36201. var colors = cat.properties['http://example.com/color'].getValues();
  36202. var result;
  36203. if (colors.length == 0) {
  36204. result = 'Colour unknown.';
  36205. } else if (colors.length == 1) {
  36206. result = 'Colour: ' + colors[0];
  36207. } else {
  36208. result = 'Colours:';
  36209. for (var i = 0; i &lt; colors.length; i += 1)
  36210. result += ' ' + colors[i];
  36211. }</pre>
  36212. </div>
  36213. <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
  36214. <code id=using-the-microdata-dom-api:dom-htmlpropertiescollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code> IDL attribute.</p>
  36215. <div class=example>
  36216. <p>This example creates a big list with a nested list for each item on the page, each with all of
  36217. the property names used in that item.</p>
  36218. <pre>var outer = document.createElement('ul');
  36219. var items = document.getItems();
  36220. for (var item = 0; item &lt; items.length; item += 1) {
  36221. var itemLi = document.createElement('li');
  36222. var inner = document.createElement('ul');
  36223. for (var name = 0; name &lt; items[item].properties.names.length; name += 1) {
  36224. var propLi = document.createElement('li');
  36225. propLi.appendChild(document.createTextNode(items[item].properties.names[name]));
  36226. inner.appendChild(propLi);
  36227. }
  36228. itemLi.appendChild(inner);
  36229. outer.appendChild(itemLi);
  36230. }
  36231. document.body.appendChild(outer);</pre>
  36232. <p>If faced with the following from an earlier example:</p>
  36233. <pre>&lt;section itemscope itemtype="http://example.org/animals#cat">
  36234. &lt;h1 itemprop="name http://example.com/fn">Hedral&lt;/h1>
  36235. &lt;p itemprop="desc">Hedral is a male american domestic
  36236. shorthair, with a fluffy &lt;span
  36237. itemprop="http://example.com/color">black&lt;/span> fur with &lt;span
  36238. itemprop="http://example.com/color">white&lt;/span> paws and belly.&lt;/p>
  36239. &lt;img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
  36240. &lt;/section></pre>
  36241. <p>...it would result in the following output:</p>
  36242. <ul><li>
  36243. <ul><li>name<li>http://example.com/fn<li>desc<li>http://example.com/color<li>img</ul>
  36244. </ul>
  36245. <p>(The duplicate occurrence of "http://example.com/color" is not included in the list.)</p>
  36246. </div>
  36247. <h3 id=encoding-microdata>5.2 Encoding microdata</h3>
  36248. <h4 id=the-microdata-model>5.2.1 The microdata model</h4>
  36249. <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>
  36250. <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
  36251. 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
  36252. identifiers for items</a>), and a list of name-value pairs. Each name in the name-value pair is
  36253. 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
  36254. pairs (an <a href=#concept-item id=the-microdata-model:concept-item-4>item</a>). The names are unordered relative to each other,
  36255. but if a particular name has multiple values, they do have a relative order.</p>
  36256. <h4 id=items>5.2.2 Items</h4>
  36257. <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>
  36258. <p>An element with the <code id=items:attr-itemscope-2><a href=#attr-itemscope>itemscope</a></code> attribute specified creates a
  36259. new <dfn id=concept-item>item</dfn>, a group of name-value pairs.</p>
  36260. <hr>
  36261. <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
  36262. types</a> of the <a href=#concept-item id=items:concept-item>item</a>.</p>
  36263. <p>The <code id=items:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute, if specified, must have a value that
  36264. 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
  36265. <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
  36266. URL</a>, and all of which are defined to use the same vocabulary. The attribute's value must
  36267. have at least one token.</p>
  36268. <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
  36269. 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
  36270. 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>
  36271. <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
  36272. vocabulary.</p>
  36273. <p>Except if otherwise specified by that specification, the <a href=#url id=items:url>URLs</a> given
  36274. as the <a href=#item-types id=items:item-types-4>item types</a> should not be automatically dereferenced.</p>
  36275. <p class=note>A specification could define that its <a href=#item-types id=items:item-types-5>item type</a>
  36276. can be derefenced to provide the user with help information, for example. In fact, vocabulary
  36277. authors are encouraged to provide useful information at the given <a href=#url id=items:url-2>URL</a>.</p>
  36278. <p><a href=#item-types id=items:item-types-6>Item types</a> are opaque identifiers, and user agents must not dereference unknown
  36279. <a href=#item-types id=items:item-types-7>item types</a>, or otherwise deconstruct them, in order to determine how to process
  36280. <a href=#concept-item id=items:concept-item-4>items</a> that use them.</p>
  36281. <p>The <code id=items:attr-itemtype-3><a href=#attr-itemtype>itemtype</a></code> attribute must not be specified on elements
  36282. that do not have an <code id=items:attr-itemscope-4><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
  36283. <hr>
  36284. <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
  36285. 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
  36286. <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>,
  36287. 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>
  36288. <hr>
  36289. <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
  36290. <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
  36291. 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>
  36292. <p>The <code id=items:attr-itemid><a href=#attr-itemid>itemid</a></code> attribute, if specified, must have a value that is
  36293. 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>
  36294. <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
  36295. 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.
  36296. If the <code id=items:attr-itemid-3><a href=#attr-itemid>itemid</a></code> attribute is missing or if resolving it fails, it
  36297. is said to have no <a href=#global-identifier id=items:global-identifier>global identifier</a>.</p>
  36298. <p>The <code id=items:attr-itemid-4><a href=#attr-itemid>itemid</a></code> attribute must not be specified on elements that do
  36299. 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
  36300. 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
  36301. global identifiers for items</a>, as defined by that vocabulary's specification.</p>
  36302. <p>The exact meaning of a <a href=#global-identifier id=items:global-identifier-2>global identifier</a> is determined by the vocabulary's
  36303. specification. It is up to such specifications to define whether multiple items with the same
  36304. global identifier (whether on the same page or on different pages) are allowed to exist, and what
  36305. the processing rules for that vocabulary are with respect to handling the case of multiple items
  36306. with the same ID.</p>
  36307. <hr>
  36308. <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
  36309. elements to crawl to find the name-value pairs of the <a href=#concept-item id=items:concept-item-11>item</a>.</p>
  36310. <p>The <code id=items:attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, if specified, must have a value that
  36311. 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
  36312. <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
  36313. same <a href=#home-subtree id=items:home-subtree>home subtree</a>.</p>
  36314. <p>The <code id=items:attr-itemref-2><a href=#attr-itemref>itemref</a></code> attribute must not be specified on elements that
  36315. do not have an <code id=items:attr-itemscope-9><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
  36316. <p class=note>The <code id=items:attr-itemref-3><a href=#attr-itemref>itemref</a></code> attribute is not part of the
  36317. microdata data model. It is merely a syntactic construct to aid authors in adding annotations to
  36318. pages where the data to be annotated does not follow a convenient tree structure. For example, it
  36319. 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>
  36320. <div class=example>
  36321. <p>This example shows a simple vocabulary used to describe the products of a model railway
  36322. manufacturer. The vocabulary has just five property names:</p>
  36323. <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
  36324. whitespace), indicating the scale of the product.<dt>digital<dd>If present, one of "Digital", "Delta", or "Systems"
  36325. (potentially with leading or trailing whitespace) indicating that
  36326. the product has a digital decoder of the given type.<dt>track-type<dd>For track-specific products, one of "K", "M", "C" (potentially
  36327. with leading or trailing whitespace) indicating the type of track
  36328. for which the product is intended.</dl>
  36329. <p>This vocabulary has four defined <a href=#item-types id=items:item-types-10>item types</a>:</p>
  36330. <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>
  36331. <p>Each <a href=#concept-item id=items:concept-item-13>item</a> that uses this vocabulary can be given one or more
  36332. of these types, depending on what the product is.</p>
  36333. <p>Thus, a locomotive might be marked up as:</p>
  36334. <pre>&lt;dl itemscope itemtype="http://md.example.com/loco
  36335. http://md.example.com/lighting">
  36336. &lt;dt>Name:
  36337. &lt;dd itemprop="name">Tank Locomotive (DB 80)
  36338. &lt;dt>Product code:
  36339. &lt;dd itemprop="product-code">33041
  36340. &lt;dt>Scale:
  36341. &lt;dd itemprop="scale">HO
  36342. &lt;dt>Digital:
  36343. &lt;dd itemprop="digital">Delta
  36344. &lt;/dl></pre>
  36345. <p>A turnout lantern retrofit kit might be marked up as:</p>
  36346. <pre>&lt;dl itemscope itemtype="http://md.example.com/track
  36347. http://md.example.com/lighting">
  36348. &lt;dt>Name:
  36349. &lt;dd itemprop="name">Turnout Lantern Kit
  36350. &lt;dt>Product code:
  36351. &lt;dd itemprop="product-code">74470
  36352. &lt;dt>Purpose:
  36353. &lt;dd>For retrofitting 2 &lt;span itemprop="track-type">C&lt;/span> Track
  36354. turnouts. &lt;meta itemprop="scale" content="HO">
  36355. &lt;/dl></pre>
  36356. <p>A passenger car with no lighting might be marked up as:</p>
  36357. <pre>&lt;dl itemscope itemtype="http://md.example.com/passengers">
  36358. &lt;dt>Name:
  36359. &lt;dd itemprop="name">Express Train Passenger Car (DB Am 203)
  36360. &lt;dt>Product code:
  36361. &lt;dd itemprop="product-code">8710
  36362. &lt;dt>Scale:
  36363. &lt;dd itemprop="scale">Z
  36364. &lt;/dl></pre>
  36365. <p>Great care is necessary when creating new vocabularies. Often, a hierarchical approach to
  36366. types can be taken that results in a vocabulary where each item only ever has a single type,
  36367. which is generally much simpler to manage.</p>
  36368. </div>
  36369. <h4 id=names:-the-itemprop-attribute>5.2.3 Names: the <dfn><code>itemprop</code></dfn> attribute</h4>
  36370. <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>
  36371. <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
  36372. 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
  36373. <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
  36374. attribute's value must have at least one token.</p>
  36375. <p>Each token must be either:</p>
  36376. <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
  36377. situation according to the specification that defines the <a href=#relevant-types id=names:-the-itemprop-attribute:relevant-types>relevant types</a> for the
  36378. 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
  36379. 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
  36380. property name (i.e. one used by the author for private purposes, not defined in a public
  36381. 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
  36382. characters (.) and no U+003A COLON characters (:), used as a proprietary item property name (i.e.
  36383. one used by the author for private purposes, not defined in a public specification).</ul>
  36384. <p>Specifications that introduce <a href=#defined-property-name id=names:-the-itemprop-attribute:defined-property-name>defined property names</a>
  36385. must ensure all such property names contain no U+002E FULL STOP characters (.), no U+003A COLON
  36386. characters (:), and no <a href=#space-character id=names:-the-itemprop-attribute:space-character>space characters</a>.</p>
  36387. <p class=note>The rules above disallow U+003A COLON characters (:) in non-URL values because
  36388. otherwise they could not be distinguished from URLs. Values with U+002E FULL STOP characters (.)
  36389. are reserved for future extensions. <a href=#space-character id=names:-the-itemprop-attribute:space-character-2>Space characters</a> are
  36390. disallowed because otherwise the values would would be parsed as multiple tokens.</p>
  36391. <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>,
  36392. the requirement above regarding the tokens applies for each <a href=#concept-item id=names:-the-itemprop-attribute:concept-item-3>item</a>
  36393. individually.</p>
  36394. <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
  36395. duplicates removed (leaving only the first occurrence of each name).</p>
  36396. <p>Within an <a href=#concept-item id=names:-the-itemprop-attribute:concept-item-4>item</a>, the properties are unordered with respect to
  36397. each other, except for properties with the same name, which are ordered in the order they are
  36398. 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>
  36399. <div class=example>
  36400. <p>In the following example, the "a" property has the values "1" and "2", <em>in that order</em>,
  36401. but whether the "a" property comes before the "b" property or not is not important:</p>
  36402. <pre>&lt;div itemscope>
  36403. &lt;p itemprop="a">1&lt;/p>
  36404. &lt;p itemprop="a">2&lt;/p>
  36405. &lt;p itemprop="b">test&lt;/p>
  36406. &lt;/div></pre>
  36407. <p>Thus, the following is equivalent:</p>
  36408. <pre>&lt;div itemscope>
  36409. &lt;p itemprop="b">test&lt;/p>
  36410. &lt;p itemprop="a">1&lt;/p>
  36411. &lt;p itemprop="a">2&lt;/p>
  36412. &lt;/div></pre>
  36413. <p>As is the following:</p>
  36414. <pre>&lt;div itemscope>
  36415. &lt;p itemprop="a">1&lt;/p>
  36416. &lt;p itemprop="b">test&lt;/p>
  36417. &lt;p itemprop="a">2&lt;/p>
  36418. &lt;/div></pre>
  36419. <p>And the following:</p>
  36420. <pre>&lt;div id="x">
  36421. &lt;p itemprop="a">1&lt;/p>
  36422. &lt;/div>
  36423. &lt;div itemscope itemref="x">
  36424. &lt;p itemprop="b">test&lt;/p>
  36425. &lt;p itemprop="a">2&lt;/p>
  36426. &lt;/div>
  36427. </pre>
  36428. </div>
  36429. <h4 id=values>5.2.4 Values</h4>
  36430. <p>The <dfn id=concept-property-value>property value</dfn> of a name-value pair added by an
  36431. 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
  36432. matching case in the following list:</p>
  36433. <dl class=switch><dt>If the element also has an <code id=values:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute<dd>
  36434. <p>The value is the <a href=#concept-item id=values:concept-item>item</a> created by the element.</p>
  36435. <dt>If the element is a <code id=values:the-meta-element><a href=#the-meta-element>meta</a></code> element<dd>
  36436. <p>The value is the value of the element's <code id=values:attr-meta-content><a href=#attr-meta-content>content</a></code>
  36437. attribute, if any, or the empty string if there is no such attribute.</p>
  36438. <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>,
  36439. <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>
  36440. <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
  36441. the element at the time the attribute is set, or the empty string if there is no such attribute
  36442. or if <a href=#resolve-a-url id=values:resolve-a-url-2>resolving</a> it results in an error.</p>
  36443. <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>
  36444. <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
  36445. to the element at the time the attribute is set, or the empty string if there is no such
  36446. attribute or if <a href=#resolve-a-url id=values:resolve-a-url-4>resolving</a> it results in an error.</p>
  36447. <dt>If the element is an <code id=values:the-object-element><a href=#the-object-element>object</a></code> element<dd>
  36448. <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
  36449. to the element at the time the attribute is set, or the empty string if there is no such
  36450. attribute or if <a href=#resolve-a-url id=values:resolve-a-url-6>resolving</a> it results in an error.</p>
  36451. <dt>If the element is a <code id=values:the-data-element><a href=#the-data-element>data</a></code> element<dd>
  36452. <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,
  36453. if it has one, or the empty string otherwise.</p>
  36454. <dt>If the element is a <code id=values:the-meter-element><a href=#the-meter-element>meter</a></code> element<dd>
  36455. <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,
  36456. if it has one, or the empty string otherwise.</p>
  36457. <dt>If the element is a <code id=values:the-time-element><a href=#the-time-element>time</a></code> element<dd>
  36458. <p>The value is the element's <a href=#datetime-value id=values:datetime-value>datetime value</a>.</p>
  36459. <dt>Otherwise<dd>
  36460. <p>The value is the element's <code id=values:textcontent><a href=#textcontent>textContent</a></code>.</p>
  36461. </dl>
  36462. <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>,
  36463. <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>,
  36464. <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>
  36465. <p>If a property's <a href=#concept-property-value id=values:concept-property-value>value</a>, as defined by the property's
  36466. 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>
  36467. <p class=note>These requirements do not apply just because a property value happens to match the
  36468. syntax for a URL. They only apply if the property is explicitly defined as taking such a
  36469. value.</p>
  36470. <p class=example>For example, a book about the first moon landing could be
  36471. called "mission:moon". A "title" property from a vocabulary that defines a title as being a string
  36472. 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
  36473. <a href=#url id=values:url>URL</a>. On the other hand, if there was a (rather narrowly scoped!) vocabulary for
  36474. "books whose titles look like URLs" which had a "title" property defined to take a URL, then the
  36475. 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
  36476. other <a href=#url-property-elements id=values:url-property-elements-2>URL property elements</a>), because of the requirement above.</p>
  36477. <h4 id=associating-names-with-items>5.2.5 Associating names with items</h4>
  36478. <p>To find <dfn id=the-properties-of-an-item>the properties of an item</dfn> defined by the element <var>root</var>,
  36479. 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>
  36480. <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,
  36481. <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
  36482. 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
  36483. loop</i>.<li><p>Remove an element from <var>pending</var> and let <var>current</var> be
  36484. that element.<li><p>If <var>current</var> is already in <var>memory</var>, there is a
  36485. <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>
  36486. 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>
  36487. <p>A document must not contain any <a href=#concept-item id=associating-names-with-items:concept-item>items</a> for which the algorithm
  36488. 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
  36489. errors</dfn>.</p>
  36490. <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
  36491. 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>
  36492. attribute.</p>
  36493. <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
  36494. 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
  36495. <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
  36496. those two items.</p>
  36497. <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
  36498. 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>
  36499. <div class=example>
  36500. <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>
  36501. <pre>&lt;!DOCTYPE HTML>
  36502. &lt;html>
  36503. &lt;head>
  36504. &lt;title>Photo gallery&lt;/title>
  36505. &lt;/head>
  36506. &lt;body>
  36507. &lt;h1>My photos&lt;/h1>
  36508. &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
  36509. &lt;img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest.">
  36510. &lt;figcaption itemprop="title">The house I found.&lt;/figcaption>
  36511. &lt;/figure>
  36512. &lt;figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
  36513. &lt;img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside.">
  36514. &lt;figcaption itemprop="title">The mailbox.&lt;/figcaption>
  36515. &lt;/figure>
  36516. &lt;footer>
  36517. &lt;p id="licenses">All images licensed under the &lt;a itemprop="license"
  36518. href="http://www.opensource.org/licenses/mit-license.php">MIT
  36519. license&lt;/a>.&lt;/p>
  36520. &lt;/footer>
  36521. &lt;/body>
  36522. &lt;/html></pre>
  36523. <p>The above results in two items with the type "<code>http://n.whatwg.org/work</code>",
  36524. one with:</p>
  36525. <dl class=brief><dt>work
  36526. <dd><code>images/house.jpeg</code>
  36527. <dt>title
  36528. <dd>The house I found.
  36529. <dt>license
  36530. <dd><code>http://www.opensource.org/licenses/mit-license.php</code>
  36531. </dl>
  36532. <p>...and one with:</p>
  36533. <dl class=brief><dt>work
  36534. <dd><code>images/mailbox.jpeg</code>
  36535. <dt>title
  36536. <dd>The mailbox.
  36537. <dt>license
  36538. <dd><code>http://www.opensource.org/licenses/mit-license.php</code>
  36539. </dl>
  36540. </div>
  36541. <h4 id=microdata-and-other-namespaces>5.2.6 Microdata and other namespaces</h4>
  36542. <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
  36543. <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
  36544. processing to occur on elements in other namespaces, such as SVG.</p>
  36545. <div class=example>
  36546. <p>Thus, in the following example there is only one item, not
  36547. two.</p>
  36548. <pre class=bad>&lt;p itemscope>&lt;/p> &lt;!-- this is an item (with no properties and no type) -->
  36549. &lt;svg itemscope>&lt;/svg> &lt;!-- 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>
  36550. </div>
  36551. <h3 id=microdata-dom-api>5.3 Microdata DOM API</h3>
  36552. <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>
  36553. <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
  36554. <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
  36555. listed.</p>
  36556. <p>The <var>types</var> argument is interpreted as a space-separated list of types.</p>
  36557. <dt><var>element</var> . <code id=microdata-dom-api:dom-properties><a href=#dom-properties>properties</a></code><dd>
  36558. <p>If the element has an <code id=microdata-dom-api:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, returns an
  36559. <code id=microdata-dom-api:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object with all the element's properties. Otherwise, an
  36560. empty <code id=microdata-dom-api:htmlpropertiescollection-2-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object.</p>
  36561. <dt><var>element</var> . <code id=microdata-dom-api:dom-itemvalue><a href=#dom-itemvalue>itemValue</a></code> [ = <var>value</var> ]<dd>
  36562. <p>Returns the element's <a href=#concept-property-value id=microdata-dom-api:concept-property-value>value</a>.</p>
  36563. <p>Can be set, to change the element's <a href=#concept-property-value id=microdata-dom-api:concept-property-value-2>value</a>.
  36564. 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>
  36565. </dl>
  36566. <p>The <dfn id=dom-document-getitems><code>document.getItems(<var>typeNames</var>)</code></dfn> method takes a string that contains an
  36567. <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>,
  36568. 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>
  36569. 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
  36570. <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
  36571. 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
  36572. argument, then the method must return a <code id=microdata-dom-api:nodelist-3><a href=#nodelist>NodeList</a></code>
  36573. 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
  36574. 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
  36575. the same object as the object returned by the earlier call. In other cases, a new
  36576. <code id=microdata-dom-api:nodelist-4><a href=#nodelist>NodeList</a></code> object must be returned.</p>
  36577. <p>The <dfn id=dom-itemscope><code>itemScope</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements>HTML
  36578. 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>
  36579. content attribute. The <dfn id=dom-itemtype><code>itemType</code></dfn> IDL attribute on
  36580. <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
  36581. <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
  36582. <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
  36583. <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>
  36584. <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
  36585. 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
  36586. <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
  36587. 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
  36588. which the attribute was invoked, while that element is an <a href=#concept-item id=microdata-dom-api:concept-item-4>item</a>,
  36589. and matches nothing the rest of the time.</p>
  36590. <p>The <dfn id=dom-itemvalue><code>itemValue</code></dfn> IDL attribute's behavior depends on
  36591. the element, as follows:</p>
  36592. <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
  36593. <code id=microdata-dom-api:invalidaccesserror-2><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>
  36594. <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
  36595. <code id=microdata-dom-api:invalidaccesserror-3><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>
  36596. <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
  36597. 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>,
  36598. <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
  36599. 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
  36600. 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
  36601. 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
  36602. 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
  36603. 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
  36604. attribute, the IDL attribute must return that content attribute's value; otherwise, it must
  36605. 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
  36606. 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>
  36607. attribute.</dl>
  36608. <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
  36609. <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
  36610. 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>
  36611. <div class=example>
  36612. <p>In this example, a script checks to see if a particular element <var>element</var> is
  36613. declaring a particular property, and if it is, it increments a counter:</p>
  36614. <pre>if (element.itemProp.contains('color'))
  36615. count += 1;</pre>
  36616. </div>
  36617. <div class=example>
  36618. <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
  36619. element:</p>
  36620. <pre>for (var index = 0; index &lt; element.itemRef.length; index += 1)
  36621. process(document.getElementById(element.itemRef[index]));</pre>
  36622. </div>
  36623. <h3 id=mdvocabs>5.4 Sample microdata vocabularies</h3>
  36624. <p>The vocabularies in this section are primarily intended to demonstrate how a vocabulary is
  36625. specified, though they are also usable in their own right.</p>
  36626. <h4 id=vcard>5.4.1 vCard</h4>
  36627. <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
  36628. organization's contact information.</p>
  36629. <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>
  36630. <p>The following are the type's <a href=#defined-property-name id=vcard:defined-property-name>defined property names</a>.
  36631. They are based on the vocabulary defined in the vCard 4.0 specification and its extensions, where
  36632. more information on how to interpret the values can be found. <a href=#refsRFC6350>[RFC6350]</a></p>
  36633. <dl><dt><dfn id=md-vcard-kind><code>kind</code></dfn><dd>
  36634. <p>Describes what kind of contact the item represents.</p>
  36635. <p>The <a href=#concept-property-value id=vcard:concept-property-value>value</a> must be text that, when compared in a
  36636. <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>
  36637. <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
  36638. 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>
  36639. <dt><dfn id=md-vcard-fn><code>fn</code></dfn><dd>
  36640. <p>Gives the formatted text corresponding to the name of the person or organization.</p>
  36641. <p>The <a href=#concept-property-value id=vcard:concept-property-value-2>value</a> must be text.</p>
  36642. <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
  36643. 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>
  36644. <dt><dfn id=md-vcard-n><code>n</code></dfn><dd>
  36645. <p>Gives the structured name of the person or organization.</p>
  36646. <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>
  36647. <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
  36648. 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>
  36649. <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>
  36650. <p>Gives the family name of the person, or the full name of the organization.</p>
  36651. <p>The <a href=#concept-property-value id=vcard:concept-property-value-4>value</a> must be text.</p>
  36652. <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
  36653. 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>
  36654. <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>
  36655. <p>Gives the given-name of the person.</p>
  36656. <p>The <a href=#concept-property-value id=vcard:concept-property-value-6>value</a> must be text.</p>
  36657. <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>
  36658. 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
  36659. 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>
  36660. <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>
  36661. <p>Gives the any additional names of the person.</p>
  36662. <p>The <a href=#concept-property-value id=vcard:concept-property-value-8>value</a> must be text.</p>
  36663. <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
  36664. 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>
  36665. <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>
  36666. <p>Gives the honorific prefix of the person.</p>
  36667. <p>The <a href=#concept-property-value id=vcard:concept-property-value-10>value</a> must be text.</p>
  36668. <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
  36669. 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>
  36670. <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>
  36671. <p>Gives the honorific suffix of the person.</p>
  36672. <p>The <a href=#concept-property-value id=vcard:concept-property-value-12>value</a> must be text.</p>
  36673. <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
  36674. 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>
  36675. <dt><dfn id=md-vcard-nickname><code>nickname</code></dfn><dd>
  36676. <p>Gives the nickname of the person or organization.</p>
  36677. <p class=note>The nickname is the descriptive name given instead of or in addition to the one
  36678. belonging to a person, place, or thing. It can also be used to specify a familiar form of a
  36679. 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>
  36680. <p>The <a href=#concept-property-value id=vcard:concept-property-value-14>value</a> must be text.</p>
  36681. <p>Any number of properties with the name <code id=vcard:md-vcard-nickname><a href=#md-vcard-nickname>nickname</a></code> may be
  36682. 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>
  36683. <dt><dfn id=md-vcard-photo><code>photo</code></dfn><dd>
  36684. <p>Gives a photograph of the person or organization.</p>
  36685. <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
  36686. URL</a>.</p>
  36687. <p>Any number of properties with the name <code id=vcard:md-vcard-photo><a href=#md-vcard-photo>photo</a></code> may be
  36688. 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>
  36689. <dt><dfn id=md-vcard-bday><code>bday</code></dfn><dd>
  36690. <p>Gives the birth date of the person or organization.</p>
  36691. <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
  36692. string</a>.</p>
  36693. <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
  36694. 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>
  36695. <dt><dfn id=md-vcard-anniversary><code>anniversary</code></dfn><dd>
  36696. <p>Gives the birth date of the person or organization.</p>
  36697. <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
  36698. string</a>.</p>
  36699. <p>A single property with the name <code id=vcard:md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> may be
  36700. 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>
  36701. <dt><dfn id=md-vcard-sex><code>sex</code></dfn><dd>
  36702. <p>Gives the biological sex of the person.</p>
  36703. <p>The <a href=#concept-property-value id=vcard:concept-property-value-18>value</a> must be one of
  36704. <code>F</code>, meaning "female",
  36705. <code>M</code>, meaning "male",
  36706. <code>N</code>, meaning "none or not applicable",
  36707. <code>O</code>, meaning "other", or
  36708. <code>U</code>, meaning "unknown".</p>
  36709. <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
  36710. 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>
  36711. <dt><dfn id=md-vcard-gender-identity><code>gender-identity</code></dfn><dd>
  36712. <p>Gives the gender identity of the person.</p>
  36713. <p>The <a href=#concept-property-value id=vcard:concept-property-value-19>value</a> must be text.</p>
  36714. <p>A single property with the name <code id=vcard:md-vcard-gender-identity><a href=#md-vcard-gender-identity>gender-identity</a></code>
  36715. 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>
  36716. <dt><dfn id=md-vcard-adr><code>adr</code></dfn><dd>
  36717. <p>Gives the delivery address of the person or organization.</p>
  36718. <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>,
  36719. <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>
  36720. <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
  36721. 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
  36722. implied.</p>
  36723. <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
  36724. 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>
  36725. <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>
  36726. <p>Gives the type of delivery address.</p>
  36727. <p>The <a href=#concept-property-value id=vcard:concept-property-value-22>value</a> must be text that, when compared in a
  36728. <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
  36729. strings</a>.</p>
  36730. <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
  36731. 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
  36732. 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
  36733. be one <code id=vcard:md-vcard-adr-type-4><a href=#md-vcard-adr-type>type</a></code> property per distinct value.</p>
  36734. <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>
  36735. <p>Gives the post office box component of the delivery address of the person or
  36736. organization.</p>
  36737. <p>The <a href=#concept-property-value id=vcard:concept-property-value-24>value</a> must be text.</p>
  36738. <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
  36739. 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>
  36740. <p class=note>The vCard specification urges authors not to use this field.</p>
  36741. <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>
  36742. <p>Gives an additional component of the delivery address of the person or organization.</p>
  36743. <p>The <a href=#concept-property-value id=vcard:concept-property-value-26>value</a> must be text.</p>
  36744. <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
  36745. 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>
  36746. <p class=note>The vCard specification urges authors not to use this field.</p>
  36747. <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>
  36748. <p>Gives the street address component of the delivery address of the person or organization.</p>
  36749. <p>The <a href=#concept-property-value id=vcard:concept-property-value-28>value</a> must be text.</p>
  36750. <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
  36751. 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>
  36752. <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>
  36753. <p>Gives the locality component (e.g. city) of the delivery address of the person or
  36754. organization.</p>
  36755. <p>The <a href=#concept-property-value id=vcard:concept-property-value-30>value</a> must be text.</p>
  36756. <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
  36757. 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
  36758. 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>
  36759. <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>
  36760. <p>Gives the region component (e.g. state or province) of the delivery address of the person or
  36761. organization.</p>
  36762. <p>The <a href=#concept-property-value id=vcard:concept-property-value-32>value</a> must be text.</p>
  36763. <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
  36764. 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
  36765. 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>
  36766. <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>
  36767. <p>Gives the postal code component of the delivery address of the person or organization.</p>
  36768. <p>The <a href=#concept-property-value id=vcard:concept-property-value-34>value</a> must be text.</p>
  36769. <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
  36770. 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
  36771. 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>
  36772. <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>
  36773. <p>Gives the country name component of the delivery address of the person or organization.</p>
  36774. <p>The <a href=#concept-property-value id=vcard:concept-property-value-36>value</a> must be text.</p>
  36775. <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>
  36776. 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
  36777. 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>
  36778. <dt><dfn id=md-vcard-tel><code>tel</code></dfn><dd>
  36779. <p>Gives the telephone number of the person or organization.</p>
  36780. <p>The <a href=#concept-property-value id=vcard:concept-property-value-38>value</a> must be either text that can be
  36781. interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121, or an
  36782. <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>
  36783. <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
  36784. 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>
  36785. property is text, then the <a href=#telephone-type-strings id=vcard:telephone-type-strings>telephone type string</a>
  36786. <code id=vcard:md-vcard-type-tel-voice><a href=#md-vcard-type-tel-voice>voice</a></code> is implied.</p>
  36787. <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
  36788. 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>
  36789. <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>
  36790. <p>Gives the type of telephone number.</p>
  36791. <p>The <a href=#concept-property-value id=vcard:concept-property-value-41>value</a> must be text that, when compared in a
  36792. <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
  36793. strings</a>.</p>
  36794. <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
  36795. 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
  36796. 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
  36797. be one <code id=vcard:md-vcard-tel-type-4><a href=#md-vcard-tel-type>type</a></code> property per distinct value.</p>
  36798. <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>
  36799. <p>Gives the actual telephone number of the person or organization.</p>
  36800. <p>The <a href=#concept-property-value id=vcard:concept-property-value-43>value</a> must be text that can be interpreted as
  36801. 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>
  36802. <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
  36803. 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
  36804. 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>
  36805. <dt><dfn id=md-vcard-email><code>email</code></dfn><dd>
  36806. <p>Gives the e-mail address of the person or organization.</p>
  36807. <p>The <a href=#concept-property-value id=vcard:concept-property-value-45>value</a> must be text.</p>
  36808. <p>Any number of properties with the name <code id=vcard:md-vcard-email><a href=#md-vcard-email>email</a></code> may be
  36809. 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>
  36810. <dt><dfn id=md-vcard-impp><code>impp</code></dfn><dd>
  36811. <p>Gives a <a href=#url id=vcard:url>URL</a> for instant messaging and presence protocol communications with the
  36812. person or organization.</p>
  36813. <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
  36814. URL</a>.</p>
  36815. <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
  36816. 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>
  36817. <dt><dfn id=md-vcard-lang><code>lang</code></dfn><dd>
  36818. <p>Gives a language understood by the person or organization.</p>
  36819. <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>
  36820. <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
  36821. 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>
  36822. <dt><dfn id=md-vcard-tz><code>tz</code></dfn><dd>
  36823. <p>Gives the time zone of the person or organization.</p>
  36824. <p>The <a href=#concept-property-value id=vcard:concept-property-value-48>value</a> must be text and must match the
  36825. following syntax:</p>
  36826. <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
  36827. 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
  36828. represents a number in the range 00..59.</ol>
  36829. <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
  36830. 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>
  36831. <dt><dfn id=md-vcard-geo><code>geo</code></dfn><dd>
  36832. <p>Gives the geographical position of the person or organization.</p>
  36833. <p>The <a href=#concept-property-value id=vcard:concept-property-value-49>value</a> must be text and must match the
  36834. following syntax:</p>
  36835. <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
  36836. (-).<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
  36837. digits</a>.<li>A U+003B SEMICOLON character (;).<li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
  36838. (-).<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
  36839. digits</a>.</ol>
  36840. <p>The optional components marked with an asterisk (*) should be included, and should have six
  36841. digits each.</p>
  36842. <p class=note>The value specifies latitude and longitude, in that order (i.e., "LAT LON"
  36843. ordering), in decimal degrees. The longitude represents the location east and west of the prime
  36844. meridian as a positive or negative real number, respectively. The latitude represents the
  36845. location north and south of the equator as a positive or negative real number, respectively.</p>
  36846. <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
  36847. 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>
  36848. <dt><dfn id=md-vcard-title><code>title</code></dfn><dd>
  36849. <p>Gives the job title, functional position or function of the person or organization.</p>
  36850. <p>The <a href=#concept-property-value id=vcard:concept-property-value-50>value</a> must be text.</p>
  36851. <p>Any number of properties with the name <code id=vcard:md-vcard-title><a href=#md-vcard-title>title</a></code> may be
  36852. 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>
  36853. <dt><dfn id=md-vcard-role><code>role</code></dfn><dd>
  36854. <p>Gives the role, occupation, or business category of the person or organization.</p>
  36855. <p>The <a href=#concept-property-value id=vcard:concept-property-value-51>value</a> must be text.</p>
  36856. <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
  36857. 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>
  36858. <dt><dfn id=md-vcard-logo><code>logo</code></dfn><dd>
  36859. <p>Gives the logo of the person or organization.</p>
  36860. <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
  36861. URL</a>.</p>
  36862. <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
  36863. 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>
  36864. <dt><dfn id=md-vcard-agent><code>agent</code></dfn><dd>
  36865. <p>Gives the contact information of another person who will act on behalf of the person or
  36866. organization.</p>
  36867. <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>,
  36868. or text.</p>
  36869. <p>Any number of properties with the name <code id=vcard:md-vcard-agent><a href=#md-vcard-agent>agent</a></code> may be
  36870. 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>
  36871. <dt><dfn id=md-vcard-org><code>org</code></dfn><dd>
  36872. <p>Gives the name and units of the organization.</p>
  36873. <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>
  36874. <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
  36875. 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>
  36876. <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>
  36877. <p>Gives the name of the organization.</p>
  36878. <p>The <a href=#concept-property-value id=vcard:concept-property-value-55>value</a> must be text.</p>
  36879. <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
  36880. 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>
  36881. <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>
  36882. <p>Gives the name of the organization unit.</p>
  36883. <p>The <a href=#concept-property-value id=vcard:concept-property-value-57>value</a> must be text.</p>
  36884. <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>
  36885. 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>
  36886. <dt><dfn id=md-vcard-member><code>member</code></dfn><dd>
  36887. <p>Gives a <a href=#url id=vcard:url-2>URL</a> that represents a member of the group.</p>
  36888. <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
  36889. URL</a>.</p>
  36890. <p>Any number of properties with the name <code id=vcard:md-vcard-member><a href=#md-vcard-member>member</a></code> may be
  36891. 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>
  36892. <dt><dfn id=md-vcard-related><code>related</code></dfn><dd>
  36893. <p>Gives a relationship to another entity.</p>
  36894. <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>
  36895. property and one <code id=vcard:md-vcard-related-rel><a href=#md-vcard-related-rel>rel</a></code> properties.</p>
  36896. <p>Any number of properties with the name <code id=vcard:md-vcard-related><a href=#md-vcard-related>orrelated</a></code> may be
  36897. 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>
  36898. <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>
  36899. <p>Gives the <a href=#url id=vcard:url-3>URL</a> for the related entity.</p>
  36900. <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
  36901. URL</a>.</p>
  36902. <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
  36903. 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>
  36904. 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>
  36905. <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>
  36906. <p>Gives the relationship between the entity and the related entity.</p>
  36907. <p>The <a href=#concept-property-value id=vcard:concept-property-value-63>value</a> must be text that, when compared in a
  36908. <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
  36909. strings</a>.</p>
  36910. <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
  36911. 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>
  36912. 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>
  36913. <dt><dfn id=md-vcard-categories><code>categories</code></dfn><dd>
  36914. <p>Gives the name of a category or tag that the person or organization could be classified
  36915. as.</p>
  36916. <p>The <a href=#concept-property-value id=vcard:concept-property-value-65>value</a> must be text.</p>
  36917. <p>Any number of properties with the name <code id=vcard:md-vcard-categories><a href=#md-vcard-categories>categories</a></code>
  36918. 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>
  36919. <dt><dfn id=md-vcard-note><code>note</code></dfn><dd>
  36920. <p>Gives supplemental information or a comment about the person or organization.</p>
  36921. <p>The <a href=#concept-property-value id=vcard:concept-property-value-66>value</a> must be text.</p>
  36922. <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
  36923. 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>
  36924. <dt><dfn id=md-vcard-rev><code>rev</code></dfn><dd>
  36925. <p>Gives the revision date and time of the contact information.</p>
  36926. <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
  36927. global date and time string</a>.</p>
  36928. <p class=note>The value distinguishes the current revision of the information for other
  36929. renditions of the information.</p>
  36930. <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
  36931. 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>
  36932. <dt><dfn id=md-vcard-sound><code>sound</code></dfn><dd>
  36933. <p>Gives a sound file relating to the person or organization.</p>
  36934. <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
  36935. URL</a>.</p>
  36936. <p>Any number of properties with the name <code id=vcard:md-vcard-sound><a href=#md-vcard-sound>sound</a></code> may be
  36937. 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>
  36938. <dt><dfn id=md-vcard-uid><code>uid</code></dfn><dd>
  36939. <p>Gives a globally unique identifier corresponding to the person or organization.</p>
  36940. <p>The <a href=#concept-property-value id=vcard:concept-property-value-69>value</a> must be text.</p>
  36941. <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
  36942. 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>
  36943. <dt><dfn id=md-vcard-url><code>url</code></dfn><dd>
  36944. <p>Gives a <a href=#url id=vcard:url-4>URL</a> relating to the person or organization.</p>
  36945. <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
  36946. URL</a>.</p>
  36947. <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
  36948. 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>
  36949. </dl>
  36950. <p>The <dfn id=kind-strings>kind strings</dfn> are:</p>
  36951. <dl><dt><dfn id=md-vcard-kind-individual><code>individual</code></dfn><dd>
  36952. <p>Indicates a single entity (e.g. a person).</p>
  36953. <dt><dfn id=md-vcard-kind-group><code>group</code></dfn><dd>
  36954. <p>Indicates multiple entities (e.g. a mailing list).</p>
  36955. <dt><dfn id=md-vcard-kind-org><code>org</code></dfn><dd>
  36956. <p>Indicates a single entity that is not a person (e.g. a company).</p>
  36957. <dt><dfn id=md-vcard-kind-location><code>location</code></dfn><dd>
  36958. <p>Indicates a geographical place (e.g. an office building).</p>
  36959. </dl>
  36960. <p>The <dfn id=address-type-strings>address type strings</dfn> are:</p>
  36961. <dl><dt><dfn id=md-vcard-type-adr-home><code>home</code></dfn><dd>
  36962. <p>Indicates a delivery address for a residence.</p>
  36963. <dt><dfn id=md-vcard-type-adr-work><code>work</code></dfn><dd>
  36964. <p>Indicates a delivery address for a place of work.</p>
  36965. </dl>
  36966. <p>The <dfn id=telephone-type-strings>telephone type strings</dfn> are:</p>
  36967. <dl><dt><dfn id=md-vcard-type-tel-home><code>home</code></dfn><dd>
  36968. <p>Indicates a residential number.</p>
  36969. <dt><dfn id=md-vcard-type-tel-work><code>work</code></dfn><dd>
  36970. <p>Indicates a telephone number for a place of work.</p>
  36971. <dt><dfn id=md-vcard-type-tel-text><code>text</code></dfn><dd>
  36972. <p>Indicates that the telephone number supports text messages (SMS).</p>
  36973. <dt><dfn id=md-vcard-type-tel-voice><code>voice</code></dfn><dd>
  36974. <p>Indicates a voice telephone number.</p>
  36975. <dt><dfn id=md-vcard-type-tel-fax><code>fax</code></dfn><dd>
  36976. <p>Indicates a facsimile telephone number.</p>
  36977. <dt><dfn id=md-vcard-type-tel-cell><code>cell</code></dfn><dd>
  36978. <p>Indicates a cellular telephone number.</p>
  36979. <dt><dfn id=md-vcard-type-tel-video><code>video</code></dfn><dd>
  36980. <p>Indicates a video conferencing telephone number.</p>
  36981. <dt><dfn id=md-vcard-type-tel-pager><code>pager</code></dfn><dd>
  36982. <p>Indicates a paging device telephone number.</p>
  36983. <dt><dfn id=md-vcard-type-tel-textphone><code>textphone</code></dfn><dd>
  36984. <p>Indicates a telecommunication device for people with hearing or speech difficulties.</p>
  36985. </dl>
  36986. <p>The <dfn id=relationship-strings>relationship strings</dfn> are:</p>
  36987. <dl><dt><dfn id=md-vcard-rel-emergency><code>emergency</code></dfn><dd>
  36988. <p>An emergency contact.</p>
  36989. <dt><dfn id=md-vcard-rel-agent><code>agent</code></dfn><dd>
  36990. <p>Another entity that acts on behalf of this entity.</p>
  36991. <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>
  36992. <p>Has the meaning defined in XFN. <a href=#refsXFN>[XFN]</a></p>
  36993. </dl>
  36994. <h5 id=conversion-to-vcard>5.4.1.1 Conversion to vCard</h5>
  36995. <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
  36996. run the following algorithm to <dfn id=extracting-a-vcard>extract any vCard data represented
  36997. by those nodes</dfn> (only the first vCard is returned):</p>
  36998. <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
  36999. algorithm, returning nothing.<li><p>Let <var>node</var> be the first node in <var>nodes</var> that is an
  37000. <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
  37001. "<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
  37002. "<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
  37003. "<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
  37004. 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
  37005. 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>
  37006. 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
  37007. 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>
  37008. 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>
  37009. <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
  37010. following substeps:</p>
  37011. <ol><li><p>Let <var>parameters</var> be an empty set of name-value pairs.<li>
  37012. <p>Run the appropriate set of substeps from the following list. The steps will set a variable
  37013. <var>value</var>, which is used in the next step.</p>
  37014. <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
  37015. <code id=conversion-to-vcard:md-vcard-n><a href=#md-vcard-n>n</a></code><dd>
  37016. <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
  37017. 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>
  37018. <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
  37019. 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>
  37020. <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
  37021. 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
  37022. <var>subitem</var>.</p>
  37023. <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
  37024. subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>
  37025. in <var>subitem</var>.</p>
  37026. <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
  37027. subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
  37028. in <var>subitem</var>.</p>
  37029. </ol>
  37030. <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
  37031. <code id=conversion-to-vcard:md-vcard-adr><a href=#md-vcard-adr>adr</a></code><dd>
  37032. <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
  37033. 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>
  37034. <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
  37035. 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>
  37036. <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
  37037. subproperties</a> named <code id=conversion-to-vcard:md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code>
  37038. in <var>subitem</var>.</p>
  37039. <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
  37040. 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>
  37041. <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
  37042. 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>
  37043. <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
  37044. 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>
  37045. <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
  37046. 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
  37047. <var>subitem</var>.</p>
  37048. <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
  37049. characters</a>, then add a parameter named "<code>TYPE</code>" whose value is
  37050. the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-4>value</a> of that property to <var>parameters</var>.</ol>
  37051. <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
  37052. <code id=conversion-to-vcard:md-vcard-org><a href=#md-vcard-org>org</a></code><dd>
  37053. <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
  37054. 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>
  37055. <li>
  37056. <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>
  37057. <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
  37058. <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
  37059. <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-7>value</a> of the property to <var>value</var>.</ol>
  37060. </ol>
  37061. <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>
  37062. and <var>name</var> is <code id=conversion-to-vcard:md-vcard-related><a href=#md-vcard-related>related</a></code><dd>
  37063. <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
  37064. <var>subitem</var>, and its element is a <a href=#url-property-elements id=conversion-to-vcard:url-property-elements>URL property
  37065. 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
  37066. by the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-9>value</a> of the first such property to
  37067. <var>value</var>, and add a parameter with the name "<code>VALUE</code>" and the
  37068. 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
  37069. <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
  37070. characters</a>, then add a parameter named "<code>RELATION</code>" whose value
  37071. is the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-11>value</a> of that property to
  37072. <var>parameters</var>.</ol>
  37073. <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>
  37074. <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
  37075. subproperty</a> named <code>value</code> in <var>subitem</var>.</p>
  37076. <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
  37077. characters</a>, then add a parameter named "<code>TYPE</code>" whose value is
  37078. the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-14>value</a> of that property to <var>parameters</var>.</ol>
  37079. <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>
  37080. <p>If this is the first such property to be found, set <var>sex</var> to the
  37081. property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-16>value</a>.</p>
  37082. <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>
  37083. <p>If this is the first such property to be found, set <var>gender-identity</var>
  37084. to the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-18>value</a>.</p>
  37085. <dt>Otherwise (the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-19>value</a> is not an
  37086. <a href=#concept-item id=conversion-to-vcard:concept-item-14>item</a>)<dd>
  37087. <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
  37088. 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
  37089. <code id=conversion-to-vcard:md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> and the <var>value</var> is
  37090. 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
  37091. 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
  37092. 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
  37093. another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C
  37094. 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
  37095. every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C REVERSE
  37096. 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
  37097. SMALL LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF)
  37098. character in <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed
  37099. by a U+006E LATIN SMALL LETTER N character (n).</ol>
  37100. </dl>
  37101. <li>
  37102. <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>
  37103. </ol>
  37104. <li><p>If either <var>sex</var> or <var>gender-identity</var> has a value that
  37105. 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>,
  37106. 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
  37107. "<code>VCARD</code>" to <var>output</var>.</ol>
  37108. <p>When the above algorithm says that the user agent is to <dfn id=add-a-vcard-line>add a vCard line</dfn> consisting
  37109. 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>
  37110. <ol><li><p>Let <var>line</var> be an empty string.
  37111. <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>
  37112. <p>If there are any parameters, then for each parameter, in the order that they were added, run
  37113. these substeps:</p>
  37114. <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>
  37115. <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>
  37116. <p>If and while <var>line</var> is longer than <var>maximum length</var>
  37117. Unicode code points long, run the following substeps:</p>
  37118. <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>
  37119. <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>
  37120. <p>When the steps above require the user agent to obtain the result of <dfn id=collecting-vcard-subproperties>collecting vCard
  37121. subproperties</dfn> named <var>subname</var> in <var>subitem</var>, the user
  37122. agent must run the following steps:</p>
  37123. <ol><li><p>Let <var>value</var> be the empty string.<li>
  37124. <p>For each property named <var>subname</var> in the item <var>subitem</var>,
  37125. run the following substeps:</p>
  37126. <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
  37127. <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
  37128. 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>
  37129. <li><p>Return <var>value</var>.</ol>
  37130. <p>When the steps above require the user agent to obtain the result of <dfn id=collecting-the-first-vcard-subproperty>collecting the first
  37131. vCard subproperty</dfn> named <var>subname</var> in <var>subitem</var>, the user
  37132. agent must run the following steps:</p>
  37133. <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>
  37134. <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
  37135. following steps:</p>
  37136. <ol><li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var>value</var> with
  37137. another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C REVERSE
  37138. SOLIDUS character (\).<li><p>Prefix every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C
  37139. 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
  37140. LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in
  37141. <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
  37142. SMALL LETTER N character (n).<li><p>Return the mutated <var>value</var>.</ol>
  37143. <p class=note>This algorithm can generate invalid vCard output, if the input does not conform to
  37144. the rules described for the <code id=conversion-to-vcard:md-vcard-4><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
  37145. <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
  37146. names</a>.</p>
  37147. <h5 id=examples-2>5.4.1.2 Examples</h5>
  37148. <p><i>This section is non-normative.</i></p>
  37149. <div class=example>
  37150. <p>Here is a long example vCard for a fictional character called "Jack Bauer":</p>
  37151. <pre>&lt;section id="jack" itemscope itemtype="http://microformats.org/profile/hcard">
  37152. &lt;h1 itemprop="fn">
  37153. &lt;span itemprop="n" itemscope>
  37154. &lt;span itemprop="given-name">Jack&lt;/span>
  37155. &lt;span itemprop="family-name">Bauer&lt;/span>
  37156. &lt;/span>
  37157. &lt;/h1>
  37158. &lt;img itemprop="photo" alt="" src="jack-bauer.jpg">
  37159. &lt;p itemprop="org" itemscope>
  37160. &lt;span itemprop="organization-name">Counter-Terrorist Unit&lt;/span>
  37161. (&lt;span itemprop="organization-unit">Los Angeles Division&lt;/span>)
  37162. &lt;/p>
  37163. &lt;p>
  37164. &lt;span itemprop="adr" itemscope>
  37165. &lt;span itemprop="street-address">10201 W. Pico Blvd.&lt;/span>&lt;br>
  37166. &lt;span itemprop="locality">Los Angeles&lt;/span>,
  37167. &lt;span itemprop="region">CA&lt;/span>
  37168. &lt;span itemprop="postal-code">90064&lt;/span>&lt;br>
  37169. &lt;span itemprop="country-name">United States&lt;/span>&lt;br>
  37170. &lt;/span>
  37171. &lt;span itemprop="geo">34.052339;-118.410623&lt;/span>
  37172. &lt;/p>
  37173. &lt;h2>Assorted Contact Methods&lt;/h2>
  37174. &lt;ul>
  37175. &lt;li itemprop="tel" itemscope>
  37176. &lt;span itemprop="value">+1 (310) 597 3781&lt;/span> &lt;span itemprop="type">work&lt;/span>
  37177. &lt;meta itemprop="type" content="voice">
  37178. &lt;/li>
  37179. &lt;li>&lt;a itemprop="url" href="http://en.wikipedia.org/wiki/Jack_Bauer">I'm on Wikipedia&lt;/a>
  37180. so you can leave a message on my user talk page.&lt;/li>
  37181. &lt;li>&lt;a itemprop="url" href="http://www.jackbauerfacts.com/">Jack Bauer Facts&lt;/a>&lt;/li>
  37182. &lt;li itemprop="email">&lt;a href="mailto:j.bauer@la.ctu.gov.invalid">j.bauer@la.ctu.gov.invalid&lt;/a>&lt;/li>
  37183. &lt;li itemprop="tel" itemscope>
  37184. &lt;span itemprop="value">+1 (310) 555 3781&lt;/span> &lt;span>
  37185. &lt;meta itemprop="type" content="cell">mobile phone&lt;/span>
  37186. &lt;/li>
  37187. &lt;/ul>
  37188. &lt;ins datetime="2008-07-20 21:00:00+01:00">
  37189. &lt;meta itemprop="rev" content="2008-07-20 21:00:00+01:00">
  37190. &lt;p itemprop="tel" itemscope>&lt;strong>Update!&lt;/strong>
  37191. My new &lt;span itemprop="type">home&lt;/span> phone number is
  37192. &lt;span itemprop="value">01632 960 123&lt;/span>.&lt;/p>
  37193. &lt;/ins>
  37194. &lt;/section></pre>
  37195. <p>The odd line wrapping is needed because newlines are meaningful in microdata: newlines would
  37196. be preserved in a conversion to, for example, the vCard format.</p>
  37197. </div>
  37198. <div class=example>
  37199. <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)
  37200. containing an address with two street components:</p>
  37201. <pre>&lt;address itemscope itemtype="http://microformats.org/profile/hcard">
  37202. &lt;strong itemprop="fn">&lt;span itemprop="n" itemscope>&lt;span itemprop="given-name">Alfred&lt;/span>
  37203. &lt;span itemprop="family-name">Person&lt;/span>&lt;/span>&lt;/strong> &lt;br>
  37204. &lt;span itemprop="adr" itemscope>
  37205. &lt;span itemprop="street-address">1600 Amphitheatre Parkway&lt;/span> &lt;br>
  37206. &lt;span itemprop="street-address">Building 43, Second Floor&lt;/span> &lt;br>
  37207. &lt;span itemprop="locality">Mountain View&lt;/span>,
  37208. &lt;span itemprop="region">CA&lt;/span> &lt;span itemprop="postal-code">94043&lt;/span>
  37209. &lt;/span>
  37210. &lt;/address></pre>
  37211. </div>
  37212. <div class=example>
  37213. <p>The vCard vocabulary can be used to just mark up people's names:</p>
  37214. <pre>&lt;span itemscope itemtype="http://microformats.org/profile/hcard"
  37215. >&lt;span itemprop=fn>&lt;span itemprop="n" itemscope>&lt;span itemprop="given-name"
  37216. >George&lt;/span> &lt;span itemprop="family-name">Washington&lt;/span>&lt;/span
  37217. >&lt;/span>&lt;/span></pre>
  37218. <p>This creates a single item with a two name-value pairs, one with the name "fn" and the value
  37219. "George Washington", and the other with the name "n" and a second item as its value, the second
  37220. item having the two name-value pairs "given-name" and "family-name" with the values "George" and
  37221. "Washington" respectively. This is defined to map to the following vCard:</p>
  37222. <pre>BEGIN:VCARD
  37223. PROFILE:VCARD
  37224. VERSION:4.0
  37225. SOURCE:<var>document's address</var>
  37226. FN:George Washington
  37227. N:Washington;George;;;
  37228. END:VCARD</pre>
  37229. </div>
  37230. <h4 id=vevent>5.4.2 vEvent</h4>
  37231. <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
  37232. an event.</p>
  37233. <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>
  37234. <p>The following are the type's <a href=#defined-property-name id=vevent:defined-property-name>defined property names</a>.
  37235. They are based on the vocabulary defined in the iCalendar specification, where more information on
  37236. how to interpret the values can be found. <a href=#refsRFC2445>[RFC2445]</a></p>
  37237. <p class=note>Only the parts of the iCalendar vocabulary relating to events are used here; this
  37238. vocabulary cannot express a complete iCalendar instance.</p>
  37239. <dl><dt><dfn id=md-vevent-attach><code>attach</code></dfn><dd>
  37240. <p>Gives the address of an associated document for the event.</p>
  37241. <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
  37242. URL</a>.</p>
  37243. <p>Any number of properties with the name <code id=vevent:md-vevent-attach><a href=#md-vevent-attach>attach</a></code> may be
  37244. 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>
  37245. <dt><dfn id=md-vevent-categories><code>categories</code></dfn><dd>
  37246. <p>Gives the name of a category or tag that the event could be classified as.</p>
  37247. <p>The <a href=#concept-property-value id=vevent:concept-property-value-2>value</a> must be text.</p>
  37248. <p>Any number of properties with the name <code id=vevent:md-vevent-categories><a href=#md-vevent-categories>categories</a></code>
  37249. 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>
  37250. <dt><dfn id=md-vevent-class><code>class</code></dfn><dd>
  37251. <p>Gives the access classification of the information regarding the event.</p>
  37252. <p>The <a href=#concept-property-value id=vevent:concept-property-value-3>value</a> must be text with one of the following
  37253. values:</p>
  37254. <ul class=brief><li><code>public</code><li><code>private</code><li><code>confidential</code></ul>
  37255. <p class=warning>This is merely advisory and cannot be considered a confidentiality
  37256. measure.</p>
  37257. <p>A single property with the name <code id=vevent:md-vevent-class><a href=#md-vevent-class>class</a></code> may be present
  37258. 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>
  37259. <dt><dfn id=md-vevent-comment><code>comment</code></dfn><dd>
  37260. <p>Gives a comment regarding the event.</p>
  37261. <p>The <a href=#concept-property-value id=vevent:concept-property-value-4>value</a> must be text.</p>
  37262. <p>Any number of properties with the name <code id=vevent:md-vevent-comment><a href=#md-vevent-comment>comment</a></code> may be
  37263. 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>
  37264. <dt><dfn id=md-vevent-description><code>description</code></dfn><dd>
  37265. <p>Gives a detailed description of the event.</p>
  37266. <p>The <a href=#concept-property-value id=vevent:concept-property-value-5>value</a> must be text.</p>
  37267. <p>A single property with the name <code id=vevent:md-vevent-description><a href=#md-vevent-description>description</a></code> may be
  37268. 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>
  37269. <dt><dfn id=md-vevent-geo><code>geo</code></dfn><dd>
  37270. <p>Gives the geographical position of the event.</p>
  37271. <p>The <a href=#concept-property-value id=vevent:concept-property-value-6>value</a> must be text and must match the
  37272. following syntax:</p>
  37273. <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
  37274. (-).<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
  37275. digits</a>.<li>A U+003B SEMICOLON character (;).<li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
  37276. (-).<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
  37277. digits</a>.</ol>
  37278. <p>The optional components marked with an asterisk (*) should be included, and should have six
  37279. digits each.</p>
  37280. <p class=note>The value specifies latitude and longitude, in that order (i.e., "LAT LON"
  37281. ordering), in decimal degrees. The longitude represents the location east and west of the prime
  37282. meridian as a positive or negative real number, respectively. The latitude represents the
  37283. location north and south of the equator as a positive or negative real number, respectively.</p>
  37284. <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
  37285. 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>
  37286. <dt><dfn id=md-vevent-location><code>location</code></dfn><dd>
  37287. <p>Gives the location of the event.</p>
  37288. <p>The <a href=#concept-property-value id=vevent:concept-property-value-7>value</a> must be text.</p>
  37289. <p>A single property with the name <code id=vevent:md-vevent-location><a href=#md-vevent-location>location</a></code> may be
  37290. 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>
  37291. <dt><dfn id=md-vevent-resources><code>resources</code></dfn><dd>
  37292. <p>Gives a resource that will be needed for the event.</p>
  37293. <p>The <a href=#concept-property-value id=vevent:concept-property-value-8>value</a> must be text.</p>
  37294. <p>Any number of properties with the name <code id=vevent:md-vevent-resources><a href=#md-vevent-resources>resources</a></code> may
  37295. 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>
  37296. <dt><dfn id=md-vevent-status><code>status</code></dfn><dd>
  37297. <p>Gives the confirmation status of the event.</p>
  37298. <p>The <a href=#concept-property-value id=vevent:concept-property-value-9>value</a> must be text with one of the following
  37299. values:</p>
  37300. <ul class=brief><li><code>tentative</code><li><code>confirmed</code><li><code>cancelled</code></ul>
  37301. <p>A single property with the name <code id=vevent:md-vevent-status><a href=#md-vevent-status>status</a></code> may be present
  37302. 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>
  37303. <dt><dfn id=md-vevent-summary><code>summary</code></dfn><dd>
  37304. <p>Gives a short summary of the event.</p>
  37305. <p>The <a href=#concept-property-value id=vevent:concept-property-value-10>value</a> must be text.</p>
  37306. <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>
  37307. <p>A single property with the name <code id=vevent:md-vevent-summary><a href=#md-vevent-summary>summary</a></code> may be present
  37308. 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>
  37309. <dt><dfn id=md-vevent-dtend><code>dtend</code></dfn><dd>
  37310. <p>Gives the date and time by which the event ends.</p>
  37311. <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
  37312. <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
  37313. 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
  37314. string</a>, then the <a href=#concept-property-value id=vevent:concept-property-value-12>value</a> of the property with
  37315. 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
  37316. string</a> also. Otherwise, the <a href=#concept-property-value id=vevent:concept-property-value-13>value</a> of the
  37317. 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>
  37318. <p>In either case, the <a href=#concept-property-value id=vevent:concept-property-value-14>value</a> be later in time than
  37319. 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>
  37320. <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
  37321. inclusive. For day-long events, therefore, the <code id=vevent:md-vevent-dtend-4><a href=#md-vevent-dtend>dtend</a></code>
  37322. property's <a href=#concept-property-value id=vevent:concept-property-value-15>value</a> will be the day <em>after</em> the
  37323. end of the event.</p>
  37324. <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
  37325. 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
  37326. property with the name <code id=vevent:md-vevent-duration><a href=#md-vevent-duration>duration</a></code>.</p>
  37327. <dt><dfn id=md-vevent-dtstart><code>dtstart</code></dfn><dd>
  37328. <p>Gives the date and time at which the event starts.</p>
  37329. <p>The <a href=#concept-property-value id=vevent:concept-property-value-16>value</a> must be text that is either a
  37330. <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>
  37331. <p>Exactly one property with the name <code id=vevent:md-vevent-dtstart-3><a href=#md-vevent-dtstart>dtstart</a></code> must be
  37332. 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>
  37333. <dt><dfn id=md-vevent-duration><code>duration</code></dfn><dd>
  37334. <p>Gives the duration of the event.</p>
  37335. <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
  37336. vevent duration string</a>.</p>
  37337. <p>The duration represented is the sum of all the durations represented by integers in the
  37338. value.</p>
  37339. <p>A single property with the name <code id=vevent:md-vevent-duration-2><a href=#md-vevent-duration>duration</a></code> may be
  37340. 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
  37341. property with the name <code id=vevent:md-vevent-dtend-6><a href=#md-vevent-dtend>dtend</a></code>.</p>
  37342. <dt><dfn id=md-vevent-transp><code>transp</code></dfn><dd>
  37343. <p>Gives whether the event is to be considered as consuming time on a calendar, for the purpose
  37344. of free-busy time searches.</p>
  37345. <p>The <a href=#concept-property-value id=vevent:concept-property-value-18>value</a> must be text with one of the following
  37346. values:</p>
  37347. <ul class=brief><li><code>opaque</code><li><code>transparent</code></ul>
  37348. <p>A single property with the name <code id=vevent:md-vevent-transp><a href=#md-vevent-transp>transp</a></code> may be present
  37349. 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>
  37350. <dt><dfn id=md-vevent-contact><code>contact</code></dfn><dd>
  37351. <p>Gives the contact information for the event.</p>
  37352. <p>The <a href=#concept-property-value id=vevent:concept-property-value-19>value</a> must be text.</p>
  37353. <p>Any number of properties with the name <code id=vevent:md-vevent-contact><a href=#md-vevent-contact>contact</a></code> may be
  37354. 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>
  37355. <dt><dfn id=md-vevent-url><code>url</code></dfn><dd>
  37356. <p>Gives a <a href=#url id=vevent:url>URL</a> for the event.</p>
  37357. <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
  37358. URL</a>.</p>
  37359. <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
  37360. 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>
  37361. <dt><dfn id=md-vevent-uid><code>uid</code></dfn><dd>
  37362. <p>Gives a globally unique identifier corresponding to the event.</p>
  37363. <p>The <a href=#concept-property-value id=vevent:concept-property-value-21>value</a> must be text.</p>
  37364. <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
  37365. 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>
  37366. <dt><dfn id=md-vevent-exdate><code>exdate</code></dfn><dd>
  37367. <p>Gives a date and time at which the event does not occur despite the recurrence rules.</p>
  37368. <p>The <a href=#concept-property-value id=vevent:concept-property-value-22>value</a> must be text that is either a
  37369. <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>
  37370. <p>Any number of properties with the name <code id=vevent:md-vevent-exdate><a href=#md-vevent-exdate>exdate</a></code> may be
  37371. 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>
  37372. <dt><dfn id=md-vevent-exrule><code>exrule</code></dfn><dd>
  37373. <p>Gives a rule for finding dates and times at which the event does not occur despite the
  37374. recurrence rules.</p>
  37375. <p>The <a href=#concept-property-value id=vevent:concept-property-value-23>value</a> must be text that matches the RECUR
  37376. value type defined in the iCalendar specification. <a href=#refsRFC2445>[RFC2445]</a></p>
  37377. <p>Any number of properties with the name <code id=vevent:md-vevent-exrule><a href=#md-vevent-exrule>exrule</a></code> may be
  37378. 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>
  37379. <dt><dfn id=md-vevent-rdate><code>rdate</code></dfn><dd>
  37380. <p>Gives a date and time at which the event recurs.</p>
  37381. <p>The <a href=#concept-property-value id=vevent:concept-property-value-24>value</a> must be text that is one of the
  37382. following:
  37383. <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 (/)
  37384. 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
  37385. 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 (/)
  37386. followed by a <a href=#valid-vevent-duration-string id=vevent:valid-vevent-duration-string-2>valid vevent duration string</a>.</ul>
  37387. <p>Any number of properties with the name <code id=vevent:md-vevent-rdate><a href=#md-vevent-rdate>rdate</a></code> may be
  37388. 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>
  37389. <dt><dfn id=md-vevent-rrule><code>rrule</code></dfn><dd>
  37390. <p>Gives a rule for finding dates and times at which the event occurs.</p>
  37391. <p>The <a href=#concept-property-value id=vevent:concept-property-value-25>value</a> must be text that matches the RECUR
  37392. value type defined in the iCalendar specification. <a href=#refsRFC2445>[RFC2445]</a></p>
  37393. <p>Any number of properties with the name <code id=vevent:md-vevent-rrule><a href=#md-vevent-rrule>rrule</a></code> may be
  37394. 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>
  37395. <dt><dfn id=md-vevent-created><code>created</code></dfn><dd>
  37396. <p>Gives the date and time at which the event information was first created in a calendaring
  37397. system.</p>
  37398. <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
  37399. global date and time string</a>.</p>
  37400. <p>A single property with the name <code id=vevent:md-vevent-created><a href=#md-vevent-created>created</a></code> may be present
  37401. 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>
  37402. <dt><dfn id=md-vevent-last-modified><code>last-modified</code></dfn><dd>
  37403. <p>Gives the date and time at which the event information was last modified in a calendaring
  37404. system.</p>
  37405. <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
  37406. global date and time string</a>.</p>
  37407. <p>A single property with the name <code id=vevent:md-vevent-last-modified><a href=#md-vevent-last-modified>last-modified</a></code>
  37408. 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>
  37409. <dt><dfn id=md-vevent-sequence><code>sequence</code></dfn><dd>
  37410. <p>Gives a revision number for the event information.</p>
  37411. <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
  37412. non-negative integer</a>.</p>
  37413. <p>A single property with the name <code id=vevent:md-vevent-sequence><a href=#md-vevent-sequence>sequence</a></code> may be
  37414. 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>
  37415. </dl>
  37416. <p>A string is a <dfn id=valid-vevent-duration-string>valid vevent duration string</dfn> if it matches the following pattern:</p>
  37417. <ol><li>A U+0050 LATIN CAPITAL LETTER P character (P).<li>One of the following:
  37418. <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
  37419. 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:
  37420. <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
  37421. 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
  37422. the first and second of the following in that order, or the second and third of the following
  37423. in that order, or all three of the following in this order:
  37424. <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
  37425. 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
  37426. 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
  37427. character (S). The integer represents a duration of that number of seconds. </ol>
  37428. </ol>
  37429. </ul>
  37430. </ol>
  37431. <h5 id=conversion-to-icalendar>5.4.2.1 Conversion to iCalendar</h5>
  37432. <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
  37433. run the following algorithm to <dfn id=extracting-vevent-data>extract any vEvent data
  37434. represented by those nodes</dfn>:</p>
  37435. <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
  37436. 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
  37437. 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
  37438. 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
  37439. value "<code>2.0</code>" to <var>output</var>.<li>
  37440. <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
  37441. steps:</p>
  37442. <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
  37443. 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
  37444. value consisting of an iCalendar DATE-TIME string representing the current date and time, with
  37445. the annotation "<code>VALUE=DATE-TIME</code>", to <var>output</var>. <a href=#refsRFC2445>[RFC2445]</a><li>
  37446. <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
  37447. appropriate set of substeps from the following list:</p>
  37448. <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>
  37449. <p>Skip the property.</p>
  37450. <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>
  37451. <p>Let <var>value</var> be the result of stripping all U+002D HYPHEN-MINUS (-) and
  37452. U+003A COLON (:) characters from the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-2>value</a>.</p>
  37453. <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
  37454. 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>
  37455. and the value <var>value</var> to <var>output</var>, with the annotation
  37456. "<code>VALUE=DATE</code>".</p>
  37457. <p>Otherwise, if the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-4>value</a> is a
  37458. <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
  37459. the type <var>name</var> and the value <var>value</var> to <var>output</var>, with the annotation "<code>VALUE=DATE-TIME</code>".</p>
  37460. <p>Otherwise skip the property.</p>
  37461. <dt>Otherwise<dd>
  37462. <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
  37463. property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-5>value</a> to <var>output</var>.</p>
  37464. </dl>
  37465. <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
  37466. value "<code>VEVENT</code>" to <var>output</var>.</ol>
  37467. <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
  37468. "<code>VCALENDAR</code>" to <var>output</var>.</ol>
  37469. <p>When the above algorithm says that the user agent is to <dfn id=add-an-icalendar-line>add an iCalendar line</dfn>
  37470. consisting of a type <var>type</var>, a value <var>value</var>, and optionally
  37471. an annotation, to a string <var>output</var>, it must run the following steps:</p>
  37472. <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>
  37473. <p>If there is an annotation:</p>
  37474. <ol><li><p>Append a U+003B SEMICOLON character (;) to <var>line</var>.<li><p>Append the annotation to <var>line</var>.</ol>
  37475. <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
  37476. another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C REVERSE
  37477. SOLIDUS character (\).<li><p>Prefix every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C
  37478. 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
  37479. LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in
  37480. <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
  37481. 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>
  37482. <p>If and while <var>line</var> is longer than <var>maximum length</var>
  37483. Unicode code points long, run the following substeps:</p>
  37484. <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>
  37485. <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>
  37486. <p class=note>This algorithm can generate invalid iCalendar output, if the input does not
  37487. 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>
  37488. <h5 id=examples-3>5.4.2.2 Examples</h5>
  37489. <p><i>This section is non-normative.</i></p>
  37490. <div class=example>
  37491. <p>Here is an example of a page that uses the vEvent vocabulary to mark up an event:</p>
  37492. <pre>&lt;body itemscope itemtype="http://microformats.org/profile/hcalendar#vevent">
  37493. ...
  37494. &lt;h1 itemprop="summary">Bluesday Tuesday: Money Road&lt;/h1>
  37495. ...
  37496. &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th @ 7pm&lt;/time>
  37497. (until &lt;time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm&lt;/time>)
  37498. ...
  37499. &lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
  37500. rel="bookmark" itemprop="url">Link to this page&lt;/a>
  37501. ...
  37502. &lt;p>Location: &lt;span itemprop="location">The RoadHouse&lt;/span>&lt;/p>
  37503. ...
  37504. &lt;p>&lt;input type=button value="Add to Calendar"
  37505. onclick="location = getCalendar(this)">&lt;/p>
  37506. ...
  37507. &lt;meta itemprop="description" content="via livebrum.co.uk">
  37508. &lt;/body></pre>
  37509. <p>The "<code>getCalendar()</code>" method could look like
  37510. this:</p>
  37511. <pre>function getCalendar(node) {
  37512. // This function assumes the content is valid.
  37513. // 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>.
  37514. while (node &amp;&amp; (!node.itemScope || !node.itemType.contains('http://microformats.org/profile/hcalendar#vevent')))
  37515. node = node.parentNode;
  37516. if (!node) {
  37517. alert('No event data found.');
  37518. return;
  37519. }
  37520. var stamp = new Date();
  37521. var stampString = '' + stamp.getUTCFullYear() + (stamp.getUTCMonth() + 1) + stamp.getUTCDate() + 'T' +
  37522. stamp.getUTCHours() + stamp.getUTCMinutes() + stamp.getUTCSeconds() + 'Z';
  37523. var calendar = 'BEGIN:VCALENDAR\r\nPRODID:HTML\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nDTSTAMP:' + stampString + '\r\n';
  37524. for (var propIndex = 0; propIndex &lt; node.properties.length; propIndex += 1) {
  37525. var prop = node.properties[propIndex];
  37526. var value = prop.itemValue;
  37527. var parameters = '';
  37528. if (prop.localName == 'time') {
  37529. value = value.replace(/[:-]/g, '');
  37530. if (value.match(/T/))
  37531. parameters = ';VALUE=DATE';
  37532. else
  37533. parameters = ';VALUE=DATE-TIME';
  37534. } else {
  37535. value = value.replace(/\\/g, '\\n');
  37536. value = value.replace(/;/g, '\\;');
  37537. value = value.replace(/,/g, '\\,');
  37538. value = value.replace(/\n/g, '\\n');
  37539. }
  37540. for (var nameIndex = 0; nameIndex &lt; prop.itemProp.length; nameIndex += 1) {
  37541. var name = prop.itemProp[nameIndex];
  37542. if (!name.match(/:/) &amp;&amp; !name.match(/\./))
  37543. calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
  37544. }
  37545. }
  37546. calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
  37547. return 'data:text/calendar;component=vevent,' + encodeURI(calendar);
  37548. }</pre>
  37549. <p>The same page could offer some markup, such as the following,
  37550. for copy-and-pasting into blogs:</p>
  37551. <pre>&lt;div itemscope itemtype="http://microformats.org/profile/hcalendar#vevent">
  37552. &lt;p>I'm going to
  37553. &lt;strong itemprop="summary">Bluesday Tuesday: Money Road&lt;/strong>,
  37554. &lt;time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th at 7pm&lt;/time>
  37555. to &lt;time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm&lt;/time>,
  37556. at &lt;span itemprop="location">The RoadHouse&lt;/span>!&lt;/p>
  37557. &lt;p>&lt;a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
  37558. itemprop="url">See this event on livebrum.co.uk&lt;/a>.&lt;/p>
  37559. &lt;meta itemprop="description" content="via livebrum.co.uk">
  37560. &lt;/div></pre>
  37561. </div>
  37562. <h4 id=licensing-works>5.4.3 Licensing works</h4>
  37563. <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
  37564. image, a video, a song, etc). This type is primarily intended to allow authors to include
  37565. licensing information for works.</p>
  37566. <p>The following are the type's <a href=#defined-property-name id=licensing-works:defined-property-name>defined property
  37567. names</a>.</p>
  37568. <dl><dt><dfn id=md-work-work><code>work</code></dfn><dd>
  37569. <p>Identifies the work being described.</p>
  37570. <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
  37571. URL</a>.</p>
  37572. <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
  37573. 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>
  37574. <dt><dfn id=md-work-title><code>title</code></dfn><dd>
  37575. <p>Gives the name of the work.</p>
  37576. <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
  37577. 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>
  37578. <dt><dfn id=md-work-author><code>author</code></dfn><dd>
  37579. <p>Gives the name or contact information of one of the authors or creators of the work.</p>
  37580. <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>
  37581. <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
  37582. 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>
  37583. <dt><dfn id=md-work-license><code>license</code></dfn><dd>
  37584. <p>Identifies one of the licenses under which the work is available.</p>
  37585. <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
  37586. URL</a>.</p>
  37587. <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
  37588. 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>
  37589. </dl>
  37590. <h5 id=examples-4>5.4.3.1 Examples</h5>
  37591. <p><i>This section is non-normative.</i></p>
  37592. <div class=example>
  37593. <p>This example shows an embedded image entitled <cite>My Pond</cite>, licensed under the
  37594. Creative Commons Attribution-Share Alike 3.0 United States License and the MIT license
  37595. simultaneously.</p>
  37596. <pre>&lt;figure <strong>itemscope itemtype="http://n.whatwg.org/work"</strong>>
  37597. &lt;img <strong>itemprop="work"</strong> src="mypond.jpeg">
  37598. &lt;figcaption>
  37599. &lt;p>&lt;cite <strong>itemprop="title"</strong>>My Pond&lt;/cite>&lt;/p>
  37600. &lt;p>&lt;small>Licensed under the &lt;a <strong>itemprop="license"</strong>
  37601. href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative
  37602. Commons Attribution-Share Alike 3.0 United States License&lt;/a>
  37603. and the &lt;a <strong>itemprop="license"</strong>
  37604. href="http://www.opensource.org/licenses/mit-license.php">MIT
  37605. license&lt;/a>.&lt;/small>
  37606. &lt;/figcaption>
  37607. &lt;/figure></pre>
  37608. </div>
  37609. <h3 id=converting-html-to-other-formats>5.5 Converting HTML to other formats</h3>
  37610. <h4 id=json>5.5.1 JSON</h4>
  37611. <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
  37612. run the following algorithm to <dfn id=extracting-json>extract the microdata from those nodes
  37613. into a JSON form</dfn>:</p>
  37614. <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
  37615. <a href=#top-level-microdata-items id=json:top-level-microdata-items>top-level microdata item</a>, and if it is then
  37616. <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
  37617. value is the array <var>items</var>.<li><p>Return the result of serialising <var>result</var> to JSON in the shortest
  37618. possible way (meaning no whitespace between tokens, no unnecessary zero digits in numbers, and
  37619. only using Unicode escapes in strings for characters that do not have a dedicated escape
  37620. sequence), and with a lowercase "<code>e</code>" used, when appropriate, in the
  37621. representation of any numbers. <a href=#refsJSON>[JSON]</a></ol>
  37622. <p class=note>This algorithm returns an object with a single property that is an array, instead
  37623. of just returning an array, so that it is possible to extend the algorithm in the future if
  37624. necessary.</p>
  37625. <p>When the user agent is to <dfn id=get-the-object>get the object</dfn> for an item <var>item</var>,
  37626. optionally with a list of elements <var>memory</var>, it must run the following
  37627. substeps:</p>
  37628. <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
  37629. <a href=#item-types id=json:item-types-2>item types</a> of <var>item</var>, in the order they were specified on the
  37630. <code id=json:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute.</p>
  37631. <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
  37632. identifier</a> of <var>item</var>.<li><p>Let <var>properties</var> be an empty object.<li>
  37633. <p>For each element <var>element</var> that has one or more <a href=#property-names id=json:property-names>property names</a>
  37634. 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
  37635. <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>
  37636. <ol><li><p>Let <var>value</var> be the <a href=#concept-property-value id=json:concept-property-value>property
  37637. 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
  37638. 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>
  37639. <p>For each name <var>name</var> in <var>element</var>'s <a href=#property-names id=json:property-names-2>property
  37640. names</a>, run the following substeps:</p>
  37641. <ol><li><p>If there is no entry named <var>name</var> in <var>properties</var>,
  37642. then add an entry named <var>name</var> to <var>properties</var> whose
  37643. value is an empty array.<li><p>Append <var>value</var> to the entry named <var>name</var> in <var>properties</var>.</ol>
  37644. </ol>
  37645. <li><p>Add an entry to <var>result</var> called "<code>properties</code>" whose
  37646. value is the object <var>properties</var>.<li><p>Return <var>result</var>.</ol>
  37647. <div class=example>
  37648. <p>For example, take this markup:</p>
  37649. <pre>&lt;!DOCTYPE HTML>
  37650. &lt;title>My Blog&lt;/title>
  37651. &lt;article itemscope itemtype="http://schema.org/BlogPosting">
  37652. &lt;header>
  37653. &lt;h1 itemprop="headline">Progress report&lt;/h1>
  37654. &lt;p>&lt;time itemprop="datePublished" datetime="2013-08-29">today&lt;/time>&lt;/p>
  37655. &lt;link itemprop="url" href="?comments=0">
  37656. &lt;/header>
  37657. &lt;p>All in all, he's doing well with his swim lessons. The biggest thing was he had trouble
  37658. putting his head in, but we got it down.&lt;/p>
  37659. &lt;section>
  37660. &lt;h1>Comments&lt;/h1>
  37661. &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
  37662. &lt;link itemprop="url" href="#c1">
  37663. &lt;footer>
  37664. &lt;p>Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person">
  37665. &lt;span itemprop="name">Greg&lt;/span>
  37666. &lt;/span>&lt;/p>
  37667. &lt;p>&lt;time itemprop="commentTime" datetime="2013-08-29">15 minutes ago&lt;/time>&lt;/p>
  37668. &lt;/footer>
  37669. &lt;p>Ha!&lt;/p>
  37670. &lt;/article>
  37671. &lt;article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
  37672. &lt;link itemprop="url" href="#c2">
  37673. &lt;footer>
  37674. &lt;p>Posted by: &lt;span itemprop="creator" itemscope itemtype="http://schema.org/Person">
  37675. &lt;span itemprop="name">Charlotte&lt;/span>
  37676. &lt;/span>&lt;/p>
  37677. &lt;p>&lt;time itemprop="commentTime" datetime="2013-08-29">5 minutes ago&lt;/time>&lt;/p>
  37678. &lt;/footer>
  37679. &lt;p>When you say "we got it down"...&lt;/p>
  37680. &lt;/article>
  37681. &lt;/section>
  37682. &lt;/article></pre>
  37683. <p>It would be turned into the following JSON by the algorithm above (supposing that the page's
  37684. URL was <code>http://blog.example.com/progress-report</code>):</p>
  37685. <pre>{
  37686. "items": [
  37687. {
  37688. "type": [ "http://schema.org/BlogPosting" ],
  37689. "properties": {
  37690. "headline": [ "Progress report" ],
  37691. "datePublished": [ "2013-08-29" ],
  37692. "url": [ "http://blog.example.com/progress-report?comments=0" ],
  37693. "comment": [
  37694. {
  37695. "type": [ "http://schema.org/UserComments" ],
  37696. "properties": {
  37697. "url": [ "http://blog.example.com/progress-report#c1" ],
  37698. "creator": [
  37699. {
  37700. "type": [ "http://schema.org/Person" ],
  37701. "properties": {
  37702. "name": [ "Greg" ]
  37703. }
  37704. }
  37705. ],
  37706. "commentTime": [ "2013-08-29" ]
  37707. }
  37708. },
  37709. {
  37710. "type": [ "http://schema.org/UserComments" ],
  37711. "properties": {
  37712. "url": [ "http://blog.example.com/progress-report#c2" ],
  37713. "creator": [
  37714. {
  37715. "type": [ "http://schema.org/Person" ],
  37716. "properties": {
  37717. "name": [ "Charlotte" ]
  37718. }
  37719. }
  37720. ],
  37721. "commentTime": [ "2013-08-29" ]
  37722. }
  37723. }
  37724. ]
  37725. }
  37726. }
  37727. ]
  37728. }</pre>
  37729. </div>
  37730. <h2 id=editing>6 <dfn>User interaction</dfn></h2>
  37731. <h3 id=the-hidden-attribute>6.1 The <dfn><code>hidden</code></dfn> attribute</h3>
  37732. <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
  37733. 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
  37734. attribute</a>. When specified on an element, it indicates that the element is not yet, or is no
  37735. longer, directly relevant to the page's current state, or that it is being used to declare content
  37736. 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
  37737. indirectly through the style layer. For example, an HTML+CSS user agent could implement these
  37738. requirements <a href=#hiddenCSS>using the rules suggested in the Rendering
  37739. section</a>.</p>
  37740. <p class=note>Because this attribute is typically implemented using CSS, it's also possible to
  37741. override it using CSS. For instance, a rule that applies 'display: block' to all elements will
  37742. 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
  37743. have to take care when writing their style sheets to make sure that the attribute is still styled
  37744. as expected.</p>
  37745. <div class=example>
  37746. <p>In the following skeletal example, the attribute is used to hide the Web game's main screen
  37747. until the user logs in:</p>
  37748. <pre> &lt;h1>The Example Game&lt;/h1>
  37749. &lt;section id="login">
  37750. &lt;h2>Login&lt;/h2>
  37751. &lt;form>
  37752. ...
  37753. &lt;!-- calls login() once the user's credentials have been checked -->
  37754. &lt;/form>
  37755. &lt;script>
  37756. function login() {
  37757. // switch screens
  37758. document.getElementById('login').hidden = true;
  37759. document.getElementById('game').hidden = false;
  37760. }
  37761. &lt;/script>
  37762. &lt;/section>
  37763. &lt;section id="game" hidden>
  37764. ...
  37765. &lt;/section></pre>
  37766. </div>
  37767. <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
  37768. 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
  37769. is merely a kind of overflow presentation — one could equally well just show all the form
  37770. controls in one big page with a scrollbar. It is similarly incorrect to use this attribute to hide
  37771. 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,
  37772. screen readers.</p>
  37773. <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
  37774. <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
  37775. 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
  37776. <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
  37777. confusion.</p>
  37778. <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>
  37779. <div class=example>
  37780. <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>
  37781. 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.
  37782. If the content is not applicable or relevant, then there is no reason to link to it.</p>
  37783. <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
  37784. themselves <code id=the-hidden-attribute:the-hidden-attribute-14><a href=#the-hidden-attribute>hidden</a></code>. While hiding the descriptions implies that
  37785. they are not useful alone, they could be written in such a way that they are useful in the
  37786. specific context of being referenced from the images that they describe.</p>
  37787. <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>
  37788. attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control
  37789. 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>
  37790. </div>
  37791. <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
  37792. active, e.g. scripts and form controls in such sections still execute and submit respectively.
  37793. Only their presentation to the user changes.</p>
  37794. <p>The <dfn id=dom-hidden><code>hidden</code></dfn> IDL attribute must <a href=#reflect id=the-hidden-attribute:reflect>reflect</a>
  37795. the content attribute of the same name.</p>
  37796. <h3 id=inert-subtrees>6.2 Inert subtrees</h3>
  37797. <p>A node (in particular elements and text nodes) can be marked as <dfn id=inert>inert</dfn>. When a node
  37798. 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
  37799. targeting user interaction events, may ignore the node for the purposes of text search user
  37800. interfaces (commonly known as "find in page"), and may prevent the user from selecting text in
  37801. that node. User agents should allow the user to override the restrictions on search and text
  37802. selection, however.</p>
  37803. <p class=example>For example, consider a page that consists of just a single <a href=#inert id=inert-subtrees:inert-2>inert</a>
  37804. 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
  37805. 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,
  37806. 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
  37807. 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>
  37808. <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>
  37809. <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
  37810. <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
  37811. <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>
  37812. <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
  37813. elements excepted by this paragraph can additionally be marked <a href=#inert id=inert-subtrees:inert-7>inert</a> through other
  37814. means; being part of a modal dialog does not "protect" a node from being marked
  37815. <a href=#inert id=inert-subtrees:inert-8>inert</a>.)</p>
  37816. <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
  37817. 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
  37818. <code id=inert-subtrees:document-6><a href=#document>Document</a></code>.</p>
  37819. <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>
  37820. <h3 id=activation>6.3 Activation</h3>
  37821. <p>Certain elements in HTML have an <a href=#activation-behavior id=activation:activation-behavior>activation behavior</a>, which means that the user
  37822. can activate them. This triggers a sequence of events dependent on the activation mechanism, and
  37823. normally culminating in a <code id=activation:event-click><a href=#event-click>click</a></code> event, as
  37824. described below.</p>
  37825. <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
  37826. behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
  37827. user triggers an element with a defined <a href=#activation-behavior id=activation:activation-behavior-3>activation behavior</a> in a manner other than
  37828. 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
  37829. activation steps</a> on the element.</p>
  37830. <p>Each element has a <var>click in progress</var> flag, initially set to false.</p>
  37831. <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
  37832. agent must run the following steps:</p>
  37833. <ol><li><p>If the element's <var>click in progress</var> flag is set to true, then abort
  37834. 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
  37835. <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>
  37836. <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
  37837. activation steps</a> on the element.</p>
  37838. <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
  37839. steps</a> on the element instead.</p>
  37840. <li><p>Set the <var>click in progress</var> flag on the element to false.</ol>
  37841. <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
  37842. steps</a> instead of firing the click event. When a user
  37843. 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>
  37844. <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
  37845. <code>MouseEvent</code> rerouting steps</a>. If this changes <var>event</var>'s
  37846. 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
  37847. 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>
  37848. on it.<li>
  37849. <p><a href=#concept-event-dispatch id=activation:concept-event-dispatch>Dispatch</a> <var>event</var> (the
  37850. required <code id=activation:event-click-3><a href=#event-click>click</a></code> event) at <var>target</var>.</p>
  37851. <p>If there is an element <var>e</var> and the <code id=activation:event-click-4><a href=#event-click>click</a></code>
  37852. 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>
  37853. <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
  37854. canceled activation steps</a> on element <var>e</var>.</p>
  37855. <li><p>Set the <var>click in progress</var> flag on <var>target</var> to
  37856. false.</ol>
  37857. <p class=note>The algorithms above don't run for arbitrary synthetic events dispatched by author
  37858. 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
  37859. synthetic click activation steps</a> algorithm happen programmatically.</p>
  37860. <p class=note>Click-focusing behavior (e.g. the focusing of a text field when user clicks in
  37861. one) typically happens before the click, when the mouse button is first depressed, and is
  37862. therefore not discussed here.</p>
  37863. <p>Given an element <var>target</var>, the <dfn id=nearest-activatable-element>nearest activatable element</dfn> is the
  37864. element returned by the following algorithm:</p>
  37865. <ol><li><p>If <var>target</var> has a defined <a href=#activation-behavior id=activation:activation-behavior-4>activation behavior</a>, then return
  37866. <var>target</var> and abort these steps.<li><p>If <var>target</var> has a parent element, then set <var>target</var> to
  37867. 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>
  37868. <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
  37869. the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn> defined for that element, if any.</p>
  37870. <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
  37871. <dfn id=canceled-activation-steps>canceled activation steps</dfn> defined for that element, if any.</p>
  37872. <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
  37873. the <dfn id=activation-behavior>activation behavior</dfn> defined for that element, if any. Activation behaviors can
  37874. refer to the <code id=activation:event-click-5><a href=#event-click>click</a></code> event that was fired by the steps above
  37875. leading up to this point.</p>
  37876. <dl class=domintro><dt><var>element</var> . <code id=activation:dom-click-3><a href=#dom-click>click</a></code>()<dd>
  37877. <p>Acts as if the element was clicked.</p>
  37878. </dl>
  37879. <p>The <dfn id=dom-click><code>click()</code></dfn> method must run the following steps:</p>
  37880. <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>
  37881. <h3 id=focus>6.4 Focus</h3>
  37882. <h4 id=introduction-8>6.4.1 Introduction</h4>
  37883. <p><i>This section is non-normative.</i></p>
  37884. <p>An HTML user interface typically consists of multiple interactive widgets, such as form
  37885. controls, scrollable regions, links, dialog boxes, browser tabs, and so forth. These widgets form
  37886. a hierarchy, with some (e.g. browser tabs, dialog boxes) containing others (e.g. links, form
  37887. controls).</p>
  37888. <p>When interacting with an interface using a keyboard, key input is channeled from the system,
  37889. through the hierarchy of interactive widgets, to an active widget, which is said to be
  37890. <a href=#focused id=introduction-8:focused>focused</a>.</p>
  37891. <div class=example>
  37892. <p>Consider an HTML application running in a browser tab running in a graphical environment.
  37893. Suppose this application had a page with some text fields and links, and was currently showing a
  37894. modal dialog, which itself had a text field and a button.</p>
  37895. <p>The hierarchy of focusable widgets, in this scenario, would include the browser window, which
  37896. would have, amongst its children, the browser tab containing the HTML application. The tab itself
  37897. would have as its children the various links and text fields, as well as the dialog. The dialog
  37898. itself would have as its children the text field and the button.</p>
  37899. <p><img src=http://images.whatwg.org/focus-tree.png alt="">
  37900. <p>If the widget with <span>focus</span> in this example was the text field in the dialog box, then key
  37901. input would be channeled from the graphical system to ① the Web browser, then to ②
  37902. the tab, then to ③ the dialog, and finally to ④ the text field.</p>
  37903. </div>
  37904. <p>Keyboard <em>events</em> are always targetted at this <a href=#focused id=introduction-8:focused-2>focused</a> element.</p>
  37905. <h4 id=data-model>6.4.2 Data model</h4>
  37906. <p>The term <dfn id=focusable-area>focusable area</dfn> is used to refer to regions of the interface that can become
  37907. the target of keyboard input. Focusable areas can be elements, parts of elements, or other regions
  37908. managed by the user agent.</p>
  37909. <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
  37910. 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
  37911. 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
  37912. 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
  37913. to represent the <a href=#focusable-area id=data-model:focusable-area-5>focusable area</a>.</p>
  37914. <p>The following table describes what objects can be <a href=#focusable-area id=data-model:focusable-area-6>focusable
  37915. 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
  37916. anchors</a> for those elements. (The cells that span both columns are non-normative examples.)</p>
  37917. <table id=table-fa><thead><tr><th id=th-fa-area><a href=#focusable-area id=data-model:focusable-area-8>Focusable area</a>
  37918. <th id=th-fa-dom-rep><a href=#dom-anchor id=data-model:dom-anchor-4>DOM anchor</a>
  37919. <tr><th colspan=2 id=th-fa-examples>Examples
  37920. <tbody><tr><th headers=th-fa-area id=td-fa-1 class=data-header>
  37921. 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
  37922. 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>.
  37923. <td headers="td-fa-1 th-fa-dom-rep">
  37924. The element itself.
  37925. <tr><td colspan=2 headers="td-fa-1 th-fa-examples">
  37926. <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)">&lt;input
  37927. type=text></a></code>, sometimes <code id=data-model:the-a-element><a href=#the-a-element>&lt;a href=""></a></code> (depending on platform
  37928. conventions).
  37929. <tbody><tr><th headers=th-fa-area id=td-fa-2 class=data-header>
  37930. 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
  37931. <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>.
  37932. <td headers="td-fa-2 th-fa-dom-rep">
  37933. The <code id=data-model:the-img-element-2><a href=#the-img-element>img</a></code> element.
  37934. <tr><td colspan=2 headers="td-fa-2 th-fa-examples">
  37935. <div class=example>
  37936. <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
  37937. 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
  37938. <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>
  37939. <pre>&lt;map id=wallmap>&lt;area alt="Enter Door" coords="10,10,100,200" href="door.html">&lt;/map>
  37940. ...
  37941. &lt;img src="images/innerwall.jpeg" alt="There is a white wall here, with a door." usemap="#wallmap">
  37942. ...
  37943. &lt;img src="images/outerwall.jpeg" alt="There is a red wall here, with a door." usemap="#wallmap"></pre>
  37944. </div>
  37945. <tbody><tr><th headers=th-fa-area id=td-fa-3 class=data-header>
  37946. 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
  37947. <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>.
  37948. <td headers="td-fa-3 th-fa-dom-rep">
  37949. The element for which the <a href=#focusable-area id=data-model:focusable-area-9>focusable area</a> is a subwidget.
  37950. <tr><td colspan=2 headers="td-fa-3 th-fa-examples">
  37951. <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
  37952. 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
  37953. buttons in a spin-control version of <code id="data-model:number-state-(type=number)"><a href="#number-state-(type=number)">&lt;input
  37954. 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)">&lt;input type=range multiple></a></code>, the part of a
  37955. <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
  37956. keyboard input.</p>
  37957. <tbody><tr><th headers=th-fa-area id=td-fa-4 class=data-header>
  37958. 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>.
  37959. <td headers="td-fa-4 th-fa-dom-rep">
  37960. The element for which the box that the scrollable region scrolls was created.
  37961. <tr><td colspan=2 headers="td-fa-4 th-fa-examples">
  37962. <p class=example>The CSS 'overflow' property's 'scroll' value typically creates a scrollable
  37963. region.</p>
  37964. <tbody><tr><th headers=th-fa-area id=td-fa-5 class=data-header>
  37965. 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
  37966. <a href=#inert id=data-model:inert>inert</a>.
  37967. <td headers="td-fa-5 th-fa-dom-rep">
  37968. The <code id=data-model:document-2><a href=#document>Document</a></code> for which the viewport was created.
  37969. <tr><td colspan=2 headers="td-fa-5 th-fa-examples">
  37970. <p class=example>The contents of an <code id=data-model:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>.</p>
  37971. <tbody><tr><th headers=th-fa-area id=td-fa-6 class=data-header>
  37972. Any other element or part of an element, especially to aid with accessibility or to better
  37973. match platform conventions.
  37974. <td headers="td-fa-6 th-fa-dom-rep">
  37975. The element.
  37976. <tr><td colspan=2 headers="td-fa-6 th-fa-examples">
  37977. <p class=example>A user agent could make all list item bullets focusable, so that a user can
  37978. more easily navigate lists.</p>
  37979. <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
  37980. be accessed.</p>
  37981. </table>
  37982. <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
  37983. <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
  37984. 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
  37985. document</a>. Similarly, in sequential focus navigation a <a href=#browsing-context-container id=data-model:browsing-context-container-3>browsing context
  37986. container</a> essentially acts merely as a placeholder for its <a href=#nested-browsing-context id=data-model:nested-browsing-context-2>nested browsing
  37987. context</a>'s <a href=#active-document id=data-model:active-document-2>active document</a>.</p>
  37988. <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
  37989. an <dfn id=control-group-owner>owner</dfn>. <a href=#control-group-owner id=data-model:control-group-owner>Control group
  37990. owners</a> are <dfn id=control-group-owner-object>control group owner objects</dfn>. The
  37991. following are <a href=#control-group-owner-object id=data-model:control-group-owner-object>control group owner objects</a>:</p>
  37992. <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>
  37993. attribute specified and that are <a href=#being-rendered id=data-model:being-rendered-5>being rendered</a>.</ul>
  37994. <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
  37995. group might be empty).</p>
  37996. <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
  37997. 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
  37998. 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
  37999. <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>
  38000. <div class=example>
  38001. <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>
  38002. 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
  38003. 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
  38004. 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
  38005. <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
  38006. <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>
  38007. </div>
  38008. <p>An element is <dfn id=expressly-inert-control>expressly inert</dfn> if it is
  38009. <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
  38010. 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>
  38011. <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
  38012. <dfn id=focused-area-of-the-control-group>focused area of the control group</dfn>. Which control is so designated changes over time,
  38013. 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>
  38014. <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>
  38015. <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>
  38016. 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
  38017. owner object</a>) and is not <a href=#expressly-inert-dialog id=data-model:expressly-inert-dialog>expressly inert</a>
  38018. 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
  38019. 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>
  38020. <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
  38021. <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>
  38022. <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
  38023. 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
  38024. object</a> has no <a href=#dialog-group id=data-model:dialog-group-2>dialog group</a>.</p>
  38025. <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
  38026. 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,
  38027. based on algorithms in this specification.</p>
  38028. <hr>
  38029. <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>
  38030. 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
  38031. 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
  38032. <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,
  38033. depth-first traversal of the box tree. <a href=#refsCSS>[CSS]</a></p>
  38034. <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
  38035. order</a>.</p>
  38036. <hr>
  38037. <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
  38038. 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>
  38039. <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
  38040. browsing context</a>.<li>
  38041. <p>If <var>candidate</var> has a <a href=#dialog-group id=data-model:dialog-group-5>dialog group</a> with a designated
  38042. <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
  38043. 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>
  38044. <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
  38045. 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
  38046. container</a>, then let <var>candidate</var> be the <a href=#active-document id=data-model:active-document-3>active document</a> of
  38047. 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
  38048. this step.</p>
  38049. <p>Otherwise, if <var>candidate</var> has a non-empty <a href=#control-group id=data-model:control-group-12>control group</a>, let
  38050. <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
  38051. group</a>.</p>
  38052. <li><p>Return <var>candidate</var>.</ol>
  38053. <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
  38054. 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
  38055. <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>,
  38056. it is <dfn id=focused>focused</dfn>.</p>
  38057. <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
  38058. object</a> <var>subject</var> is the ordered list constructed as follows:</p>
  38059. <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>
  38060. <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
  38061. that <code id=data-model:the-area-element-6><a href=#the-area-element>area</a></code> element to <var>output</var>.</p>
  38062. <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
  38063. anchor</a> is an element that is not <var>current object</var> itself, append that
  38064. <a href=#dom-anchor id=data-model:dom-anchor-14>DOM anchor</a> element to <var>output</var>.</p>
  38065. <li>
  38066. <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>,
  38067. 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>
  38068. <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
  38069. 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>
  38070. <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
  38071. 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>,
  38072. and return to the step labeled <i>loop</i>.</p>
  38073. <li>
  38074. <p>Return <var>output</var>.</p>
  38075. <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
  38076. context</a>) continues up the focus hierarchy up to the <code id=data-model:document-9><a href=#document>Document</a></code> of the
  38077. <a href=#top-level-browsing-context id=data-model:top-level-browsing-context-2>top-level browsing context</a>.</p>
  38078. </ol>
  38079. <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>
  38080. <p>The <dfn id=attr-tabindex><code>tabindex</code></dfn> content attribute allows authors to
  38081. indicate that an element is supposed to be <a href=#focusable-area id=the-tabindex-attribute:focusable-area>focusable</a>, and
  38082. 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,
  38083. what is to be the relative order of the element for the purposes of sequential focus navigation.
  38084. The name "tab index" comes from the common use of the "tab" key to navigate through the focusable
  38085. elements. The term "tabbing" refers to moving forward through the focusable elements that can be
  38086. reached using sequential focus navigation.</p>
  38087. <p>When the attribute is omitted, the user agent applies defaults. (There is no way to make an
  38088. 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>
  38089. <p>The <code id=the-tabindex-attribute:attr-tabindex-2><a href=#attr-tabindex>tabindex</a></code> attribute, if specified, must have a value
  38090. that is a <a href=#valid-integer id=the-tabindex-attribute:valid-integer>valid integer</a>. Positive numbers specify the relative position of the
  38091. 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
  38092. navigation order</a>, and negative numbers indicate that the control is to be unreachable by
  38093. <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation-2>sequential focus navigation</a>.</p>
  38094. <p>Each element can have a <dfn id=specially-focusable>tabindex focus flag</dfn> set, as defined
  38095. below. This flag is a factor that contributes towards determining whether an element is a
  38096. <a href=#focusable-area id=the-tabindex-attribute:focusable-area-3>focusable area</a>, as described in the previous section.</p>
  38097. <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
  38098. 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
  38099. thereof, must be interpreted as follows:</p>
  38100. <dl><dt>If the attribute is omitted or parsing the value returns an error<dd>
  38101. <p>The user agent should follow platform conventions to determine if the element's
  38102. <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
  38103. 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
  38104. 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>
  38105. <p>Modulo platform conventions, it is suggested that for the following elements, the
  38106. <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-2>tabindex focus flag</a> be set:</p>
  38107. <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>
  38108. 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
  38109. 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
  38110. enable the user agent to allow the user to begin a drag operations for those elements without
  38111. 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>
  38112. elements</a></ul>
  38113. <p class=note>One valid reason to ignore the platform conventions and always allow an element
  38114. 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
  38115. mechanism for activating an element is through a keyboard action that triggers the focused
  38116. element.</p>
  38117. <dt id=negative-tabindex>If the value is a negative integer<dd>
  38118. <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
  38119. element from the <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-3>sequential focus navigation order</a>.</p>
  38120. <p class=note>One valid reason to ignore the requirement that sequential focus navigation not
  38121. allow the author to lead to the element would be if the user's only mechanism for moving the
  38122. focus is sequential focus navigation. For instance, a keyboard-only user would be unable to
  38123. 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
  38124. user's user agent would be well justified in allowing the user to tab to the control
  38125. regardless.</p>
  38126. <dt>If the value is a zero<dd>
  38127. <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
  38128. element and any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-5>focusable areas</a> that have the element as their
  38129. <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
  38130. 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
  38131. navigation order</a>.</p>
  38132. <dt>If the value is greater than zero<dd>
  38133. <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
  38134. element and any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-6>focusable areas</a> that have the element as their
  38135. <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
  38136. — 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>
  38137. order so that, relative to other <a href=#focusable-area id=the-tabindex-attribute:focusable-area-8>focusable areas</a> in the
  38138. <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-5>sequential focus navigation order</a>, they are:</p>
  38139. <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,
  38140. 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
  38141. 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
  38142. 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
  38143. 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
  38144. <code id=the-tabindex-attribute:attr-tabindex-14><a href=#attr-tabindex>tabindex</a></code> attribute on <var>candidate</var>.</ul>
  38145. </dl>
  38146. <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
  38147. <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
  38148. nothing.</p>
  38149. <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
  38150. "enter" key while the element is <a href=#focused id=the-tabindex-attribute:focused>focused</a>).</p>
  38151. <p>An element with the <code id=the-tabindex-attribute:attr-tabindex-16><a href=#attr-tabindex>tabindex</a></code> attribute specified is
  38152. <a href=#interactive-content-2 id=the-tabindex-attribute:interactive-content-2>interactive content</a>.</p>
  38153. <p>The <dfn id=dom-tabindex><code>tabIndex</code></dfn> IDL attribute must
  38154. <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
  38155. attribute. Its default value is 0 for elements that are focusable and −1 for elements that
  38156. are not focusable.</p>
  38157. <h4 id=processing-model-6>6.4.4 Processing model</h4>
  38158. <p>The <dfn id=focusing-steps>focusing steps</dfn> for an object <var>new focus target</var> that is
  38159. 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
  38160. <a href=#browsing-context id=processing-model-6:browsing-context>browsing context</a>, are as follows:</p>
  38161. <ol><li>
  38162. <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
  38163. <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
  38164. 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
  38165. area</a>, then run the first matching set of steps from the following list:</p>
  38166. <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
  38167. shapes that are <a href=#focusable-area id=processing-model-6:focusable-area-4>focusable areas</a><dd>
  38168. <p>Let <var>new focus target</var> be the shape corresponding to the first
  38169. <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>
  38170. element belongs.</p>
  38171. <dt>If <var>new focus target</var> is an element with one or more scrollable regions
  38172. that are <a href=#focusable-area id=processing-model-6:focusable-area-5>focusable areas</a><dd>
  38173. <p>Let <var>new focus target</var> be the element's first scrollable region,
  38174. according to a pre-order, depth-first traversal of the box tree. <a href=#refsCSS>[CSS]</a></p>
  38175. <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
  38176. <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
  38177. <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>
  38178. <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>
  38179. <dt>If <var>new focus target</var> is a <a href=#browsing-context id=processing-model-6:browsing-context-2>browsing context</a><dd>
  38180. <p>Let <var>new focus target</var> be the <a href=#browsing-context id=processing-model-6:browsing-context-3>browsing context</a>'s
  38181. <a href=#active-document id=processing-model-6:active-document>active document</a>.</p>
  38182. <dt>Otherwise<dd>
  38183. <p>Abort the <a href=#focusing-steps id=processing-model-6:focusing-steps>focusing steps</a>.</p>
  38184. </dl>
  38185. <li>
  38186. <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
  38187. 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>
  38188. 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
  38189. 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
  38190. group</a>, and redo this step.</p>
  38191. <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
  38192. 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,
  38193. 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
  38194. group</a>, and redo this step.</p>
  38195. <p>Otherwise, if <var>new focus target</var> is a <a href=#browsing-context-container id=processing-model-6:browsing-context-container>browsing context
  38196. 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
  38197. context</a>'s <a href=#active-document id=processing-model-6:active-document-2>active document</a>, and redo this step.</p>
  38198. <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
  38199. 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
  38200. rendered</a>.</p>
  38201. <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
  38202. 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
  38203. 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
  38204. top-level browsing context</a> in which <var>new focus target</var> finds
  38205. 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
  38206. 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>
  38207. <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>,
  38208. <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
  38209. user attempts to move the focus to <var>candidate</var>.</p>
  38210. <p>The <dfn id=unfocusing-steps>unfocusing steps</dfn> for an object <var>old focus target</var> that is
  38211. 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
  38212. follows:</p>
  38213. <ol><li><p>If <var>old focus target</var> is <a href=#inert id=processing-model-6:inert-2>inert</a>, then abort these
  38214. steps.<li>
  38215. <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
  38216. <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
  38217. target</var> is an element with one or more scrollable regions, and one of them is the
  38218. <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
  38219. 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>
  38220. <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
  38221. 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
  38222. chain</var>, then abort these steps.<li>
  38223. <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
  38224. 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
  38225. <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>
  38226. <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
  38227. 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>
  38228. (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
  38229. viewport).</p>
  38230. <p>Otherwise, let <var>new focus target</var> be null.</p>
  38231. <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
  38232. steps</a> for <var>new focus target</var>.</ol>
  38233. <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
  38234. unfocused without another element being explicitly focused in its stead, the user agent must
  38235. synchronously run the <a href=#unfocusing-steps id=processing-model-6:unfocusing-steps>unfocusing steps</a> for that object.</p>
  38236. <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
  38237. 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
  38238. 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,
  38239. 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
  38240. focused with the <a href=#focusing-steps id=processing-model-6:focusing-steps-4>focusing steps</a>.</p>
  38241. <hr>
  38242. <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
  38243. 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>
  38244. <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
  38245. <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
  38246. 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
  38247. <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
  38248. group</a>.</p>
  38249. <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
  38250. 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
  38251. 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
  38252. 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
  38253. <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
  38254. 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
  38255. <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
  38256. 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
  38257. 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
  38258. group</a>.</p>
  38259. <p class=example>For example, this might happen because an element is removed from its
  38260. <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
  38261. 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>
  38262. <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
  38263. 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
  38264. group</a> changes from being non-empty to being empty, the first non-<a href=#inert id=processing-model-6:inert-8>inert</a>
  38265. <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
  38266. 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
  38267. 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>
  38268. <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
  38269. 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
  38270. <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>):
  38271. 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
  38272. 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>
  38273. 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
  38274. 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
  38275. 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
  38276. <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
  38277. group</a> regardless of <a href=#inert id=processing-model-6:inert-12>inertness</a>.</p>
  38278. <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
  38279. 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
  38280. <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
  38281. starts being <a href=#inert id=processing-model-6:inert-13>inert</a>, the user agent must run the following steps:</p>
  38282. <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
  38283. context</a> was immediately before this algorithm became applicable (e.g. before the element
  38284. 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
  38285. 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
  38286. top-level browsing context</a>.<li><p>If <var>old focus target</var> and <var>new focus target</var> are the
  38287. 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
  38288. 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>
  38289. <hr>
  38290. <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
  38291. follows:</p>
  38292. <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>
  38293. and the last entry from <var>new chain</var> and redo this step.<li>
  38294. <p>For each entry <var>entry</var> in <var>old chain</var>, in order, run
  38295. these substeps:</p>
  38296. <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>
  38297. 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
  38298. 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
  38299. 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>
  38300. <li>
  38301. <p>If <var>entry</var> is an element, let <var>blur event target</var> be
  38302. <var>entry</var>.</p>
  38303. <p>If <var>entry</var> is a <code id=processing-model-6:document-7><a href=#document>Document</a></code> object, let <var>blur
  38304. 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>
  38305. <p>Otherwise, let <var>blur event target</var> be null.</p>
  38306. <li><p>If <var>entry</var> is the last entry in <var>old chain</var>, and
  38307. <var>entry</var> is an <code id=processing-model-6:element><a href=#element>Element</a></code>, and the last entry in <var>new
  38308. 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>
  38309. be the last entry in <var>new chain</var>. Otherwise, let <var>related blur
  38310. target</var> be null.<li>
  38311. <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>
  38312. named <code id=processing-model-6:event-blur><a href=#event-blur>blur</a></code> at <var>blur event target</var>, with
  38313. <var>related blur target</var> as the related target.</p>
  38314. <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>
  38315. element's shape, a scrollable region, or a viewport, no event is fired.</p>
  38316. </ol>
  38317. <li><p>Apply any relevant platform-specific conventions for focusing <var>new focus
  38318. target</var>. (For example, some platforms select the contents of a text field when that field is
  38319. focused.)<li>
  38320. <p>For each entry <var>entry</var> in <var>new chain</var>, in reverse
  38321. order, run these substeps:</p>
  38322. <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>
  38323. <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
  38324. 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
  38325. 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>
  38326. <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>
  38327. 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
  38328. owner</a>.</p>
  38329. <li>
  38330. <p>If <var>entry</var> is an element, let <var>focus event target</var> be
  38331. <var>entry</var>.</p>
  38332. <p>If <var>entry</var> is a <code id=processing-model-6:document-9><a href=#document>Document</a></code> object, let <var>focus
  38333. 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>
  38334. <p>Otherwise, let <var>focus event target</var> be null.</p>
  38335. <li><p>If <var>entry</var> is the last entry in <var>new chain</var>, and
  38336. <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
  38337. 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>
  38338. be the last entry in <var>old chain</var>. Otherwise, let <var>related
  38339. focus target</var> be null.<li>
  38340. <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>
  38341. named <code id=processing-model-6:event-focus><a href=#event-focus>focus</a></code> at <var>focus event target</var>, with
  38342. <var>related focus target</var> as the related target.</p>
  38343. <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>
  38344. element's shape, a scrollable region, or a viewport, no event is fired.</p>
  38345. </ol>
  38346. </ol>
  38347. <p>When a user agent is required to <dfn id=fire-a-focus-event>fire a focus event</dfn> named <var>e</var> at
  38348. an element <var>t</var> and with a given related target <var>r</var>, the user
  38349. 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>
  38350. object, initialise it to have the given name <var>e</var>, to not bubble, to not be
  38351. cancelable, and to have the <code id=processing-model-6:dom-focusevent-relatedtarget><a href=#dom-focusevent-relatedtarget>relatedTarget</a></code>
  38352. 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
  38353. at the specified target element <var>t</var>.</p>
  38354. <hr>
  38355. <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
  38356. must run the following steps:</p>
  38357. <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
  38358. 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
  38359. 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
  38360. <var>target area</var>.<li>
  38361. <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
  38362. element</a> of that <code id=processing-model-6:document-13><a href=#document>Document</a></code>.</p>
  38363. <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
  38364. <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
  38365. element</a> of that <code id=processing-model-6:document-15><a href=#document>Document</a></code>.</p>
  38366. <li>
  38367. <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>
  38368. <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
  38369. 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>
  38370. 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
  38371. application, though.</p>
  38372. <li><p>If the event was not canceled, then let <var>target area</var> handle the key
  38373. event. This might include <a href=#run-synthetic-click-activation-steps id=processing-model-6:run-synthetic-click-activation-steps>running synthetic
  38374. click activation steps</a> for <var>target node</var>.</ol>
  38375. <h4 id=sequential-focus-navigation>6.4.5 <dfn>Sequential focus navigation</dfn></h4>
  38376. <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
  38377. 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>
  38378. 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
  38379. 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
  38380. 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
  38381. it is unreachable via <a href=#sequential-focus-navigation id=sequential-focus-navigation:sequential-focus-navigation>sequential focus navigation</a>.</p>
  38382. <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
  38383. 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
  38384. of pressing the <kbd>tab</kbd> key), or when the user requests that focus sequentially move to a
  38385. <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),
  38386. the user agent must use the following algorithm:</p>
  38387. <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
  38388. browsing context</a>, if the user requested to move focus sequentially from there, or else the
  38389. <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
  38390. outside the <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-3>top-level browsing context</a>.<li>
  38391. <p>Let <var>direction</var> be <i>forward</i> if the user requested the <em>next</em>
  38392. control, and <i>backward</i> if the user requested the previous control.</p>
  38393. <p class=note>Typically, pressing <kbd>tab</kbd> requests the next control, and pressing
  38394. <kbd><kbd>shift</kbd>+<kbd>tab</kbd></kbd> requests the previous control.</p>
  38395. <li>
  38396. <p><i>Loop</i>: Let <var>selection mechanism</var> be <i>sequential</i> if the <var>starting
  38397. 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
  38398. <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>
  38399. <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
  38400. <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
  38401. <i>DOM</i>.</p>
  38402. <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
  38403. algorithm</a> with <var>starting point</var>, <var>direction</var>, and <var>selection
  38404. 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
  38405. <var>candidate</var> and abort these steps.<li>
  38406. <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
  38407. <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
  38408. should transfer focus to its own controls appropriately (if any), honouring
  38409. <var>direction</var>, and then abort these steps.</p>
  38410. <p class=example>For example, if <var>direction</var> is <i>backward</i>, then the last
  38411. focusable control before the browser's rendering area would be the control to focus.</p>
  38412. <p>If the user agent has no focusable controls — a kiosk-mode browser, for instance
  38413. then the user agent may instead restart these steps with the <var>starting point</var> being the
  38414. <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-6>top-level browsing context</a> itself.</p>
  38415. <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
  38416. <a href=#nested-browsing-context id=sequential-focus-navigation:nested-browsing-context>nested browsing context</a>. Let <var>starting point</var> be that
  38417. <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
  38418. step labeled <i>loop</i>.</p>
  38419. </ol>
  38420. <p>The <dfn id=sequential-navigation-search-algorithm>sequential navigation search algorithm</dfn> consists of the following steps. This
  38421. algorithm takes three arguments: <var>starting point</var>, <var>direction</var>,
  38422. and <var>selection mechanism</var>.</p>
  38423. <ol><li>
  38424. <p>Pick the appropriate cell from the following table, and follow the instructions in that
  38425. cell.</p>
  38426. <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>
  38427. <table><thead><tr><th>
  38428. <th> <var>direction</var> is <i>forward</i>
  38429. <th> <var>direction</var> is <i>backward</i>
  38430. <tbody><tr><th><var>starting point</var> is a <a href=#browsing-context id=sequential-focus-navigation:browsing-context-2>browsing context</a>
  38431. <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
  38432. <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
  38433. <tr><th><var>selection mechanism</var> is <i>DOM</i>
  38434. <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
  38435. <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
  38436. <tr><th><var>selection mechanism</var> is <i>sequential</i>
  38437. <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
  38438. <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
  38439. </table>
  38440. <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
  38441. 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
  38442. focus navigation order</a>.</p>
  38443. <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
  38444. 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
  38445. control group</a> of <var>X</var>'s <a href=#dialog-group id=sequential-focus-navigation:dialog-group-3>dialog group</a>'s designated
  38446. <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>
  38447. <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>
  38448. <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
  38449. navigation order</a> to which <var>starting point</var> belongs.</p>
  38450. <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
  38451. 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
  38452. <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>
  38453. (when it's not, <var>selection mechanism</var> will be <i>DOM</i>).</p>
  38454. <li>
  38455. <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
  38456. 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
  38457. the first argument, <var>direction</var> as the second, and <i>sequential</i>
  38458. as the third.</p>
  38459. <p>If <var>new candidate</var> is null, then let <var>starting point</var>
  38460. be <var>candidate</var>, and return to the top of this algorithm. Otherwise, let <var>candidate</var> be <var>new candidate</var>.</p>
  38461. <li><p>Return <var>candidate</var>.</ol>
  38462. <h4 id=focus-management-apis>6.4.6 Focus management APIs</h4>
  38463. <dl class=domintro><dt><var>document</var> . <code id=focus-management-apis:dom-document-activeelement><a href=#dom-document-activeelement>activeElement</a></code><dd>
  38464. <p>Returns the deepest element in the document through which or to which key events are being
  38465. routed. This is, roughly speaking, the focused element in the document.</p>
  38466. <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
  38467. <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
  38468. <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
  38469. 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
  38470. <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>
  38471. <dt><var>document</var> . <code id=focus-management-apis:dom-document-hasfocus><a href=#dom-document-hasfocus>hasFocus</a></code>()<dd>
  38472. <p>Returns true if key events are being routed through or to the document; otherwise, returns
  38473. false. Roughly speaking, this corresponds to the document, or a documented nested inside this
  38474. one, being focused.</p>
  38475. <dt><var>window</var> . <code id=focus-management-apis:dom-window-focus><a href=#dom-window-focus>focus</a></code>()<dd>
  38476. <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>
  38477. <dt><var>element</var> . <code id=focus-management-apis:dom-focus><a href=#dom-focus>focus</a></code>()<dd>
  38478. <p>Moves the focus to the element.</p>
  38479. <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>
  38480. <dt><var>element</var> . <code id=focus-management-apis:dom-blur><a href=#dom-blur>blur</a></code>()<dd>
  38481. <p>Moves the focus to the viewport. Use of this method is discouraged; if you want to focus the
  38482. 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
  38483. element</a>.</p>
  38484. <p>Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead,
  38485. use a CSS rule to override the 'outline' property, and provide a different way to show what
  38486. element is focused. Be aware that if an alternative focusing style isn't made available, the
  38487. page will be significantly less usable for people who primarily navigate pages using a keyboard,
  38488. or those with reduced vision who use focus outlines to help them navigate the page.</p>
  38489. <div class=example>
  38490. <p>For example, to hide the outline from links and instead use a yellow background to indicate
  38491. focus, you could use:</p>
  38492. <pre>:link:focus, :visited:focus { outline: none; background: yellow; color: black; }</pre>
  38493. </div>
  38494. </dl>
  38495. <p>The <dfn id=dom-document-activeelement><code>activeElement</code></dfn> attribute on
  38496. <code id=focus-management-apis:document><a href=#document>Document</a></code> objects must return the value returned by the following steps:</p>
  38497. <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
  38498. 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
  38499. <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
  38500. 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
  38501. group</a>.</p>
  38502. <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>
  38503. <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
  38504. element</a> of that <code id=focus-management-apis:document-4><a href=#document>Document</a></code>.</p>
  38505. <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
  38506. 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
  38507. <code id=focus-management-apis:document-6><a href=#document>Document</a></code>.</p>
  38508. <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>
  38509. <li><p>Return <var>candidate</var>.</ol>
  38510. <p>The <dfn id=dom-document-hasfocus><code>hasFocus()</code></dfn> method on
  38511. <code id=focus-management-apis:document-8><a href=#document>Document</a></code> objects must return the value returned by the following steps:</p>
  38512. <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
  38513. 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
  38514. browsing context</a>.<li><p>If <var>candidate</var> is <var>target</var>, return true and abort
  38515. these steps.<li>
  38516. <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
  38517. dialog of the dialog group</a>, then let <var>candidate</var> be the designated
  38518. <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>
  38519. <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
  38520. 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
  38521. 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
  38522. container</a>'s <a href=#nested-browsing-context id=focus-management-apis:nested-browsing-context>nested browsing context</a> is <var>target</var>, then
  38523. return true and abort these steps.</p>
  38524. <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
  38525. 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
  38526. container</a>, then let <var>candidate</var> be the <a href=#active-document id=focus-management-apis:active-document-2>active document</a> of
  38527. 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
  38528. this step.</p>
  38529. <p>Otherwise, return false and abort these steps.</p>
  38530. </ol>
  38531. <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>
  38532. 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>
  38533. 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
  38534. <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
  38535. notification to indicate to the user that the page is attempting to gain focus.</p>
  38536. <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>
  38537. object, when invoked, provides a hint to the user agent that the script believes the user probably
  38538. 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
  38539. <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
  38540. interesting again in the future.</p>
  38541. <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>
  38542. method entirely.</p>
  38543. <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
  38544. 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
  38545. sites widely abuse this behavior to the user's detriment.</p>
  38546. <p>The <dfn id=dom-focus><code>focus()</code></dfn> method on elements, when invoked, must
  38547. run the following algorithm:</p>
  38548. <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>
  38549. <p>The <dfn id=dom-blur><code>blur()</code></dfn> method, when invoked, should run the
  38550. <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
  38551. selectively or uniformly ignore calls to this method for usability reasons.</p>
  38552. <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
  38553. being used to remove the focus ring for aesthetics reasons, the page would become unusable by
  38554. keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the
  38555. page.</p>
  38556. <h3 id=assigning-keyboard-shortcuts>6.5 Assigning keyboard shortcuts</h3>
  38557. <h4 id=introduction-9>6.5.1 Introduction</h4>
  38558. <p><i>This section is non-normative.</i></p>
  38559. <p>Each element that can be activated or focused can be assigned a single key combination to
  38560. activate it, using the <code id=introduction-9:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code> attribute.</p>
  38561. <p>The exact shortcut is determined by the user agent, based on information about the user's
  38562. keyboard, what keyboard shortcuts already exist on the platform, and what other shortcuts have
  38563. 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>
  38564. <p>In order to ensure that a relevant keyboard shortcut is available on a wide variety of input
  38565. 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>
  38566. <p>Each alternative consists of a single character, such as a letter or digit.</p>
  38567. <p>User agents can provide users with a list of the keyboard shortcuts, but authors are encouraged
  38568. to do so also. The <code id=introduction-9:dom-accesskeylabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute returns a
  38569. string representing the actual key combination assigned by the user agent.</p>
  38570. <div class=example>
  38571. <p>In this example, an author has provided a button that can be invoked using a shortcut key. To
  38572. support full keyboards, the author has provided "C" as a possible key. To support devices
  38573. equipped only with numeric keypads, the author has provided "1" as another possibly key.</p>
  38574. <pre>&lt;input type=button value=Collect onclick="collect()"
  38575. <strong>accesskey="C 1"</strong> id=c></pre>
  38576. </div>
  38577. <div class=example>
  38578. <p>To tell the user what the shortcut key is, the author has this script here opted to explicitly
  38579. add the key combination to the button's label:</p>
  38580. <pre>function addShortcutKeyLabel(button) {
  38581. <strong> if (button.accessKeyLabel != '')
  38582. button.value += ' (' + button.accessKeyLabel + ')';</strong>
  38583. }
  38584. addShortcutKeyLabel(document.getElementById('c'));</pre>
  38585. <p>Browsers on different platforms will show different labels, even for the same key combination,
  38586. based on the convention prevalent on that platform. For example, if the key combination is the
  38587. Control key, the Shift key, and the letter C, a Windows browser might display
  38588. "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might display "<samp>^⇧C</samp>", while
  38589. an Emacs browser might just display "<samp>C-C</samp>". Similarly, if the key combination is the
  38590. Alt key and the Escape key, Windows might use "<samp>Alt+Esc</samp>", Mac might use
  38591. "<samp>⌥⎋</samp>", and an Emacs browser might use "<samp>M-ESC</samp>" or
  38592. "<samp>ESC ESC</samp>".</p>
  38593. <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>
  38594. </div>
  38595. <h4 id=the-accesskey-attribute>6.5.2 The <dfn><code>accesskey</code></dfn> attribute</h4>
  38596. <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>
  38597. 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
  38598. by the user agent as a guide for creating a keyboard shortcut that activates or focuses the
  38599. element.</p>
  38600. <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>
  38601. 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
  38602. length.</p>
  38603. <div class=example>
  38604. <p>In the following example, a variety of links are given with access keys so that keyboard users
  38605. familiar with the site can more quickly navigate to the relevant pages:</p>
  38606. <pre>&lt;nav>
  38607. &lt;p>
  38608. &lt;a title="Consortium Activities" accesskey="A" href="/Consortium/activities">Activities&lt;/a> |
  38609. &lt;a title="Technical Reports and Recommendations" accesskey="T" href="/TR/">Technical Reports&lt;/a> |
  38610. &lt;a title="Alphabetical Site Index" accesskey="S" href="/Consortium/siteindex">Site Index&lt;/a> |
  38611. &lt;a title="About This Site" accesskey="B" href="/Consortium/">About Consortium&lt;/a> |
  38612. &lt;a title="Contact Consortium" accesskey="C" href="/Consortium/contact">Contact&lt;/a>
  38613. &lt;/p>
  38614. &lt;/nav></pre>
  38615. </div>
  38616. <div class=example>
  38617. <p>In the following example, the search field is given two possible access keys, "s" and "0" (in
  38618. 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,
  38619. while a user agent on a small device with just a numeric keypad might pick just the plain
  38620. unadorned key <kbd><kbd>0</kbd></kbd>:</p>
  38621. <pre>&lt;form action="/search">
  38622. &lt;label>Search: &lt;input type="search" name="q" accesskey="s 0">&lt;/label>
  38623. &lt;input type="submit">
  38624. &lt;/form></pre>
  38625. </div>
  38626. <div class=example>
  38627. <p>In the following example, a button has possible access keys described. A script then tries to
  38628. update the button's label to advertise the key combination the user agent selected.</p>
  38629. <pre>&lt;input type=submit accesskey="N @ 1" value="Compose">
  38630. ...
  38631. &lt;script>
  38632. function labelButton(button) {
  38633. if (button.accessKeyLabel)
  38634. button.value += ' (' + button.accessKeyLabel + ')';
  38635. }
  38636. var inputs = document.getElementsByTagName('input');
  38637. for (var i = 0; i &lt; inputs.length; i += 1) {
  38638. if (inputs[i].type == "submit")
  38639. labelButton(inputs[i]);
  38640. }
  38641. &lt;/script></pre>
  38642. <p>On one user agent, the button's label might become "<samp>Compose (⌘N)</samp>". On
  38643. another, it might become "<samp>Compose (Alt+⇧+1)</samp>". If the user agent doesn't
  38644. assign a key, it will be just "<samp>Compose</samp>". The exact string depends on what the
  38645. <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
  38646. combination.</p>
  38647. </div>
  38648. <h4 id=processing-model-7>6.5.3 Processing model</h4>
  38649. <p>An element's <dfn id=assigned-access-key>assigned access key</dfn> is a key combination derived from the element's
  38650. <code id=processing-model-7:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code> content attribute. Initially, an element must not
  38651. have an <a href=#assigned-access-key id=processing-model-7:assigned-access-key>assigned access key</a>.</p>
  38652. <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,
  38653. 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
  38654. the following steps:</p>
  38655. <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
  38656. 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
  38657. spaces</a>, and let <var>keys</var> be the resulting tokens.<li>
  38658. <p>For each value in <var>keys</var> in turn, in the order the tokens appeared in the
  38659. attribute's value, run the following substeps:</p>
  38660. <ol><li><p>If the value is not a string exactly one Unicode code point in length, then skip the
  38661. 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
  38662. 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
  38663. key that corresponds to the value given in the attribute, can be used as the access key, then
  38664. 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
  38665. key</a> and abort these steps.
  38666. <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>
  38667. </ol>
  38668. <li><p><i>Fallback</i>: Optionally, the user agent may assign a key combination of its choosing
  38669. 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>
  38670. <p>Once a user agent has selected and assigned an access key for an element, the user agent should
  38671. 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
  38672. another <code id=processing-model-7:document><a href=#document>Document</a></code>.</p>
  38673. <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>
  38674. for an element, if the element <a href=#concept-command id=processing-model-7:concept-command>defines a command</a>, the
  38675. command's <a href=#command-facet-hiddenstate id=processing-model-7:command-facet-hiddenstate>Hidden State</a> facet is false (visible),
  38676. the command's <a href=#command-facet-disabledstate id=processing-model-7:command-facet-disabledstate>Disabled State</a> facet is also false
  38677. (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
  38678. <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>
  38679. <p class=note>User agents <a href=#expose-commands-in-ui>might expose</a> elements that have
  38680. 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
  38681. displayed in response to a specific key combination.</p>
  38682. <hr>
  38683. <p>The <dfn id=dom-accesskey><code>accessKey</code></dfn> IDL attribute must
  38684. <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>
  38685. <p>The <dfn id=dom-accesskeylabel><code>accessKeyLabel</code></dfn> IDL attribute must return
  38686. 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
  38687. does not have one, then the IDL attribute must return the empty string.</p>
  38688. <h3 id=editing-2>6.6 Editing</h3>
  38689. <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>
  38690. <p>The <dfn id=attr-contenteditable><code>contenteditable</code></dfn> attribute is an
  38691. <a href=#enumerated-attribute id=contenteditable:enumerated-attribute>enumerated attribute</a> whose keywords are the empty string, <code>true</code>,
  38692. and <code>false</code>. The empty string and the <code>true</code> keyword map
  38693. to the <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state.
  38694. 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>
  38695. <p>The <i>true</i> state indicates that the element is editable. The <i>inherit</i> state
  38696. indicates that the element is editable if its parent is. The <i>false</i> state indicates that the
  38697. element is not editable.</p>
  38698. <dl class=domintro><dt><var>element</var> . <code id=contenteditable:dom-contenteditable><a href=#dom-contenteditable>contentEditable</a></code> [ = <var>value</var> ]<dd>
  38699. <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>
  38700. <p>Can be set, to change that state.</p>
  38701. <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>
  38702. <dt><var>element</var> . <code id=contenteditable:dom-iscontenteditable><a href=#dom-iscontenteditable>isContentEditable</a></code><dd>
  38703. <p>Returns true if the element is editable; otherwise, returns false.</p>
  38704. </dl>
  38705. <p>The <dfn id=dom-contenteditable><code>contentEditable</code></dfn> IDL attribute, on
  38706. getting, must return the string "<code>true</code>" if the content attribute is set to
  38707. the true state, "<code>false</code>" if the content attribute is set to the false state,
  38708. and "<code>inherit</code>" otherwise. On setting, if the new value is an <a href=#ascii-case-insensitive id=contenteditable:ascii-case-insensitive>ASCII
  38709. case-insensitive</a> match for the string "<code>inherit</code>" then the content
  38710. 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
  38711. the string "<code>true</code>" then the content attribute must be set to the string
  38712. "<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
  38713. the string "<code>false</code>" then the content attribute must be set to the string
  38714. "<code>false</code>", and otherwise the attribute setter must throw a
  38715. <code id=contenteditable:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception.</p>
  38716. <p>The <dfn id=dom-iscontenteditable><code>isContentEditable</code></dfn> IDL attribute, on
  38717. getting, must return true if the element is either an <a href=#editing-host id=contenteditable:editing-host>editing host</a> or
  38718. <a href=#editable id=contenteditable:editable>editable</a>, and false otherwise.</p>
  38719. <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>
  38720. <p>Documents have a <dfn id=designMode><code>designMode</code></dfn>, which can be either enabled or
  38721. disabled.</p>
  38722. <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>
  38723. <p>Returns "<code>on</code>" if the document is editable, and "<code>off</code>" if it isn't.</p>
  38724. <p>Can be set, to change the document's current state. This focuses the document and resets the
  38725. selection in that document.</p>
  38726. </dl>
  38727. <p>The <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-3><a href=#designMode>designMode</a></code> IDL attribute on the
  38728. <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
  38729. case-insensitive</a> manner to these two values; if it matches the "<code>on</code>"
  38730. 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
  38731. 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
  38732. ignored.</p>
  38733. <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
  38734. attribute must return the value "<code>on</code>"; otherwise it is disabled, and the
  38735. attribute must return the value "<code>off</code>".</p>
  38736. <p>The last state set must persist until the document is destroyed or the state is changed.
  38737. Initially, documents must have their <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-7><a href=#designMode>designMode</a></code>
  38738. disabled.</p>
  38739. <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
  38740. 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
  38741. 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
  38742. <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>
  38743. <h4 id=best-practices-for-in-page-editors>6.6.3 Best practices for in-page editors</h4>
  38744. <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
  38745. hosts</a> and on markup that was originally created through these editing mechanisms to the
  38746. value 'pre-wrap'. Default HTML whitespace handling is not well suited to WYSIWYG editing, and line
  38747. wrapping will not work correctly in some corner cases if 'white-space' is left at its default
  38748. value.</p>
  38749. <div class=example>
  38750. <p>As an example of problems that occur if the default 'normal' value is used instead, consider
  38751. the case of the user typing "<kbd>yellow␣␣ball</kbd>", with two spaces (here
  38752. represented by "␣") between the words. With the editing rules in place for the default
  38753. value of 'white-space' ('normal'), the resulting markup will either consist of
  38754. "<samp>yellow&amp;nbsp; ball</samp>" or "<samp>yellow &amp;nbsp;ball</samp>"; i.e.,
  38755. there will be a non-breaking space between the two words in addition to the regular space. This
  38756. is necessary because the 'normal' value for 'white-space' requires adjacent regular spaces to be
  38757. collapsed together.</p>
  38758. <p>In the former case, "<samp>yellow⍽</samp>" might wrap to the next line ("⍽"
  38759. being used here to represent a non-breaking space) even though "<samp>yellow</samp>" alone might
  38760. fit at the end of the line; in the latter case, "<samp>⍽ball</samp>", if wrapped to the
  38761. start of the line, would have visible indentation from the non-breaking space.</p>
  38762. <p>When 'white-space' is set to 'pre-wrap', however, the editing rules will instead simply put
  38763. two regular spaces between the words, and should the two words be split at the end of a line, the
  38764. spaces would be neatly removed from the rendering.</p>
  38765. </div>
  38766. <h4 id=editing-apis>6.6.4 Editing APIs</h4>
  38767. <p>The definition of the terms <dfn id=active-range>active range</dfn>, <dfn id=editing-host>editing host</dfn>, and
  38768. <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
  38769. <dfn id=execCommand><code>execCommand()</code></dfn>,
  38770. <dfn id=dom-document-querycommandenabled><code>queryCommandEnabled()</code></dfn>,
  38771. <dfn id=dom-document-querycommandindeterm><code>queryCommandIndeterm()</code></dfn>,
  38772. <dfn id=dom-document-querycommandstate><code>queryCommandState()</code></dfn>,
  38773. <dfn id=dom-document-querycommandsupported><code>queryCommandSupported()</code></dfn>, and
  38774. <dfn id=dom-document-querycommandvalue><code>queryCommandValue()</code></dfn>
  38775. methods, text selections, and the <dfn id=delete-the-selection>delete the selection</dfn> algorithm are defined in the
  38776. HTML Editing APIs specification. <a href=#refsEDITING>[EDITING]</a>
  38777. </p>
  38778. <h4 id=spelling-and-grammar-checking>6.6.5 Spelling and grammar checking</h4>
  38779. <p>User agents can support the checking of spelling and grammar of editable text, either in form
  38780. 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
  38781. host</a> (e.g. using <code id=spelling-and-grammar-checking:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>).</p>
  38782. <p>For each element, user agents must establish a <dfn id=concept-spellcheck-default>default
  38783. behavior</dfn>, either through defaults or through preferences expressed by the user. There are
  38784. three possible default behaviors for each element:</p>
  38785. <dl><dt><dfn id=concept-spellcheck-default-true>true-by-default</dfn>
  38786. <dd>The element will be checked for spelling and grammar if its contents are editable.
  38787. <dt><dfn id=concept-spellcheck-default-false>false-by-default</dfn>
  38788. <dd>The element will never be checked for spelling and grammar.
  38789. <dt><dfn id=concept-spellcheck-default-inherit>inherit-by-default</dfn>
  38790. <dd>The element's default behavior is the same as its parent element's. Elements that have no
  38791. parent element cannot have this as their default behavior.
  38792. </dl>
  38793. <hr>
  38794. <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
  38795. 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
  38796. <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state. In
  38797. 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>
  38798. <p class=note>The <i>true</i> state indicates that the element is to have its spelling and
  38799. grammar checked. The <i>default</i> state indicates that the element is to act according to a
  38800. 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
  38801. indicates that the element is not to be checked.</p>
  38802. <hr>
  38803. <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>
  38804. <p>Returns true if the element is to have its spelling and grammar checked; otherwise, returns
  38805. false.</p>
  38806. <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>
  38807. <dt><var>element</var> . <code id=spelling-and-grammar-checking:dom-forcespellcheck><a href=#dom-forcespellcheck>forceSpellCheck</a></code>()<dd>
  38808. <p>Forces the user agent to report spelling and grammar errors on the element (if checking is
  38809. enabled), even if the user has never focused the element. (If the method is not invoked, user
  38810. agents can hide errors in text that wasn't just entered by the user.)</p>
  38811. </dl>
  38812. <p>The <dfn id=dom-spellcheck><code>spellcheck</code></dfn> IDL attribute, on getting, must
  38813. 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
  38814. 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>
  38815. 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
  38816. 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
  38817. element's <code id=spelling-and-grammar-checking:dom-spellcheck-2><a href=#dom-spellcheck>spellcheck</a></code> IDL attribute would return true;
  38818. otherwise, if none of those conditions applies, then the attribute must instead return false.</p>
  38819. <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
  38820. by user preferences that override the <code id=spelling-and-grammar-checking:attr-spellcheck-6><a href=#attr-spellcheck>spellcheck</a></code> content
  38821. attribute, and therefore might not reflect the actual spellchecking state.</p>
  38822. <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
  38823. "<code>true</code>", otherwise it must be set to the literal string "<code>false</code>".
  38824. <hr>
  38825. <p>User agents must only consider the following pieces of text as checkable for the purposes of
  38826. this feature:</p>
  38827. <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>,
  38828. <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
  38829. 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
  38830. 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>
  38831. <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
  38832. associated is the element that is the immediate parent of the first character of the word,
  38833. sentence, or other piece of text. For text in attributes, it is the attribute's element. For the
  38834. 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>
  38835. <p>To determine if a word, sentence, or other piece of text in an applicable element (as defined
  38836. above) is to have spelling- and grammar-checking enabled, the UA must use the following
  38837. algorithm:</p>
  38838. <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
  38839. 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
  38840. <i>true</i> state, then checking is enabled; otherwise, if that attribute is in the <i>false</i>
  38841. 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>
  38842. state, then: if the nearest such ancestor's <code id=spelling-and-grammar-checking:attr-spellcheck-10><a href=#attr-spellcheck>spellcheck</a></code>
  38843. content attribute is in the <i>true</i> state, then checking is enabled; otherwise, checking is
  38844. disabled.<li>Otherwise, if the element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default-3>default behavior</a>
  38845. is <a href=#concept-spellcheck-default-true id=spelling-and-grammar-checking:concept-spellcheck-default-true-2>true-by-default</a>, then checking is
  38846. enabled.<li>Otherwise, if the element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default-4>default behavior</a>
  38847. is <a href=#concept-spellcheck-default-false id=spelling-and-grammar-checking:concept-spellcheck-default-false>false-by-default</a>, then checking is
  38848. disabled.<li>Otherwise, if the element's parent element has <em>its</em> checking enabled, then checking
  38849. is enabled.<li>Otherwise, checking is disabled.</ol>
  38850. <p>If the checking is enabled for a word/sentence/text, the user agent should indicate spelling
  38851. and grammar errors in that text. User agents should take into account the other semantics given in
  38852. the document when suggesting spelling and grammar corrections. User agents may use the language of
  38853. the element to determine what spelling and grammar rules to use, or may use the user's preferred
  38854. 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
  38855. possible.</p>
  38856. <p>If checking is disabled, the user agent should not indicate spelling or grammar errors for that
  38857. text.</p>
  38858. <p>Even when checking is enabled, user agents may opt to not report spelling or grammar errors in
  38859. text that the user agent deems the user has no interest in having checked (e.g. text that was
  38860. already present when the page was loaded, or that the user did not type, or text in controls that
  38861. the user has not focused, or in parts of e-mail addresses that the user agent is not confident
  38862. were misspelt). The <dfn id=dom-forcespellcheck><code>forceSpellCheck()</code></dfn> method,
  38863. when invoked on an element, must override this behavior, forcing the user agent to consider all
  38864. spelling and grammar errors in text in that element for which checking is enabled to be of
  38865. interest to the user.</p>
  38866. <div class=example>
  38867. <p>The element with ID "a" in the following example would be the one used to determine if the
  38868. word "Hello" is checked for spelling errors. In this example, it would not be.</p>
  38869. <pre>&lt;div contenteditable="true">
  38870. &lt;span spellcheck="false" id="a">Hell&lt;/span>&lt;em>o!&lt;/em>
  38871. &lt;/div></pre>
  38872. <p>The element with ID "b" in the following example would have checking enabled (the leading
  38873. 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
  38874. to be ignored, so the ancestor's value is used instead, regardless of the default).</p>
  38875. <pre class=bad>&lt;p spellcheck="true">
  38876. &lt;label>Name: &lt;input spellcheck=" false" id="b">&lt;/label>
  38877. &lt;/p></pre>
  38878. </div>
  38879. <p class=note>This specification does not define the user interface for spelling and grammar
  38880. checkers. A user agent could offer on-demand checking, could perform continuous checking while the
  38881. checking is enabled, or could use other interfaces.</p>
  38882. <h3 id=dnd>6.7 <dfn>Drag and drop</dfn></h3>
  38883. <p>This section defines an event-based drag-and-drop mechanism.</p>
  38884. <p>This specification does not define exactly what a <em>drag-and-drop operation</em> actually
  38885. is.</p>
  38886. <p>On a visual medium with a pointing device, a drag operation could be the default action of a
  38887. <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
  38888. being released.</p>
  38889. <p>When using an input modality other than a pointing device, users would probably have to
  38890. explicitly indicate their intention to perform a drag-and-drop operation, stating what they wish
  38891. to drag and where they wish to drop it, respectively.</p>
  38892. <p>However it is implemented, drag-and-drop operations must have a starting point (e.g. where the
  38893. mouse was clicked, or the start of the selection or element that was selected for the drag), may
  38894. have any number of intermediate steps (elements that the mouse moves over during a drag, or
  38895. elements that the user picks as possible drop points as he cycles through possibilities), and must
  38896. either have an end point (the element above which the mouse button was released, or the element
  38897. that was finally selected), or be canceled. The end point must be the last element selected as a
  38898. possible drop point before the drop occurs (so if the operation is not canceled, there must be at
  38899. least one element in the middle step).</p>
  38900. <h4 id=introduction-10>6.7.1 Introduction</h4>
  38901. <p><i>This section is non-normative.</i></p>
  38902. <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>
  38903. <p>The event handler typically needs to check that it's not a text selection that is being
  38904. dragged, and then needs to store data into the <code id=introduction-10:datatransfer><a href=#datatransfer>DataTransfer</a></code> object and set the
  38905. allowed effects (copy, move, link, or some combination).</p>
  38906. <p>For example:</p>
  38907. <pre>&lt;p>What fruits do you like?&lt;/p>
  38908. &lt;ol ondragstart="dragStartHandler(event)">
  38909. &lt;li draggable="true" data-value="fruit-apple">Apples&lt;/li>
  38910. &lt;li draggable="true" data-value="fruit-orange">Oranges&lt;/li>
  38911. &lt;li draggable="true" data-value="fruit-pear">Pears&lt;/li>
  38912. &lt;/ol>
  38913. &lt;script>
  38914. var internalDNDType = 'text/x-example'; // set this to something specific to your site
  38915. function dragStartHandler(event) {
  38916. if (event.target instanceof HTMLLIElement) {
  38917. // use the element's data-value="" attribute as the value to be moving:
  38918. event.dataTransfer.setData(internalDNDType, event.target.dataset.value);
  38919. event.dataTransfer.effectAllowed = 'move'; // only allow moves
  38920. } else {
  38921. event.preventDefault(); // don't allow selection to be dragged
  38922. }
  38923. }
  38924. &lt;/script></pre>
  38925. <hr>
  38926. <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>
  38927. attribute and listen to the <code id=introduction-10:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event.</p>
  38928. <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
  38929. data to accept (e.g. "<code>string:text/plain</code>" to accept any text strings, or
  38930. "<code>file:image/png</code>" to accept a PNG image file) and what kind of feedback to
  38931. give (e.g. "<code>move</code>" to indicate that the data will be moved).</p>
  38932. <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
  38933. target can handle the <code id=introduction-10:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> event (to report whether or
  38934. 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>
  38935. event (to specify what feedback is to be shown to the user).</p>
  38936. <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
  38937. 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
  38938. (otherwise it's reset).</p>
  38939. <p>For example:</p>
  38940. <pre>&lt;p>Drop your favorite fruits below:&lt;/p>
  38941. &lt;ol dropzone="move string:text/x-example" ondrop="dropHandler(event)">
  38942. &lt;!-- don't forget to change the "text/x-example" type to something
  38943. specific to your site -->
  38944. &lt;/ol>
  38945. &lt;script>
  38946. var internalDNDType = 'text/x-example'; // set this to something specific to your site
  38947. function dropHandler(event) {
  38948. var li = document.createElement('li');
  38949. var data = event.dataTransfer.getData(internalDNDType);
  38950. if (data == 'fruit-apple') {
  38951. li.textContent = 'Apples';
  38952. } else if (data == 'fruit-orange') {
  38953. li.textContent = 'Oranges';
  38954. } else if (data == 'fruit-pear') {
  38955. li.textContent = 'Pears';
  38956. } else {
  38957. li.textContent = 'Unknown Fruit';
  38958. }
  38959. event.target.appendChild(li);
  38960. }
  38961. &lt;/script></pre>
  38962. <hr>
  38963. <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>
  38964. <p>For our example here, that means updating the original markup to handle that event:</p>
  38965. <pre>&lt;p>What fruits do you like?&lt;/p>
  38966. &lt;ol ondragstart="dragStartHandler(event)" ondragend="dragEndHandler(event)">
  38967. <em>...as before...</em>
  38968. &lt;/ol>
  38969. &lt;script>
  38970. function dragStartHandler(event) {
  38971. // <em>...as before...</em>
  38972. }
  38973. function dragEndHandler(event) {
  38974. if (event.dataTransfer.dropEffect == 'move') {
  38975. // remove the dragged element
  38976. event.target.parentNode.removeChild(event.target);
  38977. }
  38978. }
  38979. &lt;/script></pre>
  38980. <h4 id=the-drag-data-store>6.7.2 The drag data store</h4>
  38981. <p>The data that underlies a drag-and-drop operation, known as the <dfn id=drag-data-store>drag data store</dfn>,
  38982. consists of the following information:</p>
  38983. <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
  38984. data, each consisting of the following information:</p>
  38985. <dl><dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn><dd>
  38986. <p>The kind of data:</p>
  38987. <dl><dt><i>Plain Unicode string</i><dd>
  38988. <p>Text.</p>
  38989. <dt><i>File</i><dd>
  38990. <p>Binary data with a file name.</p>
  38991. </dl>
  38992. <dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn><dd>
  38993. <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
  38994. type</a>. Some values that are not <a href=#mime-type id=the-drag-data-store:mime-type-2>MIME types</a> are
  38995. 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
  38996. 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>
  38997. <p class=note>Strings that contain <a href=#space-character id=the-drag-data-store:space-character>space characters</a>
  38998. 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
  38999. encouraged to use only <a href=#mime-type id=the-drag-data-store:mime-type-4>MIME types</a> or custom strings (without
  39000. spaces).</p>
  39001. <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>
  39002. <dt>The actual data<dd><p>A Unicode or binary string, in some cases with a file name (itself a Unicode string),
  39003. 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>
  39004. <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
  39005. to the list; most recently added last.</p>
  39006. <li>
  39007. <p>The following information, used to generate the UI feedback during the drag:</p>
  39008. <ul><li>User-agent-defined default feedback information, known as the <dfn id=drag-data-store-default-feedback>drag data store default
  39009. feedback</dfn>.<li>Optionally, a bitmap image and the coordinate of a point within that image, known as the
  39010. <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>
  39011. <li>
  39012. <p>A <dfn id=drag-data-store-mode>drag data store mode</dfn>, which is one of the following:</p>
  39013. <dl><dt><dfn id=concept-dnd-rw>Read/write mode</dfn><dd>
  39014. <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
  39015. <a href=#drag-data-store id=the-drag-data-store:drag-data-store>drag data store</a>.</p>
  39016. <dt><dfn id=concept-dnd-ro>Read-only mode</dfn><dd>
  39017. <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
  39018. data can be read, including the data. No new data can be added.</p>
  39019. <dt><dfn id=concept-dnd-p>Protected mode</dfn><dd>
  39020. <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
  39021. items representing dragged data can be enumerated, but the data itself is unavailable and no
  39022. new data can be added.</p>
  39023. </dl>
  39024. <li>
  39025. <p>A <dfn id=drag-data-store-allowed-effects-state>drag data store allowed effects state</dfn>, which is a string.</p>
  39026. </ul>
  39027. <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
  39028. 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
  39029. <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
  39030. <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
  39031. 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>
  39032. <h4 id=the-datatransfer-interface>6.7.3 The <code id=the-datatransfer-interface:datatransfer><a href=#datatransfer>DataTransfer</a></code> interface</h4>
  39033. <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
  39034. underlies a drag-and-drop operation.</p>
  39035. <pre class=idl>interface <dfn id=datatransfer>DataTransfer</dfn> {
  39036. attribute DOMString <a href=#dom-datatransfer-dropeffect id=the-datatransfer-interface:dom-datatransfer-dropeffect>dropEffect</a>;
  39037. attribute DOMString <a href=#dom-datatransfer-effectallowed id=the-datatransfer-interface:dom-datatransfer-effectallowed>effectAllowed</a>;
  39038. 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>;
  39039. void <a href=#dom-datatransfer-setdragimage id=the-datatransfer-interface:dom-datatransfer-setdragimage>setDragImage</a>(Element image, long x, long y);
  39040. /* old interface */
  39041. readonly attribute DOMString[] <a href=#dom-datatransfer-types id=the-datatransfer-interface:dom-datatransfer-types>types</a>;
  39042. DOMString <a href=#dom-datatransfer-getdata id=the-datatransfer-interface:dom-datatransfer-getdata>getData</a>(DOMString format);
  39043. void <a href=#dom-datatransfer-setdata id=the-datatransfer-interface:dom-datatransfer-setdata>setData</a>(DOMString format, DOMString data);
  39044. void <a href=#dom-datatransfer-cleardata id=the-datatransfer-interface:dom-datatransfer-cleardata>clearData</a>(optional DOMString format);
  39045. 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>;
  39046. };</pre>
  39047. <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>
  39048. <p>Returns the kind of operation that is currently selected. If the kind of operation isn't one
  39049. 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
  39050. fail.</p>
  39051. <p>Can be set, to change the selected operation.</p>
  39052. <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>
  39053. <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>
  39054. <p>Returns the kinds of operations that are to be allowed.</p>
  39055. <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
  39056. the allowed operations.</p>
  39057. <p>The possible values are "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-none><a href=#dom-datatransfer-effectallowed-none>none</a></code>",
  39058. "<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>
  39059. <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-items-2><a href=#dom-datatransfer-items>items</a></code><dd>
  39060. <p>Returns a <code id=the-datatransfer-interface:datatransferitemlist-2><a href=#datatransferitemlist>DataTransferItemList</a></code> object, with the drag data.</p>
  39061. <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>
  39062. <p>Uses the given element to update the drag feedback, replacing any previously specified
  39063. feedback.</p>
  39064. <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-types-2><a href=#dom-datatransfer-types>types</a></code><dd>
  39065. <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,
  39066. then one of the types will be the string "<code>Files</code>".</p>
  39067. <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>
  39068. <p>Returns the specified data. If there is no such data, returns the empty string.</p>
  39069. <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>
  39070. <p>Adds the specified data.</p>
  39071. <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>
  39072. <p>Removes the data of the specified formats. Removes all data if the argument is omitted.</p>
  39073. <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-files-2><a href=#dom-datatransfer-files>files</a></code><dd>
  39074. <p>Returns a <code id=the-datatransfer-interface:filelist-2><a href=#filelist>FileList</a></code> of the files being dragged, if any.</p>
  39075. </dl>
  39076. <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
  39077. events</a>, and are only valid while those events are being fired.</p>
  39078. <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
  39079. is valid.</p>
  39080. <p>The <dfn id=dom-datatransfer-dropeffect><code>dropEffect</code></dfn> attribute controls
  39081. the drag-and-drop feedback that the user is given during a drag-and-drop operation. When the
  39082. <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
  39083. 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
  39084. set to the new value. Other values must be ignored.</p>
  39085. <p>The <dfn id=dom-datatransfer-effectallowed><code>effectAllowed</code></dfn> attribute is
  39086. 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
  39087. created, the <code id=the-datatransfer-interface:dom-datatransfer-effectallowed-4><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute is set
  39088. 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
  39089. 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
  39090. current value must be set to the new value. Otherwise it must be left unchanged.</p>
  39091. <p>The <dfn id=dom-datatransfer-items><code>items</code></dfn> attribute must return a
  39092. <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
  39093. same object must be returned each time.</p>
  39094. <p>The <dfn id=dom-datatransfer-setdragimage><code>setDragImage(<var>element</var>,
  39095. <var>x</var>, <var>y</var>)</code></dfn> method must run the following steps:</p>
  39096. <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
  39097. 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
  39098. not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-2>read/write mode</a>, abort these steps. Nothing
  39099. 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
  39100. data store bitmap</a> to the element's image (at its intrinsic size); otherwise, set the
  39101. <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
  39102. 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>,
  39103. <var>y</var> coordinate.</ol>
  39104. <p>The <dfn id=dom-datatransfer-types><code>types</code></dfn> attribute must return a
  39105. <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
  39106. that the following steps would produce. The same object must be returned each time.</p>
  39107. <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
  39108. 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>
  39109. 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
  39110. 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
  39111. <var>L</var> consisting of the string "<code>Files</code>". (This value can be
  39112. 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>
  39113. <p>The <dfn id=dom-datatransfer-getdata><code>getData(<var>format</var>)</code></dfn> method
  39114. must run the following steps:</p>
  39115. <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
  39116. 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
  39117. the <a href=#concept-dnd-p id=the-datatransfer-interface:concept-dnd-p>protected mode</a>, return the empty string and abort these
  39118. 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
  39119. 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
  39120. 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
  39121. 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
  39122. 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
  39123. <var>format</var>.<li><p>If <var>convert-to-URL</var> is true, then parse <var>result</var> as appropriate for
  39124. <code>text/uri-list</code> data, and then set <var>result</var> to the first URL from
  39125. the list, if any, or the empty string otherwise. <a href=#refsRFC2483>[RFC2483]</a><li><p>Return <var>result</var>.</ol>
  39126. <p>The <dfn id=dom-datatransfer-setdata><code>setData(<var>format</var>,
  39127. <var>data</var>)</code></dfn> method must run the following steps:</p>
  39128. <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
  39129. 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
  39130. not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-3>read/write mode</a>, abort these steps. Nothing
  39131. 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
  39132. lowercase</a>.<li>
  39133. <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
  39134. <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
  39135. <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
  39136. 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
  39137. given by the method's second argument.</ol>
  39138. <p>The <dfn id=dom-datatransfer-cleardata><code>clearData()</code></dfn> method must run the
  39139. following steps:</p>
  39140. <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
  39141. 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
  39142. not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-4>read/write mode</a>, abort these steps. Nothing
  39143. 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
  39144. 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
  39145. 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
  39146. lowercase</a>.<li>
  39147. <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
  39148. <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
  39149. <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
  39150. one.</ol>
  39151. <p class=note>The <code id=the-datatransfer-interface:dom-datatransfer-cleardata-3><a href=#dom-datatransfer-cleardata>clearData()</a></code> method does not
  39152. 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
  39153. calling <code id=the-datatransfer-interface:dom-datatransfer-cleardata-4><a href=#dom-datatransfer-cleardata>clearData()</a></code> (it would still contain the
  39154. "<code>Files</code>" string if any files were included in the drag).</p>
  39155. <p>The <dfn id=dom-datatransfer-files><code>files</code></dfn> attribute must return a
  39156. <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
  39157. representing the files found by the following steps. The same object must be returned each time.
  39158. 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
  39159. <code id=the-datatransfer-interface:file-2><a href=#file>File</a></code> object must be used each time.</p>
  39160. <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
  39161. 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
  39162. the <a href=#concept-dnd-p id=the-datatransfer-interface:concept-dnd-p-2>protected mode</a>, abort these steps; return the empty list
  39163. <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>
  39164. 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
  39165. 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>
  39166. <p class=note>This version of the API does not expose the types of the files during the
  39167. drag.</p>
  39168. <h5 id=the-datatransferitemlist-interface>6.7.3.1 The <code id=the-datatransferitemlist-interface:datatransferitemlist><a href=#datatransferitemlist>DataTransferItemList</a></code> interface</h5>
  39169. <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>
  39170. object.</p>
  39171. <pre class=idl>interface <dfn id=datatransferitemlist>DataTransferItemList</dfn> {
  39172. readonly attribute unsigned long <a href=#dom-datatransferitemlist-length id=the-datatransferitemlist-interface:dom-datatransferitemlist-length>length</a>;
  39173. <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);
  39174. <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);
  39175. <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);
  39176. void <a href=#dom-datatransferitemlist-remove id=the-datatransferitemlist-interface:dom-datatransferitemlist-remove>remove</a>(unsigned long index);
  39177. void <a href=#dom-datatransferitemlist-clear id=the-datatransferitemlist-interface:dom-datatransferitemlist-clear>clear</a>();
  39178. };</pre>
  39179. <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>
  39180. <p>Returns the <code id=the-datatransferitemlist-interface:datatransferitem-4><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var>index</var>th
  39181. entry in the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-2>drag data store</a>.</p>
  39182. <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>
  39183. <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>
  39184. <dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-clear-2><a href=#dom-datatransferitemlist-clear>clear</a></code>()<dd>
  39185. <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>
  39186. <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>
  39187. <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
  39188. text then a <var>type</var> string has to be provided
  39189. also.</p>
  39190. </dl>
  39191. <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
  39192. 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
  39193. <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
  39194. <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>
  39195. 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
  39196. <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
  39197. 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
  39198. <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
  39199. <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>
  39200. <p>The <dfn id=dom-datatransferitemlist-length><code>length</code></dfn> attribute must
  39201. return zero if the object is in the <i>disabled mode</i>; otherwise it must return the number of
  39202. 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>
  39203. <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
  39204. <a href=#supported-property-indices id=the-datatransferitemlist-interface:supported-property-indices>supported property indices</a> are the numbers in the range
  39205. <span>0 .. <var>n</var>-1</span>,
  39206. 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
  39207. list</a>.</p>
  39208. <p>To <dfn id=dom-datatransferitemlist-item>determine the value of an indexed property</dfn>
  39209. <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
  39210. <code id=the-datatransferitemlist-interface:datatransferitem-5><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var>i</var>th item in the
  39211. <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
  39212. 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>
  39213. object must be associated with the same <code id=the-datatransferitemlist-interface:datatransfer-5><a href=#datatransfer>DataTransfer</a></code> object as the
  39214. <code id=the-datatransferitemlist-interface:datatransferitemlist-12><a href=#datatransferitemlist>DataTransferItemList</a></code> object when it is first created.</p>
  39215. <p>The <dfn id=dom-datatransferitemlist-add><code>add()</code></dfn> method must run the
  39216. following steps:</p>
  39217. <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>
  39218. <p>Jump to the appropriate set of steps from the following list:</p>
  39219. <dl class=switch><dt>If the first argument to the method is a string<dd>
  39220. <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
  39221. 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
  39222. <code id=the-datatransferitemlist-interface:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception and abort these steps.</p>
  39223. <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
  39224. 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
  39225. method's first argument.</p>
  39226. <dt>If the first argument to the method is a <code id=the-datatransferitemlist-interface:file-2><a href=#file>File</a></code><dd>
  39227. <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
  39228. 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>,
  39229. <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
  39230. <code id=the-datatransferitemlist-interface:file-4><a href=#file>File</a></code>'s data.</p>
  39231. </dl>
  39232. <li><p><a href=#dom-datatransferitemlist-item id=the-datatransferitemlist-interface:dom-datatransferitemlist-item-2>Determine the value of the indexed
  39233. property</a> corresponding to the newly added item, and return that value (a newly created
  39234. <code id=the-datatransferitemlist-interface:datatransferitem-7><a href=#datatransferitem>DataTransferItem</a></code> object).</ol>
  39235. <p>The <dfn id=dom-datatransferitemlist-remove><code>remove()</code></dfn> method, when
  39236. invoked with the argument <var>i</var>, must run these steps:</p>
  39237. <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
  39238. 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>
  39239. <p>The <dfn id=dom-datatransferitemlist-clear><code>clear</code></dfn> method, if the
  39240. <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>,
  39241. 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
  39242. nothing.</p>
  39243. <h5 id=the-datatransferitem-interface>6.7.3.2 The <code id=the-datatransferitem-interface:datatransferitem><a href=#datatransferitem>DataTransferItem</a></code> interface</h5>
  39244. <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>
  39245. object.</p>
  39246. <pre class=idl>interface <dfn id=datatransferitem>DataTransferItem</dfn> {
  39247. readonly attribute DOMString <a href=#dom-datatransferitem-kind id=the-datatransferitem-interface:dom-datatransferitem-kind>kind</a>;
  39248. readonly attribute DOMString <a href=#dom-datatransferitem-type id=the-datatransferitem-interface:dom-datatransferitem-type>type</a>;
  39249. 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);
  39250. <a href=#file id=the-datatransferitem-interface:file>File</a>? <a href=#dom-datatransferitem-getasfile id=the-datatransferitem-interface:dom-datatransferitem-getasfile>getAsFile</a>();
  39251. };
  39252. callback <dfn id=functionstringcallback>FunctionStringCallback</dfn> = void (DOMString data);</pre>
  39253. <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>
  39254. <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",
  39255. "file".</p>
  39256. <dt><var>item</var> . <code id=the-datatransferitem-interface:dom-datatransferitem-type-2><a href=#dom-datatransferitem-type>type</a></code><dd>
  39257. <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>
  39258. <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>
  39259. <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
  39260. kind</a> is <i>Plain Unicode string</i>.</p>
  39261. <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>
  39262. <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>
  39263. </dl>
  39264. <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
  39265. 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
  39266. item list</a> still contains the item that the <code id=the-datatransferitem-interface:datatransferitem-4><a href=#datatransferitem>DataTransferItem</a></code> object represents,
  39267. 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
  39268. 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
  39269. <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
  39270. <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
  39271. 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
  39272. 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
  39273. <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
  39274. 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>
  39275. object is associated.</p>
  39276. <p>The <dfn id=dom-datatransferitem-kind><code>kind</code></dfn> attribute must return the
  39277. 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
  39278. it must return the string given in the cell from the second column of the following table from the
  39279. 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
  39280. represented by the <code id=the-datatransferitem-interface:datatransferitem-12><a href=#datatransferitem>DataTransferItem</a></code> object:</p>
  39281. <table><thead><tr><th> Kind <th> String
  39282. <tbody><tr><td> <i>Plain Unicode string</i> <td> "<code>string</code>"
  39283. <tr><td> <i>File</i> <td> "<code>file</code>"
  39284. </table>
  39285. <p>The <dfn id=dom-datatransferitem-type><code>type</code></dfn> attribute must return the
  39286. 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
  39287. 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
  39288. <code id=the-datatransferitem-interface:datatransferitem-14><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
  39289. <p>The <dfn id=dom-datatransferitem-getasstring><code>getAsString(<var>callback</var>)</code></dfn> method must run the following steps:</p>
  39290. <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>,
  39291. 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
  39292. 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
  39293. actual data of the item represented by the <code id=the-datatransferitem-interface:datatransferitem-16><a href=#datatransferitem>DataTransferItem</a></code> object as the
  39294. argument.</ol>
  39295. <p>The <dfn id=dom-datatransferitem-getasfile><code>getAsFile()</code></dfn>
  39296. method must run the following steps:</p>
  39297. <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>,
  39298. 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
  39299. 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
  39300. by the <code id=the-datatransferitem-interface:datatransferitem-18><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
  39301. </ol>
  39302. <h4 id=the-dragevent-interface>6.7.4 The <code id=the-dragevent-interface:dragevent><a href=#dragevent>DragEvent</a></code> interface</h4>
  39303. <p>The drag-and-drop processing model involves several events. They all use the
  39304. <code id=the-dragevent-interface:dragevent-2><a href=#dragevent>DragEvent</a></code> interface.</p>
  39305. <pre class=idl>[Constructor(DOMString type, optional <a href=#drageventinit id=the-dragevent-interface:drageventinit>DragEventInit</a> eventInitDict)]
  39306. interface <dfn id=dragevent>DragEvent</dfn> : <a href=#mouseevent id=the-dragevent-interface:mouseevent>MouseEvent</a> {
  39307. 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>;
  39308. };
  39309. dictionary <dfn id=drageventinit>DragEventInit</dfn> : <a href=#mouseeventinit id=the-dragevent-interface:mouseeventinit>MouseEventInit</a> {
  39310. <a href=#datatransfer id=the-dragevent-interface:datatransfer-2>DataTransfer</a>? dataTransfer;
  39311. };</pre>
  39312. <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>
  39313. <p>Returns the <code id=the-dragevent-interface:datatransfer-3><a href=#datatransfer>DataTransfer</a></code> object for the event.</p>
  39314. </dl>
  39315. <p class=note>Although, for consistency with other event interfaces, the <code id=the-dragevent-interface:dragevent-3><a href=#dragevent>DragEvent</a></code>
  39316. interface has a constructor, it is not particularly useful. In particular, there's no way to
  39317. 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
  39318. have a processing and security model that is coordinated by the browser during drag-and-drops.</p>
  39319. <p>The <dfn id=dom-dragevent-datatransfer><code>dataTransfer</code></dfn> attribute of the
  39320. <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
  39321. created, this attribute must be initialised to null. It represents the context information for the
  39322. event.</p>
  39323. <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,
  39324. 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
  39325. target</var>, the user agent must run the following steps:</p>
  39326. <ol><li><p>If no specific <var>related target</var> was provided, set <var>related target</var> to
  39327. 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>
  39328. object of the specified target element.<li>
  39329. <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
  39330. data store mode</a> to the <a href=#concept-dnd-rw id=the-dragevent-interface:concept-dnd-rw>read/write mode</a>.</p>
  39331. <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
  39332. mode</a> to the <a href=#concept-dnd-ro id=the-dragevent-interface:concept-dnd-ro>read-only mode</a>.</p>
  39333. <li><p>Let <var>dataTransfer</var> be a newly created <code id=the-dragevent-interface:datatransfer-6><a href=#datatransfer>DataTransfer</a></code> object
  39334. 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
  39335. 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>
  39336. <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
  39337. 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
  39338. <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
  39339. drag-and-drop source, as given by the following table, otherwise (i.e. if <var>e</var>
  39340. 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>
  39341. <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>
  39342. <p>Where the table above provides <dfn id=concept-platform-dropeffect-override>possibly
  39343. appropriate alternatives</dfn>, user agents may instead use the listed alternative values if
  39344. platform conventions dictate that the user has requested those alternate effects.</p>
  39345. <p class=example>For example, Windows platform conventions are such that dragging while
  39346. holding the "alt" key indicates a preference for linking the data, rather than moving or copying
  39347. 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
  39348. the table above while the "alt" key is depressed, the user agent could select that instead of
  39349. "<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>
  39350. <li>
  39351. <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
  39352. and initialise it to have the given name <var>e</var>, to bubble, to be cancelable unless
  39353. <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
  39354. attributes initialised according to the state of the input devices as they would be for user
  39355. interaction events, the <code id=the-dragevent-interface:dom-mouseevent-relatedtarget><a href=#dom-mouseevent-relatedtarget>relatedTarget</a></code>
  39356. 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
  39357. <var>dataTransfer</var>, the <code id=the-dragevent-interface:datatransfer-7><a href=#datatransfer>DataTransfer</a></code> object created above.</p>
  39358. <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>
  39359. <li><p><a href=#concept-event-dispatch id=the-dragevent-interface:concept-event-dispatch>Dispatch</a> the newly created
  39360. <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
  39361. <var>dataTransfer</var>'s <code id=the-dragevent-interface:dom-datatransfer-effectallowed-4><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
  39362. 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
  39363. store</a>.</ol>
  39364. <h4 id=drag-and-drop-processing-model>6.7.5 Drag-and-drop processing model</h4>
  39365. <p>When the user attempts to begin a drag operation, the user agent must run the following steps.
  39366. User agents must act as if these steps were run even if the drag actually started in another
  39367. document or application and the user agent was not aware that the drag was occurring until it
  39368. intersected with a document under the user agent's purview.</p>
  39369. <ol><li>
  39370. <p>Determine what is being dragged, as follows:</p>
  39371. <p>If the drag operation was invoked on a selection, then it is the selection that is being
  39372. dragged.</p>
  39373. <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
  39374. element, going up the ancestor chain, starting at the node that the user tried to drag, that has
  39375. 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
  39376. element, then nothing is being dragged; abort these steps, the drag-and-drop operation is never
  39377. started.</p>
  39378. <p>Otherwise, the drag operation was invoked outside the user agent's purview. What is being
  39379. dragged is defined by the document or application where the drag was started.</p>
  39380. <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>
  39381. <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
  39382. 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>
  39383. <p>Establish which DOM node is the <dfn id=source-node>source node</dfn>, as follows:</p>
  39384. <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
  39385. <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
  39386. that the user originally clicked). If the user did not specify a particular node, for example if
  39387. 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
  39388. 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>
  39389. <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
  39390. the element that is being dragged.</p>
  39391. <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
  39392. 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,
  39393. the user agent must instead follow the platform-specific conventions relevant to that
  39394. situation.</p>
  39395. <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
  39396. the drag-and-drop operation.</p>
  39397. <li>
  39398. <p>Determine the <dfn id=list-of-dragged-nodes>list of dragged nodes</dfn>, as follows:</p>
  39399. <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>
  39400. 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
  39401. selection (including all their ancestors).</p>
  39402. <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>,
  39403. if any.</p>
  39404. <li>
  39405. <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
  39406. item list</a>, with its properties set as follows:</p>
  39407. <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>
  39408. <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>
  39409. <dd><i>Plain Unicode string</i><dt>The actual data<dd>The text of the selection</dl>
  39410. <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
  39411. store item list</a>, with their properties set as follows:</p>
  39412. <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>
  39413. <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>
  39414. <dd><i>File</i><dt>The actual data<dd>The file's contents and name.</dl>
  39415. <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
  39416. context</a>, for example from a file system manager application.</p>
  39417. <p>If the drag initiated outside of the application, the user agent must add items to the
  39418. <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
  39419. 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
  39420. 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
  39421. lowercase</a>.</p>
  39422. <p>User agents may also add one or more items representing the selection or dragged element(s)
  39423. in other forms, e.g. as HTML.</p>
  39424. <li>
  39425. <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
  39426. <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>
  39427. <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>
  39428. <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>
  39429. <dd><i>Plain Unicode string</i><dt>The actual data<dd>The resulting JSON string.</dl>
  39430. <li>
  39431. <p>Run the following substeps:</p>
  39432. <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
  39433. URLs</a>.<li>
  39434. <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>
  39435. <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
  39436. 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>
  39437. 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
  39438. relative to the element.</dl>
  39439. <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>,
  39440. in the order they were added, separated by a U+000D CARRIAGE RETURN U+000A LINE FEED character
  39441. 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
  39442. follows:</p>
  39443. <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>
  39444. <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>
  39445. <dd><i>Plain Unicode string</i><dt>The actual data<dd><var>url string</var></dl>
  39446. </ol>
  39447. <li>
  39448. <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
  39449. (if the user is dragging the selection, then the selection would likely be the basis for this
  39450. feedback; if the user is dragging an element, then that element's rendering would be used; if
  39451. the drag began outside the user agent, then the platform conventions for determining the drag
  39452. feedback should be used).</p>
  39453. <li>
  39454. <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
  39455. <a href=#source-node id=drag-and-drop-processing-model:source-node-8>source node</a>.</p>
  39456. <p>If the event is canceled, then the drag-and-drop operation should not occur; abort these
  39457. steps.</p>
  39458. <p class=note>Since events with no event listeners registered are, almost by definition, never
  39459. canceled, drag-and-drop is always available to the user if the author does not specifically
  39460. prevent it.</p>
  39461. <li>
  39462. <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
  39463. conventions, and as described below.</p>
  39464. <p id=base-dnd-feedback>The drag-and-drop feedback must be generated from the first of the
  39465. following sources that is available:</p>
  39466. <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
  39467. hot spot coordinate</a> should be used as hints for where to put the cursor relative to the
  39468. resulting image. The values are expressed as distances in CSS pixels from the left side and
  39469. 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>
  39470. </ol>
  39471. <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>,
  39472. until the end of the drag-and-drop operation, device input events (e.g. mouse and keyboard events)
  39473. must be suppressed.</p>
  39474. <p>During the drag operation, the element directly indicated by the user as the drop target is
  39475. called the <dfn id=immediate-user-selection>immediate user selection</dfn>. (Only elements can be selected by the user; other
  39476. 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
  39477. selection</a> is not necessarily the <dfn id=current-target-element>current target element</dfn>, which is the element
  39478. currently selected for the drop part of the drag-and-drop operation.</p>
  39479. <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
  39480. (either by pointing at them with a pointing device, or by selecting them in some other way). The
  39481. <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>
  39482. changes, based on the results of event listeners in the document, as described below.</p>
  39483. <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
  39484. be null, which means no target element is selected. They can also both be elements in other
  39485. (DOM-based) documents, or other (non-Web) programs altogether. (For example, a user could drag
  39486. 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>
  39487. <p>In addition, there is also a <dfn id=current-drag-operation>current drag operation</dfn>, which can take on the values
  39488. "<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
  39489. "<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
  39490. as described in the steps below.</p>
  39491. <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
  39492. 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>
  39493. <ol><li>
  39494. <p>If the user agent is still performing the previous iteration of the sequence (if any) when
  39495. the next iteration becomes due, abort these steps for this iteration (effectively "skipping
  39496. missed frames" of the drag-and-drop operation).</p>
  39497. <li>
  39498. <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
  39499. <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
  39500. 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
  39501. drag operation).</p>
  39502. <li>
  39503. <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
  39504. ended the drag-and-drop operation, check the state of the drag-and-drop operation, as
  39505. follows:</p>
  39506. <ol><li>
  39507. <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
  39508. 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
  39509. 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
  39510. 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
  39511. 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>
  39512. <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
  39513. 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
  39514. selection</a>.<dt>Otherwise<dd>
  39515. <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>
  39516. at the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-10>immediate user selection</a>.</p>
  39517. <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
  39518. <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-11>immediate user selection</a>.</p>
  39519. <p>Otherwise, run the appropriate step from the following list:</p>
  39520. <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.
  39521. <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
  39522. <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
  39523. 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
  39524. 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
  39525. 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
  39526. 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
  39527. 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>
  39528. <p>Let <var>new target</var> be the nearest (deepest) such ancestor element.</p>
  39529. <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
  39530. <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-12>current target element</a> unchanged.</p>
  39531. <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
  39532. <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
  39533. 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
  39534. that event was canceled or not.</p>
  39535. <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>
  39536. <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>
  39537. 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,
  39538. 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
  39539. element</a>, regardless of whether that event was canceled or not.</p>
  39540. </dl>
  39541. </dl>
  39542. <li>
  39543. <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
  39544. 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
  39545. 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
  39546. 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
  39547. target</var>.</p>
  39548. <li>
  39549. <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
  39550. 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
  39551. target element</a>.</p>
  39552. <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
  39553. appropriate step from the following list:</p>
  39554. <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>,
  39555. 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
  39556. 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
  39557. 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>
  39558. 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
  39559. <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
  39560. 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
  39561. element</a>.</p>
  39562. <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
  39563. <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>
  39564. <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>
  39565. <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>
  39566. 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
  39567. <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>
  39568. object as they stood after the event <a href=#concept-event-dispatch id=drag-and-drop-processing-model:concept-event-dispatch>dispatch</a>
  39569. finished, as per the following table:</p>
  39570. <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>
  39571. <li>
  39572. <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
  39573. platform-specific mechanisms to determine what drag operation is being performed (none, copy,
  39574. 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>
  39575. <li>
  39576. <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
  39577. operation</a>, as follows:</p>
  39578. <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>
  39579. </ol>
  39580. <li>
  39581. <p>Otherwise, if the user ended the drag-and-drop operation (e.g. by releasing the mouse button
  39582. 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>
  39583. event was canceled, then this will be the last iteration. Run the following steps, then stop the
  39584. drag-and-drop operation:</p>
  39585. <ol><li>
  39586. <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
  39587. ended the drag-and-drop operation by canceling it (e.g. by hitting the <kbd>Escape</kbd> key),
  39588. 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
  39589. these substeps:</p>
  39590. <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
  39591. 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
  39592. 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>
  39593. <p>Otherwise, the drag operation might be a success; run these substeps:</p>
  39594. <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
  39595. 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
  39596. platform-specific conventions for indicating a drop.<li>
  39597. <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
  39598. <code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-3><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute of the
  39599. <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>
  39600. object as it stood after the event <a href=#concept-event-dispatch id=drag-and-drop-processing-model:concept-event-dispatch-2>dispatch</a>
  39601. finished.</p>
  39602. <p>Otherwise, the event is not canceled; perform the event's default action, which depends
  39603. on the exact target as follows:</p>
  39604. <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>,
  39605. 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
  39606. 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
  39607. 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
  39608. 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>
  39609. "<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
  39610. 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
  39611. 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
  39612. 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
  39613. data item kind</a> that is <i>Plain Unicode string</i> into the text field or
  39614. <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
  39615. platform-specific conventions (e.g. inserting it at the current mouse cursor position, or
  39616. 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>
  39617. </ol>
  39618. <li>
  39619. <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
  39620. <a href=#source-node id=drag-and-drop-processing-model:source-node-10>source node</a>.</p>
  39621. <li>
  39622. <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>
  39623. <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
  39624. 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
  39625. drag-and-drop operation is a selection in the DOM that is entirely contained within an
  39626. <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
  39627. 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
  39628. 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
  39629. 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
  39630. the user (e.g. by animating the dragged selection going back to the source of the
  39631. drag-and-drop operation), then do so.<dt>Otherwise<dd><p>The event has no default action.</dl>
  39632. <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
  39633. <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
  39634. one of the
  39635. <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>,
  39636. <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>,
  39637. <a href="#telephone-state-(type=tel)" id="drag-and-drop-processing-model:telephone-state-(type=tel)">Tel</a>,
  39638. <a href="#url-state-(type=url)" id="drag-and-drop-processing-model:url-state-(type=url)">URL</a>,
  39639. <a href="#e-mail-state-(type=email)" id="drag-and-drop-processing-model:e-mail-state-(type=email)">E-mail</a>,
  39640. <a href="#password-state-(type=password)" id="drag-and-drop-processing-model:password-state-(type=password)">Password</a>, or
  39641. <a href="#number-state-(type=number)" id="drag-and-drop-processing-model:number-state-(type=number)">Number</a>
  39642. states.</p>
  39643. </ol>
  39644. </ol>
  39645. <p class=note>User agents are encouraged to consider how to react to drags near the edge of
  39646. scrollable regions. For example, if a user drags a link to the bottom of the viewport on a long
  39647. page, it might make sense to scroll the page so that the user can drop the link lower on the
  39648. page.</p>
  39649. <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
  39650. are from; the events are fired as described above and the rest of the processing model runs as
  39651. described above, irrespective of how many documents are involved in the operation.</p>
  39652. <h4 id=dndevents>6.7.6 Events summary</h4>
  39653. <p><i>This section is non-normative.</i></p>
  39654. <p>The following events are involved in the drag-and-drop
  39655. model.</p>
  39656. <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>
  39657. <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>
  39658. <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>
  39659. <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>
  39660. <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>
  39661. <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>
  39662. <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>
  39663. <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>
  39664. <td><a href=#current-drag-operation id=dndevents:current-drag-operation-3>Current drag operation</a><td>Varies</table>
  39665. <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
  39666. 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>
  39667. <h4 id=the-draggable-attribute>6.7.7 The <dfn><code>draggable</code></dfn> attribute</h4>
  39668. <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>
  39669. content attribute set. The <code id=the-draggable-attribute:the-draggable-attribute-2><a href=#the-draggable-attribute>draggable</a></code> attribute is an
  39670. <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
  39671. the keyword <code>true</code>. The second state is <i>false</i> and it has the keyword
  39672. <code>false</code>. The third state is <i>auto</i>; it has no keywords but it is the
  39673. <i id=the-draggable-attribute:missing-value-default><a href=#missing-value-default>missing value default</a></i>.</p>
  39674. <p>The <i>true</i> state means the element is draggable; the <i>false</i> state means that it is
  39675. not. The <i>auto</i> state uses the default behavior of the user agent.</p>
  39676. <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
  39677. <code id=the-draggable-attribute:attr-title><a href=#attr-title>title</a></code> attribute that names the element for the purpose of
  39678. non-visual interactions. </p>
  39679. <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>
  39680. <p>Returns true if the element is draggable; otherwise, returns false.</p>
  39681. <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>
  39682. content attribute.</p>
  39683. </dl>
  39684. <p>The <dfn id=dom-draggable><code>draggable</code></dfn> IDL attribute, whose value depends
  39685. on the content attribute's in the way described below, controls whether or not the element is
  39686. 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>
  39687. <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
  39688. <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>
  39689. <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
  39690. 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
  39691. false.</p>
  39692. <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
  39693. 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>
  39694. 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>
  39695. <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,
  39696. 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
  39697. value "<code>false</code>". If the <code id=the-draggable-attribute:dom-draggable-8><a href=#dom-draggable>draggable</a></code> IDL
  39698. 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
  39699. attribute must be set to the literal value "<code>true</code>".</p>
  39700. <h4 id=the-dropzone-attribute>6.7.8 The <dfn><code>dropzone</code></dfn> attribute</h4>
  39701. <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
  39702. 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
  39703. 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
  39704. following:</p>
  39705. <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
  39706. dragged data.</p>
  39707. <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
  39708. being moved to the new location.</p>
  39709. <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
  39710. original data.</p>
  39711. <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
  39712. 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>
  39713. 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
  39714. 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
  39715. 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
  39716. drag data item type string</a> set to a value that matches the remainder of the keyword are
  39717. accepted.</dl>
  39718. <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
  39719. 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>)
  39720. 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
  39721. implied.</p>
  39722. <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
  39723. <code id=the-dropzone-attribute:attr-title><a href=#attr-title>title</a></code> attribute that names the element for the purpose of
  39724. non-visual interactions. </p>
  39725. <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>
  39726. <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
  39727. specified operation is as given by those steps.</p>
  39728. <p>The <dfn id=dropzone-processing-steps><code>dropzone</code> processing steps</dfn> are as follows.
  39729. They either result in a match or not, and separate from this result either in a specified
  39730. operation or not, as defined below.</p>
  39731. <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>
  39732. <p>For each value in <var>keywords</var>, if any, in the order that they were found in
  39733. <var>value</var>, run the following steps.</p>
  39734. <ol><li><p>Let <var>keyword</var> be the keyword.<li>
  39735. <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>",
  39736. "<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>
  39737. <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>
  39738. <li><p>If <var>keyword</var> does not contain a U+003A COLON character (:), or if the
  39739. first such character in <var>keyword</var> is either the first character or the last
  39740. 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
  39741. the first character in the string to the last character in the string that is before the first
  39742. 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>
  39743. <li>
  39744. <p>Jump to the appropriate step from the list below, based on the value of <var>kind
  39745. code</var>:</p>
  39746. <dl class=switch><dt>If <var>kind code</var> is the string "<code>string</code>"<dd>
  39747. <p>Let <var>kind</var> be <i>Plain Unicode string</i>.</p>
  39748. <dt>If <var>kind code</var> is the string "<code>file</code>"<dd>
  39749. <p>Let <var>kind</var> be <i>File</i>.</p>
  39750. <dt>Otherwise<dd>
  39751. <p>Skip to the step labeled <i>end of keyword</i> below.</p>
  39752. </dl>
  39753. <li><p>Let <var>type</var> be the substring of <var>keyword</var> from the
  39754. first character after the first U+003A COLON character (:) in the string, to the last character
  39755. 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
  39756. kind given in <var>kind</var> and
  39757. 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
  39758. overall algorithm, if there are no more.</ol>
  39759. <li>
  39760. <p>The algorithm results in a match if <var>matched</var> is true, and does not
  39761. otherwise.</p>
  39762. <p>The algorithm results in a specified operation if <var>operation</var> is not
  39763. unspecified. The specified operation, if one is specified, is the one given by <var>operation</var>.</p>
  39764. </ol>
  39765. <p>The <dfn id=dom-dropzone><code>dropzone</code></dfn> IDL attribute must
  39766. <a href=#reflect id=the-dropzone-attribute:reflect>reflect</a> the content attribute of the same name.</p>
  39767. <div class=example>
  39768. <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
  39769. 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
  39770. then displayed.</p>
  39771. <pre>&lt;div dropzone="copy file:image/png file:image/gif file:image/jpeg" ondrop="receive(event, this)">
  39772. &lt;p>Drop an image here to have it displayed.&lt;/p>
  39773. &lt;/div>
  39774. &lt;script>
  39775. function receive(event, element) {
  39776. var data = event.dataTransfer.items;
  39777. for (var i = 0; i &lt; data.length; i += 1) {
  39778. if ((data[i].kind == 'file') &amp;&amp; (data[i].type.match('^image/'))) {
  39779. var img = new Image();
  39780. img.src = window.createObjectURL(data[i].getAsFile());
  39781. element.appendChild(img);
  39782. }
  39783. }
  39784. }
  39785. &lt;/script></pre>
  39786. </div>
  39787. <h4 id=security-risks-in-the-drag-and-drop-model>6.7.9 Security risks in the drag-and-drop model</h4>
  39788. <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
  39789. <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
  39790. information from one document to a second document, crossing a hostile third document in the
  39791. process, the hostile document could intercept the data.</p>
  39792. <p>For the same reason, user agents must consider a drop to be successful only if the user
  39793. specifically ended the drag operation — if any scripts end the drag operation, it must be
  39794. 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
  39795. fired.</p>
  39796. <p>User agents should take care to not start drag-and-drop operations in response to script
  39797. actions. For example, in a mouse-and-window environment, if a script moves a window while the user
  39798. has his mouse button depressed, the UA would not consider that to start a drag. This is important
  39799. because otherwise UAs could cause data to be dragged from sensitive sources and dropped into
  39800. hostile documents without the user's consent.</p>
  39801. <p>User agents should filter potentially active (scripted) content (e.g. HTML) when it is dragged
  39802. 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
  39803. unexpected ways. This specification does not specify how this is performed.</p>
  39804. <div class=example>
  39805. <p>Consider a hostile page providing some content and getting the user to select and drag and
  39806. 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
  39807. only safe content is dragged, potentially unsafe content such as scripts and event handlers in
  39808. the selection, once dropped (or pasted) into the victim site, get the privileges of the victim
  39809. site. This would thus enable a cross-site scripting attack.</p>
  39810. </div>
  39811. <h2 id=browsers>7 Loading Web pages</h2>
  39812. <p>This section describes features that apply most directly to Web browsers. Having said that,
  39813. except where specified otherwise, the requirements defined in this section <em>do</em> apply to
  39814. all user agents, whether they are Web browsers or not.</p>
  39815. <h3 id=windows>7.1 Browsing contexts</h3>
  39816. <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
  39817. presented to the user.</p>
  39818. <p class=note>A tab or window in a Web browser typically contains a <a href=#browsing-context id=windows:browsing-context>browsing
  39819. 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
  39820. <code id=windows:frameset><a href=#frameset>frameset</a></code>.</p>
  39821. <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>
  39822. <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
  39823. <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
  39824. 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
  39825. 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
  39826. <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
  39827. 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
  39828. an API such as <code id=windows:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> has no
  39829. <a href=#browsing-context id=windows:browsing-context-8>browsing context</a>.)</p>
  39830. <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
  39831. <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
  39832. <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>
  39833. <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
  39834. <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
  39835. 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>,
  39836. 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>
  39837. 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
  39838. 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
  39839. many-to-1.</p>
  39840. <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>
  39841. associated with it. In particular, data mining tools are likely to never instantiate browsing
  39842. contexts.</p>
  39843. <hr>
  39844. <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
  39845. <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
  39846. 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
  39847. 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
  39848. 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
  39849. <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>
  39850. <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
  39851. 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
  39852. <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
  39853. <dfn id=creator-document>creator <code>Document</code></dfn>.</p>
  39854. <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
  39855. <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
  39856. 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>
  39857. 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
  39858. 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>
  39859. 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
  39860. 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>
  39861. 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
  39862. <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
  39863. <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
  39864. <code>Document</code></a> at the time of the <a href=#browsing-context id=windows:browsing-context-24>browsing context</a>'s creation.</p>
  39865. <p class=note>If the <a href=#browsing-context id=windows:browsing-context-25>browsing context</a> is created specifically to be immediately
  39866. navigated, then that initial navigation will have <a href=#replacement-enabled id=windows:replacement-enabled-2>replacement enabled</a>.</p>
  39867. <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
  39868. <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.
  39869. 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
  39870. <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
  39871. <code>Document</code></a> and the <a href=#effective-script-origin id=windows:effective-script-origin-2>effective script origin</a> of the
  39872. <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
  39873. <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
  39874. <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
  39875. 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
  39876. <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>
  39877. <h4 id=nested-browsing-contexts>7.1.1 Nested browsing contexts</h4>
  39878. <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
  39879. <code id=nested-browsing-contexts:document><a href=#document>Document</a></code> <var>D</var> with an element <var>E</var> that nests
  39880. another browsing context <var>C</var> inside it, then <var>C</var> is said to be
  39881. <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>.
  39882. 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
  39883. 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>.
  39884. 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
  39885. browsing context</a>.</p>
  39886. <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
  39887. 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
  39888. <var>B</var>, or if the browsing context <var>A</var> is the
  39889. <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-2>parent browsing context</a> of <var>B</var>.</p>
  39890. <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
  39891. browsing context</a>, and is the <dfn id=top-level-browsing-context>top-level browsing context</dfn> of all the browsing
  39892. contexts for which it is an <a href=#ancestor-browsing-context id=nested-browsing-contexts:ancestor-browsing-context-2>ancestor browsing context</a>.</p>
  39893. <p>The transitive closure of <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-4>parent browsing contexts</a>
  39894. 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>
  39895. <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>
  39896. <ol><li><p>Let <var>list</var> be an empty list.<li>
  39897. <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
  39898. order</a> of the elements nesting those <a href=#browsing-context id=nested-browsing-contexts:browsing-context-2>browsing
  39899. contexts</a>, run these substeps:</p>
  39900. <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>
  39901. <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
  39902. 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>
  39903. <li><p>Return the constructed <var>list</var>.</ol>
  39904. <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
  39905. 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
  39906. <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
  39907. <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
  39908. <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>
  39909. <p>Because they are nested through an element, <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-5>child browsing
  39910. 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
  39911. 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
  39912. not themselves <a href=#fully-active id=nested-browsing-contexts:fully-active-2>fully active</a>.</p>
  39913. <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>
  39914. 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>
  39915. <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
  39916. context container</a> before the new <code id=nested-browsing-contexts:document-8><a href=#document>Document</a></code> is created.</p>
  39917. <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
  39918. 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
  39919. history</a> and the <a href=#document-family id=nested-browsing-contexts:document-family>document families</a> of all those
  39920. <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
  39921. consists of the union of all the <a href=#document-family id=nested-browsing-contexts:document-family-3>document families</a> of the
  39922. <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>
  39923. <h5 id=navigating-nested-browsing-contexts-in-the-dom>7.1.1.1 Navigating nested browsing contexts in the DOM</h5>
  39924. <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>
  39925. <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>
  39926. <dt><var>window</var> . <code id=navigating-nested-browsing-contexts-in-the-dom:dom-parent><a href=#dom-parent>parent</a></code><dd>
  39927. <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>
  39928. <dt><var>window</var> . <code id=navigating-nested-browsing-contexts-in-the-dom:dom-frameelement><a href=#dom-frameelement>frameElement</a></code><dd>
  39929. <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>
  39930. <p>Returns null if there isn't one.</p>
  39931. <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>
  39932. </dl>
  39933. <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
  39934. 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
  39935. 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
  39936. 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>
  39937. 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
  39938. detached <a href=#nested-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:nested-browsing-context>nested browsing context</a>).</p>
  39939. <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>
  39940. 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
  39941. 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
  39942. 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
  39943. <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,
  39944. 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
  39945. browsing context</a>).</p>
  39946. <p>The <dfn id=dom-frameelement><code>frameElement</code></dfn> IDL attribute on the
  39947. <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
  39948. the following algorithm:</p>
  39949. <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
  39950. 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
  39951. <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
  39952. <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
  39953. 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>
  39954. <h4 id=auxiliary-browsing-contexts>7.1.2 Auxiliary browsing contexts</h4>
  39955. <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
  39956. 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
  39957. are always <a href=#top-level-browsing-context id=auxiliary-browsing-contexts:top-level-browsing-context-2>top-level browsing contexts</a>.</p>
  39958. <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
  39959. 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
  39960. created.</p>
  39961. <h5 id=navigating-auxiliary-browsing-contexts-in-the-dom>7.1.2.1 Navigating auxiliary browsing contexts in the DOM</h5>
  39962. <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>
  39963. 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
  39964. 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
  39965. browsing context</a>), if there is one, if it is still available, and if the current
  39966. <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>;
  39967. otherwise, it must return null. On setting, if the new value is null then the current
  39968. <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
  39969. the new value is anything else then the user agent must
  39970. 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
  39971. property name "<code>opener</code>" as the property key, and the Property Descriptor {
  39972. [[Value]]: <var>value</var>, [[Writable]]: true, [[Enumerable]]: true,
  39973. [[Configurable]]: true } as the property descriptor,
  39974. where <var>value</var> is the new value.</p>
  39975. <h4 id=secondary-browsing-contexts>7.1.3 Secondary browsing contexts</h4>
  39976. <p>User agents may support <dfn id=secondary-browsing-context>secondary browsing
  39977. contexts</dfn>, which are <a href=#browsing-context id=secondary-browsing-contexts:browsing-context>browsing contexts</a> that form part
  39978. of the user agent's interface, apart from the main content area.</p>
  39979. <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>
  39980. <h4 id=security-nav>7.1.4 Security</h4>
  39981. <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
  39982. 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
  39983. conditions is true:</p>
  39984. <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>
  39985. 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
  39986. 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
  39987. <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
  39988. <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
  39989. 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>,
  39990. but there exists an <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context>ancestor browsing context</a> of <var>B</var> whose
  39991. <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
  39992. 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>
  39993. <hr>
  39994. <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
  39995. second <a href=#browsing-context id=security-nav:browsing-context-4>browsing context</a> <var>B</var> if the following algorithm terminates
  39996. positively:</p>
  39997. <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>
  39998. 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
  39999. 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
  40000. 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
  40001. 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
  40002. 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,
  40003. 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
  40004. neither <var>A</var> nor one of the <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context-4>ancestor
  40005. browsing contexts</a> of <var>A</var>, and <var>A</var>'s
  40006. <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
  40007. 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
  40008. permitted sandboxed navigator</a> of <var>B</var>, then abort these steps
  40009. negatively.<li><p>Otherwise, terminate positively!</ol>
  40010. <hr>
  40011. <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
  40012. <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
  40013. <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>
  40014. 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
  40015. <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
  40016. 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
  40017. <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>
  40018. <h4 id=groupings-of-browsing-contexts>7.1.5 Groupings of browsing contexts</h4>
  40019. <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
  40020. reachable browsing contexts</dfn>. These are:</p>
  40021. <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
  40022. 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
  40023. 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>
  40024. <p>The transitive closure of all the <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-8>browsing contexts</a> that
  40025. 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
  40026. contexts</dfn>.</p>
  40027. <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
  40028. 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
  40029. <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
  40030. other members of the group, but could not be made the same as members of any other group. Each
  40031. such group is a <dfn id=unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</dfn>.</p>
  40032. <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
  40033. 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
  40034. have a shared <a href=#event-loop id=groupings-of-browsing-contexts:event-loop-2>event loop</a>).</p>
  40035. <h4 id=browsing-context-names>7.1.6 Browsing context names</h4>
  40036. <p>Browsing contexts can have a <dfn id=browsing-context-name>browsing context name</dfn>. By default, a browsing context
  40037. has no name (its name is not set).</p>
  40038. <p>A <dfn id=valid-browsing-context-name>valid browsing context name</dfn> is any string with at least one character that does
  40039. not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for
  40040. special keywords.)</p>
  40041. <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
  40042. 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:
  40043. <code>_blank</code>, <code>_self</code>, <code>_parent</code>, or <code>_top</code>.</p>
  40044. <p>These values have different meanings based on whether the page is sandboxed or not, as
  40045. summarised in the following (non-normative) table. In this table, "current" means the
  40046. <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
  40047. browsing context</a> of the one the link or script is in, "master" means the nearest
  40048. <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
  40049. <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
  40050. 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
  40051. 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
  40052. various user preferences and user agent policies, "none" means that nothing will happen, and
  40053. "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
  40054. <code id=browsing-context-names:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute (or if the user overrode the
  40055. sandboxing), and the same as "none" otherwise.</p>
  40056. <table><thead><tr><th rowspan=2>Keyword
  40057. <th rowspan=2>Ordinary effect
  40058. <th colspan=5>Effect in an <code id=browsing-context-names:the-iframe-element><a href=#the-iframe-element>iframe</a></code> with...
  40059. <tr><th><code>seamless=""</code>
  40060. <th><code>sandbox=""</code>
  40061. <th><code>sandbox="" seamless=""</code>
  40062. <th><code>sandbox="allow-top-navigation"</code>
  40063. <th><code>sandbox="allow-top-navigation" seamless=""</code>
  40064. <tbody><tr><td>none specified, for links and form submissions
  40065. <td>current
  40066. <td>master
  40067. <td>current
  40068. <td>master
  40069. <td>current
  40070. <td>master
  40071. <tr><td>empty string
  40072. <td>current
  40073. <td>master
  40074. <td>current
  40075. <td>master
  40076. <td>current
  40077. <td>master
  40078. <tr><td><code>_blank</code>
  40079. <td>new
  40080. <td>new
  40081. <td>maybe new
  40082. <td>maybe new
  40083. <td>maybe new
  40084. <td>maybe new
  40085. <tr><td><code>_self</code>
  40086. <td>current
  40087. <td>current
  40088. <td>current
  40089. <td>current
  40090. <td>current
  40091. <td>current
  40092. <tr><td><code>_parent</code> if there isn't a parent
  40093. <td>current
  40094. <td>current
  40095. <td>current
  40096. <td>current
  40097. <td>current
  40098. <td>current
  40099. <tr><td><code>_parent</code> if parent is also top
  40100. <td>parent/top
  40101. <td>parent/top
  40102. <td>none
  40103. <td>none
  40104. <td>parent/top
  40105. <td>parent/top
  40106. <tr><td><code>_parent</code> if there is one and it's not top
  40107. <td>parent
  40108. <td>parent
  40109. <td>none
  40110. <td>none
  40111. <td>none
  40112. <td>none
  40113. <tr><td><code>_top</code> if top is current
  40114. <td>current
  40115. <td>current
  40116. <td>current
  40117. <td>current
  40118. <td>current
  40119. <td>current
  40120. <tr><td><code>_top</code> if top is not current
  40121. <td>top
  40122. <td>top
  40123. <td>none
  40124. <td>none
  40125. <td>top
  40126. <td>top
  40127. <tr><td>name that doesn't exist
  40128. <td>new
  40129. <td>new
  40130. <td>maybe new
  40131. <td>maybe new
  40132. <td>maybe new
  40133. <td>maybe new
  40134. <tr><td>name that exists and is a descendant
  40135. <td>specified descendant
  40136. <td>specified descendant
  40137. <td>specified descendant
  40138. <td>specified descendant
  40139. <td>specified descendant
  40140. <td>specified descendant
  40141. <tr><td>name that exists and is current
  40142. <td>current
  40143. <td>current
  40144. <td>current
  40145. <td>current
  40146. <td>current
  40147. <td>current
  40148. <tr><td>name that exists and is an ancestor that is top
  40149. <td>specified ancestor
  40150. <td>specified ancestor
  40151. <td>none
  40152. <td>none
  40153. <td>specified ancestor/top
  40154. <td>specified ancestor/top
  40155. <tr><td>name that exists and is an ancestor that is not top
  40156. <td>specified ancestor
  40157. <td>specified ancestor
  40158. <td>none
  40159. <td>none
  40160. <td>none
  40161. <td>none
  40162. <tr><td>other name that exists with common top
  40163. <td>specified
  40164. <td>specified
  40165. <td>none
  40166. <td>none
  40167. <td>none
  40168. <td>none
  40169. <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>
  40170. <td>specified
  40171. <td>specified
  40172. <td>specified
  40173. <td>specified
  40174. <td>specified
  40175. <td>specified
  40176. <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>
  40177. <td>specified
  40178. <td>specified
  40179. <td>none
  40180. <td>none
  40181. <td>none
  40182. <td>none
  40183. <tr><td>name that exists with different top, not <a href=#familiar-with id=browsing-context-names:familiar-with-3>familiar</a>
  40184. <td>new
  40185. <td>new
  40186. <td>maybe new
  40187. <td>maybe new
  40188. <td>maybe new
  40189. <td>maybe new
  40190. </table>
  40191. <p class=tablenote><small>Most of the restrictions on sandboxed browsing contexts are applied by
  40192. 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
  40193. for choosing a browsing context given a browsing context name</a> given below.</small></p>
  40194. <hr>
  40195. <p>An algorithm is <dfn id=allowed-to-show-a-popup>allowed to show a popup</dfn> if any of the following conditions is
  40196. true:</p>
  40197. <ul><li><p>The <a href=#concept-task id=browsing-context-names:concept-task>task</a> in which the algorithm is running is currently
  40198. 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
  40199. was <a href=#concept-events-trusted id=browsing-context-names:concept-events-trusted>trusted</a>.<li>
  40200. <p>The <a href=#concept-task id=browsing-context-names:concept-task-2>task</a> in which the algorithm is running is currently
  40201. running the event listener for a <a href=#concept-events-trusted id=browsing-context-names:concept-events-trusted-2>trusted</a> event whose
  40202. type is in the following list:</p>
  40203. <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>
  40204. <li>
  40205. <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>,
  40206. and the chain of such algorithms started within a user-agent defined timeframe.</p>
  40207. <p class=example>For example, if a user clicked a button, it might be acceptable for a popup
  40208. to result from that after 4 seconds, but it would likely not be acceptable for a popup to result
  40209. from that after 4 hours.</p>
  40210. </ul>
  40211. <hr>
  40212. <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
  40213. 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
  40214. context</a>, as part of the execution of a <a href=#concept-task id=browsing-context-names:concept-task-4>task</a>.</p>
  40215. <ol><li>
  40216. <p>If the given browsing context name is the empty string or <code>_self</code>, then
  40217. the chosen browsing context must be the current one.</p>
  40218. <p>If the given browsing context name is <code>_self</code>, then this is an
  40219. <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
  40220. <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>
  40221. <li><p>If the given browsing context name is <code>_parent</code>, then the chosen
  40222. 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,
  40223. unless there isn't one, in which case the chosen browsing context must be the current browsing
  40224. context.<li><p>If the given browsing context name is <code>_top</code>, then the chosen browsing
  40225. 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,
  40226. or else the current browsing context.<li>
  40227. <p>If the given browsing context name is not <code>_blank</code> and there exists a
  40228. browsing context whose <a href=#browsing-context-name id=browsing-context-names:browsing-context-name>name</a> is the same as the given
  40229. browsing context name, and the current browsing context is <a href=#familiar-with id=browsing-context-names:familiar-with-4>familiar with</a> that
  40230. browsing context, and the user agent determines that the two browsing contexts are related
  40231. enough that it is ok if they reach each other, then that browsing context must be the chosen
  40232. one. If there are multiple matching browsing contexts, the user agent should select one in some
  40233. arbitrary consistent manner, such as the most recently opened, most recently focused, or more
  40234. closely related.</p>
  40235. <p>If the browsing context is chosen by this step to be the current browsing context, then this
  40236. is also an <a href=#explicit-self-navigation-override id=browsing-context-names:explicit-self-navigation-override-2>explicit self-navigation override</a>.</p>
  40237. <li>
  40238. <p>Otherwise, a new browsing context is being requested, and what happens depends on the user
  40239. agent's configuration and abilities — it is determined by the rules given for the first
  40240. applicable option from the following list:</p>
  40241. <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
  40242. user agent has been configured to not show popups (i.e. the user agent has a "popup blocker"
  40243. enabled)<dd>
  40244. <p>There is no chosen browsing context. The user agent may inform the user that a popup has
  40245. been blocked.</p>
  40246. <dt id=sandboxWindowOpen>If the current browsing context's <a href=#active-document id=browsing-context-names:active-document>active document</a>'s
  40247. <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
  40248. context flag</a> set.<dd>
  40249. <p>Typically, there is no chosen browsing context.</p>
  40250. <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
  40251. 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,
  40252. then the designated browsing context must be the chosen one (the browsing context's name isn't
  40253. set to the given browsing context name). The default behaviour (if the user agent doesn't
  40254. offer the option to the user, or if the user declines to allow a browsing context to be used)
  40255. must be that there must not be a chosen browsing context.</p>
  40256. <p class=warning>If this case occurs, it means that an author has explicitly sandboxed the
  40257. document that is trying to open a link.</p>
  40258. <dt id=noopener>If the user agent has been configured such that in this instance it will
  40259. 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
  40260. 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
  40261. context name is not <code>_blank</code>, then the new top-level browsing context's
  40262. name must be the given browsing context name (otherwise, it has no name). The chosen browsing
  40263. 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>
  40264. is <dfn id=a-new-start-for-session-storage>a new start for session storage</dfn>.</p>
  40265. <p class=note>If it is immediately <a href=#navigate id=browsing-context-names:navigate-2>navigated</a>, then the
  40266. 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
  40267. browsing context, and the <code id=browsing-context-names:link-type-noreferrer-2><a href=#link-type-noreferrer>noreferrer</a></code> keyword doesn't
  40268. 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
  40269. 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
  40270. browsing context name (otherwise, it has no name). The chosen browsing context must be this new
  40271. browsing context.</p>
  40272. <p class=note>If it is immediately <a href=#navigate id=browsing-context-names:navigate-3>navigated</a>, then the
  40273. 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
  40274. 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
  40275. browsing context<dd><p>There must not be a chosen browsing context.</dl>
  40276. <p>User agent implementors are encouraged to provide a way for users to configure the user agent
  40277. to always reuse the current browsing context.</p>
  40278. <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
  40279. 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
  40280. browsing context picked above, if any, is a new browsing context (whether top-level or
  40281. 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
  40282. 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
  40283. 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
  40284. 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
  40285. sandboxed navigator</a>.</p>
  40286. </ol>
  40287. <h3 id=the-window-object>7.2 The <code id=the-window-object:window><a href=#window>Window</a></code> object</h3>
  40288. <pre class=idl>[PrimaryGlobal]
  40289. /*sealed*/ interface <dfn id=window>Window</dfn> : <a href=#eventtarget id=the-window-object:eventtarget>EventTarget</a> {
  40290. // the current browsing context
  40291. [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>;
  40292. [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>;
  40293. [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>;
  40294. attribute DOMString <a href=#dom-name id=the-window-object:dom-name>name</a>;
  40295. [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>;
  40296. 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>;
  40297. [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>;
  40298. [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>;
  40299. [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>;
  40300. [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>;
  40301. [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>;
  40302. [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>;
  40303. attribute DOMString <a href=#dom-window-status id=the-window-object:dom-window-status>status</a>;
  40304. void <a href=#dom-window-close id=the-window-object:dom-window-close>close</a>();
  40305. readonly attribute boolean <a href=#dom-window-closed id=the-window-object:dom-window-closed>closed</a>;
  40306. void <a href=#dom-window-stop id=the-window-object:dom-window-stop>stop</a>();
  40307. void <a href=#dom-window-focus id=the-window-object:dom-window-focus>focus</a>();
  40308. void <a href=#dom-window-blur id=the-window-object:dom-window-blur>blur</a>();
  40309. // other browsing contexts
  40310. [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>;
  40311. [Replaceable] readonly attribute unsigned long <a href=#dom-length id=the-window-object:dom-length>length</a>;
  40312. [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>;
  40313. attribute any <a href=#dom-opener id=the-window-object:dom-opener>opener</a>;
  40314. 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>;
  40315. readonly attribute <a href=#element id=the-window-object:element>Element</a>? <a href=#dom-frameelement id=the-window-object:dom-frameelement>frameElement</a>;
  40316. <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);
  40317. <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);
  40318. <a href=#dom-window-nameditem id=the-window-object:dom-window-nameditem>getter</a> object (DOMString name);
  40319. // the user agent
  40320. readonly attribute <a href=#navigator id=the-window-object:navigator>Navigator</a> <a href=#dom-navigator id=the-window-object:dom-navigator>navigator</a>;
  40321. [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>;
  40322. readonly attribute <a href=#applicationcache id=the-window-object:applicationcache>ApplicationCache</a> <a href=#dom-applicationcache id=the-window-object:dom-applicationcache>applicationCache</a>;
  40323. // user prompts
  40324. void <a href=#dom-alert id=the-window-object:dom-alert>alert</a>();
  40325. void <a href=#dom-alert id=the-window-object:dom-alert-2>alert</a>(DOMString message);
  40326. boolean <a href=#dom-confirm id=the-window-object:dom-confirm>confirm</a>(optional DOMString message = "");
  40327. DOMString? <a href=#dom-prompt id=the-window-object:dom-prompt>prompt</a>(optional DOMString message = "", optional DOMString default = "");
  40328. void <a href=#dom-print id=the-window-object:dom-print>print</a>();
  40329. any <a href=#dom-showmodaldialog id=the-window-object:dom-showmodaldialog>showModalDialog</a>(DOMString url, optional any argument);
  40330. void <a href=#dom-window-postmessage id=the-window-object:dom-window-postmessage>postMessage</a>(any message, DOMString targetOrigin, optional sequence&lt;<a href=#transferable id=the-window-object:transferable>Transferable</a>> transfer);
  40331. // <a href="#Window-partial">also has obsolete members</a>
  40332. };
  40333. <a href=#window id=the-window-object:window-2>Window</a> implements <a href=#globaleventhandlers id=the-window-object:globaleventhandlers>GlobalEventHandlers</a>;
  40334. <a href=#window id=the-window-object:window-3>Window</a> implements <a href=#windoweventhandlers id=the-window-object:windoweventhandlers>WindowEventHandlers</a>;</pre>
  40335. <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>
  40336. <p>These attributes all return <var>window</var>.</p>
  40337. <dt><var>window</var> . <code id=the-window-object:dom-document-2-2><a href=#dom-document-2>document</a></code><dd>
  40338. <p>Returns the <code id=the-window-object:document-2><a href=#document>Document</a></code> associated with <var>window</var>.</p>
  40339. <dt><var>document</var> . <code id=the-window-object:dom-document-defaultview><a href=#dom-document-defaultview>defaultView</a></code><dd>
  40340. <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>
  40341. </dl>
  40342. <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>
  40343. 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
  40344. <code id=the-window-object:windowproxy-8><a href=#windowproxy>WindowProxy</a></code> object.</p>
  40345. <p>The <dfn id=dom-document-2><code>document</code></dfn> IDL attribute must return
  40346. <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>
  40347. <p>The <dfn id=dom-document-defaultview><code>defaultView</code></dfn> IDL attribute of the
  40348. <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
  40349. 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>
  40350. <hr>
  40351. <p>For historical reasons, <code id=the-window-object:window-6><a href=#window>Window</a></code> objects must also have a writable, configurable,
  40352. non-enumerable property named <dfn id=htmldocument><code>HTMLDocument</code></dfn> whose value is the
  40353. <code id=the-window-object:document-5><a href=#document>Document</a></code> interface object.</p>
  40354. <h4 id=security-window>7.2.1 Security</h4>
  40355. <p class=critical>This section describes a security model that is underdefined, imperfect, and
  40356. does not match implementations. Work is ongoing to attempt to resolve this, but in the meantime,
  40357. please do not rely on this section for precision. Implementors are urged to send their feedback on
  40358. 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
  40359. should work. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20701">bug 20701</a>.</p>
  40360. <p id=security-2>User agents must throw a <code id=security-window:securityerror><a href=#securityerror>SecurityError</a></code> exception whenever any
  40361. 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
  40362. 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
  40363. <code>Document</code></a>'s <a href=#effective-script-origin id=security-window:effective-script-origin-2>effective script origin</a>, with the following
  40364. exceptions:</p>
  40365. <ul><li>The <code id=security-window:dom-location><a href=#dom-location>location</a></code> attribute
  40366. <li>The <code id=security-window:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> method
  40367. <li>The <code id=security-window:dom-window><a href=#dom-window>window</a></code> attribute
  40368. <li>The <code id=security-window:dom-frames><a href=#dom-frames>frames</a></code> attribute
  40369. <li>The <code id=security-window:dom-self><a href=#dom-self>self</a></code> attribute
  40370. <li>The <code id=security-window:dom-top><a href=#dom-top>top</a></code> attribute
  40371. <li>The <code id=security-window:dom-parent><a href=#dom-parent>parent</a></code> attribute
  40372. <li>The <code id=security-window:dom-opener><a href=#dom-opener>opener</a></code> attribute
  40373. <li>The <code id=security-window:dom-window-closed><a href=#dom-window-closed>closed</a></code> attribute
  40374. <li>The <code id=security-window:dom-window-close><a href=#dom-window-close>close()</a></code> method
  40375. <li>The <code id=security-window:dom-window-blur><a href=#dom-window-blur>blur()</a></code> method
  40376. <li>The <code id=security-window:dom-window-focus><a href=#dom-window-focus>focus()</a></code> method
  40377. <li>The <a href=#dynamic-nested-browsing-context-properties id=security-window:dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>
  40378. </ul>
  40379. <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
  40380. origin</a> that is different than a <a href=#concept-document-window id=security-window:concept-document-window-2><code>Window</code>
  40381. 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
  40382. 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
  40383. 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
  40384. [[Enumerable]] attribute set to false.</p>
  40385. <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin id=security-window:effective-script-origin-5>effective
  40386. script origin</a> that is not the same as the <code id=security-window:window-5><a href=#window>Window</a></code> object's
  40387. <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
  40388. of objects. These objects must have the prototype chain appropriate for the script for which the
  40389. objects are created (not those that would be appropriate for scripts whose <a href=#global-object id=security-window:global-object>global
  40390. 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>
  40391. object in question).</p>
  40392. <div class=example>
  40393. <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
  40394. are not equal.</p>
  40395. </div>
  40396. <h4 id=apis-for-creating-and-navigating-browsing-contexts-by-name>7.2.2 APIs for creating and navigating browsing contexts by name</h4>
  40397. <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>
  40398. <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
  40399. returns it. The <var>target</var> argument gives the name of the new window. If a
  40400. window exists with that name already, it is reused. The <var>replace</var> attribute,
  40401. if true, means that whatever page is currently open in that window will be removed from the
  40402. 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>
  40403. <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>
  40404. <p>Returns the name of the window.</p>
  40405. <p>Can be set, to change the name.</p>
  40406. <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>
  40407. <p>Closes the window.</p>
  40408. <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>
  40409. <p>Returns true if the window has been closed, false otherwise.</p>
  40410. <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>
  40411. <p>Cancels the document load.</p>
  40412. </dl>
  40413. <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
  40414. 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
  40415. 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>
  40416. <p>The method has four arguments, though they are all optional.</p>
  40417. <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
  40418. 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
  40419. 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
  40420. 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
  40421. object</a> when the method was invoked.</p>
  40422. <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
  40423. browsing context name or keyword</a>.</p>
  40424. <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
  40425. defined in the CSSOM View specification. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></p>
  40426. <p>The fourth argument, <var>replace</var>, specifies whether or not the new page will
  40427. <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
  40428. context, when <var>target</var> identifies an existing browsing context (as opposed to
  40429. 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>
  40430. <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
  40431. 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
  40432. 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
  40433. context</a> of the script as the context in which the algorithm is executed, unless the user
  40434. has indicated a preference, in which case the browsing context to navigate may instead be the one
  40435. indicated by the user.</p>
  40436. <p class=example>For example, suppose there is a user agent that supports control-clicking a
  40437. 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
  40438. the control key down, the user agent could override the selection of the target browsing context
  40439. to instead target a new tab.</p>
  40440. <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
  40441. name</a> using the <var>target</var> argument would result in there not being a chosen
  40442. 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
  40443. steps.</p>
  40444. <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
  40445. <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
  40446. <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
  40447. 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
  40448. <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
  40449. 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
  40450. 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>
  40451. 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
  40452. 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
  40453. 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>
  40454. <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
  40455. 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
  40456. 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
  40457. <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
  40458. <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>
  40459. <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>
  40460. that was navigated, or null if no browsing context was navigated.</p>
  40461. <hr>
  40462. <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
  40463. 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
  40464. <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
  40465. 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
  40466. new value.</p>
  40467. <p class=note>The name <a href=#resetBCName>gets reset</a> when the browsing context is
  40468. navigated to another domain.</p>
  40469. <hr>
  40470. <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>
  40471. 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>:
  40472. <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
  40473. <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
  40474. 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
  40475. <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
  40476. context</a> <var>A</var>.</ul>
  40477. <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
  40478. browsing context</a> that was created by a script (as opposed to by an action of the user), or
  40479. 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
  40480. only one <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:document><a href=#document>Document</a></code>.</p>
  40481. <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>
  40482. 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
  40483. 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>
  40484. <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>
  40485. 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
  40486. 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>
  40487. 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
  40488. 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>
  40489. <h4 id=accessing-other-browsing-contexts>7.2.3 Accessing other browsing contexts</h4>
  40490. <dl class=domintro><dt><var>window</var> . <code id=accessing-other-browsing-contexts:dom-length><a href=#dom-length>length</a></code><dd>
  40491. <p>Returns the number of <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context>child browsing
  40492. contexts</a>.</p>
  40493. <dt><var>window</var>[<var>index</var>]<dd>
  40494. <p>Returns the indicated <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context-2>child browsing context</a>.</p>
  40495. </dl>
  40496. <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>
  40497. interface must return the number of <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context-3>child browsing
  40498. contexts</a> that are <a href=#browsing-context-nested-through id=accessing-other-browsing-contexts:browsing-context-nested-through>nested through</a>
  40499. 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
  40500. <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
  40501. <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
  40502. 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;
  40503. otherwise, it must return zero.</p>
  40504. <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
  40505. 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
  40506. 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
  40507. indices</a>.</p>
  40508. <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
  40509. <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
  40510. 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
  40511. <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
  40512. <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
  40513. <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>
  40514. <p>These properties are the <dfn id=dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</dfn>.</p>
  40515. <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>
  40516. <dl class=domintro><dt><var>window</var>[<var>name</var>]<dd>
  40517. <p>Returns the indicated element or collection of elements.</p>
  40518. <p>As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to
  40519. this API can vary over time, as new features are added to the Web platform, for example. Instead
  40520. of this, use <code>document.getElementById()</code> or <code>document.querySelector()</code>.</p>
  40521. </dl>
  40522. <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
  40523. 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
  40524. following, in <a href=#tree-order id=named-access-on-the-window-object:tree-order>tree order</a>, ignoring later duplicates:</p>
  40525. <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
  40526. <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>,
  40527. <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>,
  40528. <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
  40529. 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>
  40530. <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
  40531. retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>
  40532. <ol><li>
  40533. <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>
  40534. in the <a href=#active-document id=named-access-on-the-window-object:active-document-4>active document</a>.
  40535. <p class=note>There will be at least one such object, by definition.</p>
  40536. <li>
  40537. <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
  40538. 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
  40539. 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
  40540. <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>
  40541. <li>
  40542. <p>Otherwise, if <var>objects</var> has only one element, return that element and
  40543. abort these steps.</p>
  40544. <li>
  40545. <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,
  40546. 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
  40547. the name <var>name</var>. (By definition, these will all be elements.)</p>
  40548. </ol>
  40549. <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>
  40550. <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
  40551. 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>,
  40552. <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
  40553. 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
  40554. whose value is <var>name</var>.</ul>
  40555. <h4 id=garbage-collection-and-browsing-contexts>7.2.5 Garbage collection and browsing contexts</h4>
  40556. <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
  40557. 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
  40558. <a href=#top-level-browsing-context id=garbage-collection-and-browsing-contexts:top-level-browsing-context>top-level browsing contexts</a>.</p>
  40559. <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>
  40560. <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
  40561. 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
  40562. 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>
  40563. objects have <a href=#implied-strong-reference id=garbage-collection-and-browsing-contexts:implied-strong-reference-2>implied strong references</a> to the
  40564. <code id=garbage-collection-and-browsing-contexts:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object.</p>
  40565. <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
  40566. 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
  40567. <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
  40568. document</a>.</p>
  40569. <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
  40570. agent must run the following steps:</p>
  40571. <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
  40572. 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
  40573. <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>
  40574. to the <code id=garbage-collection-and-browsing-contexts:document-10><a href=#document>Document</a></code>.</ol>
  40575. <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
  40576. <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>
  40577. <p>When <dfn id=a-browsing-context-is-discarded>a <em>browsing context</em> is discarded</dfn>, the strong reference from the user
  40578. 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
  40579. <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
  40580. history must be <a href=#discard-a-document id=garbage-collection-and-browsing-contexts:discard-a-document-2>discarded</a> as well.</p>
  40581. <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
  40582. 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
  40583. <code id=garbage-collection-and-browsing-contexts:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage collection.</p>
  40584. <h4 id=closing-browsing-contexts>7.2.6 Closing browsing contexts</h4>
  40585. <p>When the user agent is required to <dfn id=close-a-browsing-context>close a browsing context</dfn>, it must run the
  40586. following steps:</p>
  40587. <ol><li><p>Let <var>specified browsing context</var> be the <a href=#browsing-context id=closing-browsing-contexts:browsing-context>browsing context</a>
  40588. 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
  40589. 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
  40590. 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
  40591. false.<li><p>Remove the <var>specified browsing context</var> from the user interface (e.g.
  40592. 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
  40593. browsing context</var>.</ol>
  40594. <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>
  40595. <h4 id=browser-interface-elements>7.2.7 Browser interface elements</h4>
  40596. <p>To allow Web pages to integrate with Web browsers, certain Web browser interface elements are
  40597. exposed in a limited way to scripts in Web pages.</p>
  40598. <p>Each interface element is represented by a <code id=browser-interface-elements:barprop><a href=#barprop>BarProp</a></code> object:</p>
  40599. <pre class=idl>interface <dfn id=barprop>BarProp</dfn> {
  40600. attribute boolean <a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible>visible</a>;
  40601. };</pre>
  40602. <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>
  40603. <p>Returns true if the location bar is visible; otherwise, returns false.</p>
  40604. <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>
  40605. <p>Returns true if the menu bar is visible; otherwise, returns false.</p>
  40606. <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>
  40607. <p>Returns true if the personal bar is visible; otherwise, returns false.</p>
  40608. <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>
  40609. <p>Returns true if the scroll bars are visible; otherwise, returns false.</p>
  40610. <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>
  40611. <p>Returns true if the status bar is visible; otherwise, returns false.</p>
  40612. <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>
  40613. <p>Returns true if the toolbar is visible; otherwise, returns false.</p>
  40614. </dl>
  40615. <p>The <dfn id=dom-barprop-visible>visible</dfn> attribute, on getting, must return either
  40616. true or a value determined by the user agent to most accurately represent the visibility state of
  40617. the user interface element that the object represents, as described below. On setting, the new
  40618. value must be discarded.</p>
  40619. <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
  40620. <a href=#browsing-context id=browser-interface-elements:browsing-context>browsing context</a>. Some of the user interface elements represented by these objects
  40621. might have no equivalent in some user agents; for those user agents, except when otherwise
  40622. 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>
  40623. <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
  40624. <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
  40625. 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
  40626. 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
  40627. 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
  40628. appropriate for the user's media, which typically provides information about ongoing network
  40629. activity or information about elements that the user's pointing device is current indicating. If
  40630. the user agent has no such user interface element, then the object may act as if the
  40631. 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
  40632. appropriate for the user's media, which typically provides <a href=#session-history id=browser-interface-elements:session-history>session history</a> traversal
  40633. controls (back and forward buttons, reload buttons, etc). If the user agent has no such user
  40634. interface element, then the object may act as if the corresponding user interface element was
  40635. absent (i.e. its <code id=browser-interface-elements:dom-barprop-visible-10><a href=#dom-barprop-visible>visible</a></code> attribute may return
  40636. false).</dl>
  40637. <p>The <dfn id=dom-window-locationbar><code>locationbar</code></dfn> attribute must return
  40638. <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>
  40639. <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
  40640. menu bar <code>BarProp</code> object</a>.</p>
  40641. <p>The <dfn id=dom-window-personalbar><code>personalbar</code></dfn> attribute must return
  40642. <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>
  40643. <p>The <dfn id=dom-window-scrollbars><code>scrollbars</code></dfn> attribute must return
  40644. <a href=#the-scrollbar-barprop-object id=browser-interface-elements:the-scrollbar-barprop-object>the scrollbar <code>BarProp</code> object</a>.</p>
  40645. <p>The <dfn id=dom-window-statusbar><code>statusbar</code></dfn> attribute must return
  40646. <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>
  40647. <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
  40648. toolbar <code>BarProp</code> object</a>.</p>
  40649. <hr>
  40650. <p>For historical reasons, the <dfn id=dom-window-status><code>status</code></dfn> attribute
  40651. 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
  40652. 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
  40653. attribute must be set to the empty string. It does not do anything else.</p>
  40654. <h4 id=the-windowproxy-object>7.2.8 The <code id=the-windowproxy-object:windowproxy><a href=#windowproxy>WindowProxy</a></code> object</h4>
  40655. <p>As mentioned earlier, each <a href=#browsing-context id=the-windowproxy-object:browsing-context>browsing context</a> has a
  40656. <dfn id=windowproxy><code>WindowProxy</code></dfn> object. This object is unusual in that all operations that
  40657. 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
  40658. context</a>'s <a href=#active-document id=the-windowproxy-object:active-document>active document</a> instead. It is thus indistinguishable from that
  40659. <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>
  40660. <p>There is no <code id=the-windowproxy-object:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> interface object.</p>
  40661. <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
  40662. <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
  40663. 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>
  40664. <div class=example>
  40665. <p>In the following example, the variable <var>x</var> is set to the
  40666. <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
  40667. on the global object. All of the expressions following the assignment return true, because in
  40668. 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>
  40669. object.</p>
  40670. <pre>var x = window;
  40671. x instanceof Window; // true
  40672. x === this; // true</pre>
  40673. </div>
  40674. <h3 id=origin>7.3 Origin</h3>
  40675. <p>Origins are the fundamental currency of the Web's security model. Two actors in the Web
  40676. platform that share an origin are assumed to trust each other and to have the same authority.
  40677. Actors with differing origins are considered potentially hostile versus each other, and are
  40678. isolated from each other to varying degrees.</p>
  40679. <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
  40680. at <code>charity.example.org</code>, a <code id=origin:securityerror><a href=#securityerror>SecurityError</a></code> exception will be
  40681. raised.</p>
  40682. <hr>
  40683. <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
  40684. are both either opaque identifiers or tuples consisting of a scheme component, a host component, a
  40685. port component, and optionally extra data.</p>
  40686. <p class=note>The extra data could include the certificate of the site when using encrypted
  40687. connections, to ensure that if the site's secure certificate changes, the origin is considered to
  40688. change as well.</p>
  40689. <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
  40690. 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
  40691. 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
  40692. an alias.</p>
  40693. <p>These characteristics are defined as follows:</p>
  40694. <dl><dt>For URLs<dd>
  40695. <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
  40696. the origin defined in <cite>The Web Origin Concept</cite>. <a href=#refsORIGIN>[ORIGIN]</a></p>
  40697. <dt>For <code id=origin:document><a href=#document>Document</a></code> objects<dd>
  40698. <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
  40699. its <a href=#sandboxed-origin-browsing-context-flag id=origin:sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</a> set<dd>
  40700. <p>The <a href=#origin-2 id=origin:origin-2-6>origin</a> is a globally unique identifier assigned when the
  40701. <code id=origin:document-3><a href=#document>Document</a></code> is created.</p>
  40702. <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
  40703. <code id=origin:document-4><a href=#document>Document</a></code>.</p>
  40704. <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
  40705. scheme with a server-based naming authority<dd>
  40706. <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
  40707. <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>
  40708. <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
  40709. <code id=origin:document-6><a href=#document>Document</a></code>.</p>
  40710. <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
  40711. script<dd>
  40712. <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
  40713. <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>
  40714. algorithm was invoked, or, if no <a href=#concept-script id=origin:concept-script>script</a> was involved, of
  40715. 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>
  40716. <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
  40717. 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>
  40718. <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>
  40719. <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
  40720. <code id=origin:document-11><a href=#document>Document</a></code> are <a href=#about-blank-origin>those it was assigned when its
  40721. browsing context was created</a>.</p>
  40722. <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>
  40723. <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
  40724. <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>
  40725. being navigated when the <a href=#navigate id=origin:navigate-3>navigate</a> algorithm was invoked.</p>
  40726. <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
  40727. same <code id=origin:document-13><a href=#document>Document</a></code>.</p>
  40728. <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>
  40729. <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
  40730. <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
  40731. 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>
  40732. <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
  40733. <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
  40734. 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>
  40735. <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
  40736. location of an HTTP redirect (<a href=#concept-http-equivalent-codes id=origin:concept-http-equivalent-codes>or equivalent</a>
  40737. 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>
  40738. <p>The default behavior as defined in the DOM standard applies. <a href=#refsDOM>[DOM]</a>.</p>
  40739. <p class=note>The <a href=#origin-2 id=origin:origin-2-18>origin</a> is a globally unique identifier assigned when the
  40740. <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
  40741. <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
  40742. <code id=origin:document-21><a href=#document>Document</a></code>.</p>
  40743. </dl>
  40744. <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
  40745. manipulated using the <code id=origin:dom-document-domain><a href=#dom-document-domain>document.domain</a></code> IDL
  40746. attribute.</p>
  40747. <dt>For images of <code id=origin:the-img-element><a href=#the-img-element>img</a></code> elements<dd>
  40748. <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
  40749. 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
  40750. <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>
  40751. <p>Images do not have an <a href=#effective-script-origin id=origin:effective-script-origin-17>effective script origin</a>.</p>
  40752. <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>
  40753. <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
  40754. 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
  40755. <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>
  40756. <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
  40757. origin</a>.</p>
  40758. <dt>For fonts<dd>
  40759. <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
  40760. URL</a> used to obtain the font (after any redirects). <a href=#refsCSSFONTS>[CSSFONTS]</a>
  40761. <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
  40762. <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
  40763. <code id=origin:document-23><a href=#document>Document</a></code> in which that font is being used.</p>
  40764. <p>Fonts do not have an <a href=#effective-script-origin id=origin:effective-script-origin-19>effective script origin</a>.</p>
  40765. </dl>
  40766. <p>Other specifications can override the above definitions by themselves specifying the origin of
  40767. 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
  40768. font.</p>
  40769. <hr>
  40770. <p>The <dfn id=unicode-serialisation-of-an-origin>Unicode serialisation of an origin</dfn> is the string obtained by applying the
  40771. following algorithm to the given <a href=#origin-2 id=origin:origin-2-30>origin</a>:</p>
  40772. <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
  40773. 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>
  40774. 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
  40775. part of the <a href=#origin-2 id=origin:origin-2-33>origin</a> tuple, and append the results — each component, in the same
  40776. 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
  40777. 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
  40778. append a U+003A COLON character (:) and the given port, in base ten, to <var>result</var>.<li><p>Return <var>result</var>.</ol>
  40779. <p>The <dfn id=ascii-serialisation-of-an-origin>ASCII serialisation of an origin</dfn> is the string obtained by applying the
  40780. following algorithm to the given <a href=#origin-2 id=origin:origin-2-36>origin</a>:</p>
  40781. <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
  40782. 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>
  40783. tuple.<li><p>Append the string "<code>://</code>" to <var>result</var>.<li>
  40784. <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
  40785. the <a href=#origin-2 id=origin:origin-2-39>origin</a> tuple, and append the results — each component, in the same order,
  40786. separated by U+002E FULL STOP characters (.) — to <var>result</var>. <a href=#refsURL>[URL]</a></p>
  40787. <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
  40788. convert one of the components of the string, e.g. because it is too long or because it contains
  40789. 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>
  40790. <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
  40791. 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
  40792. append a U+003A COLON character (:) and the given port, in base ten, to <var>result</var>.<li><p>Return <var>result</var>.</ol>
  40793. <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
  40794. following algorithm returns true:</p>
  40795. <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
  40796. value is equal, then return true.<li><p>Otherwise, if either <var>A</var> or <var>B</var> or both are opaque
  40797. identifiers, return false.<li><p>If <var>A</var> and <var>B</var> have scheme components that are not
  40798. identical, return false.<li><p>If <var>A</var> and <var>B</var> have host components that are not
  40799. identical, return false.<li><p>If <var>A</var> and <var>B</var> have port components that are not
  40800. identical, return false.<li><p>If either <var>A</var> or <var>B</var> have additional data, but that
  40801. data is not identical for both, return false.<li><p>Return true.</ol>
  40802. <h4 id=relaxing-the-same-origin-restriction>7.3.1 Relaxing the same-origin restriction</h4>
  40803. <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>
  40804. <p>Returns the current domain used for security checks.</p>
  40805. <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
  40806. origin</a> to allow pages on other subdomains of the same domain (if they do the same thing)
  40807. 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>
  40808. </dl>
  40809. <p>The <dfn id=dom-document-domain><code>domain</code></dfn> attribute on
  40810. <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
  40811. 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
  40812. LEFT SQUARE BRACKET character ([) and ends with a U+005D RIGHT SQUARE BRACKET character (]), it is
  40813. an IPv6 address; these square brackets must be omitted when initializing the attribute's
  40814. value.</p>
  40815. <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
  40816. 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>
  40817. <p>On setting, the user agent must run the following algorithm:</p>
  40818. <ol><li>
  40819. <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
  40820. <code id=relaxing-the-same-origin-restriction:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
  40821. <li>
  40822. <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
  40823. <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
  40824. 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>
  40825. <li>
  40826. <p>If the new value is an IPv4 or IPv6 address, let <var>new value</var> be the new
  40827. value.</p>
  40828. <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
  40829. 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
  40830. returned token, and let <var>new value</var> be the result of concatenating the
  40831. results of applying that algorithm to each token, in the same order, separated by U+002E FULL
  40832. STOP characters (.). <a href=#refsURL>[URL]</a></p>
  40833. <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
  40834. convert one of the components of the string, e.g. because it is too long or because it contains
  40835. 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>
  40836. <li>
  40837. <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>
  40838. <ol><li>
  40839. <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>
  40840. exception and abort these steps.</p>
  40841. <li>
  40842. <p>If <var>new value</var>, prefixed by a U+002E FULL STOP (.), does not exactly
  40843. 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
  40844. these steps.</p>
  40845. <p class=note>If the <var>new value</var> is an IPv4 or IPv6 address, it cannot
  40846. match the <var>new value</var> in this way and thus an exception will be thrown
  40847. here.</p>
  40848. <li>
  40849. <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
  40850. 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
  40851. steps. <a href=#refsPSL>[PSL]</a></p>
  40852. <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
  40853. 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>
  40854. </ol>
  40855. <li><p>Release the <a href=#storage-mutex id=relaxing-the-same-origin-restriction:storage-mutex>storage mutex</a>.<li>
  40856. <p>Set the attribute's value to <var>new value</var>.</p>
  40857. <li>
  40858. <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
  40859. 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>
  40860. <li>
  40861. <p>If <var>new value</var> is not the empty string, then run these substeps:</p>
  40862. <ol><li>
  40863. <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
  40864. <code id=relaxing-the-same-origin-restriction:document-6><a href=#document>Document</a></code> to <var>new value</var>.</p>
  40865. <li>
  40866. <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
  40867. <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
  40868. identical to any other value).</p>
  40869. </ol>
  40870. </ol>
  40871. <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
  40872. 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
  40873. scheme/host/port tuple. If it isn't, then the document does not have a domain.</p>
  40874. <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
  40875. pages on different hosts of a domain to access each others' DOMs.</p>
  40876. <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>
  40877. attribute when using shared hosting. If an untrusted third party is able to host an HTTP server at
  40878. the same IP address but on a different port, then the same-origin protection that normally
  40879. protects two different sites on the same host will fail, as the ports are ignored when comparing
  40880. 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
  40881. used.</p>
  40882. <h3 id=sandboxing>7.4 Sandboxing</h3>
  40883. <p>A <dfn id=sandboxing-flag-set>sandboxing flag set</dfn> is a set of zero or more of the following flags, which are
  40884. used to restrict the abilities that potentially untrusted resources have:</p>
  40885. <dl><dt>The <dfn id=sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</dfn><dd>
  40886. <p>This flag <a href=#sandboxLinks>prevents content from navigating browsing contexts other
  40887. than the sandboxed browsing context itself</a> (or browsing contexts further nested inside it),
  40888. <a href=#auxiliary-browsing-context id=sandboxing:auxiliary-browsing-context>auxiliary browsing contexts</a> (which are protected
  40889. 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
  40890. <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
  40891. navigation browsing context flag</a> defined below).</p>
  40892. <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
  40893. 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
  40894. when the browsing context is created, which allows the <a href=#browsing-context id=sandboxing:browsing-context-2>browsing context</a> that
  40895. 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
  40896. context flag</a> would prevent them from being navigated even if they were opened.)</p>
  40897. <dt>The <dfn id=sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</dfn><dd>
  40898. <p>This flag <a href=#sandboxWindowOpen>prevents content from creating new auxiliary browsing
  40899. contexts</a>, e.g. using the <code id=sandboxing:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, the
  40900. <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>
  40901. <dt>The <dfn id=sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</dfn><dd>
  40902. <p>This flag <a href=#sandboxLinks>prevents content from navigating their <span>top-level
  40903. browsing context</span></a> and <a href=#sandboxClose>prevents content from closing their
  40904. <span>top-level browsing context</span></a>.</p>
  40905. <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>
  40906. 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
  40907. 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
  40908. browsing context flag</a>.</p>
  40909. <dt>The <dfn id=sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</dfn><dd>
  40910. <p>This flag prevents content from instantiating <a href=#plugin id=sandboxing:plugin>plugins</a>, whether
  40911. 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
  40912. 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>
  40913. <dt>The <dfn id=sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</dfn><dd>
  40914. <p>This flag prevents content from using the <code id=sandboxing:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>
  40915. attribute on descendant <code id=sandboxing:the-iframe-element><a href=#the-iframe-element>iframe</a></code> elements.</p>
  40916. <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
  40917. CSS-selector-based method of probing the DOM of other pages on the same site (in particular,
  40918. pages that contain user-sensitive information).</p>
  40919. <dt>The <dfn id=sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</dfn><dd>
  40920. <p>This flag <a href=#sandboxOrigin>forces content into a unique origin</a>, thus preventing
  40921. it from accessing other content from the same <a href=#origin-2 id=sandboxing:origin-2>origin</a>.</p>
  40922. <p>This flag also <a href=#sandboxCookies>prevents script from reading from or writing to the
  40923. <code>document.cookie</code> IDL attribute</a>, and blocks access to
  40924. <code id=sandboxing:dom-localstorage><a href=#dom-localstorage>localStorage</a></code>.</p>
  40925. <dt>The <dfn id=sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</dfn><dd>
  40926. <p>This flag <a href=#sandboxSubmitBlocked>blocks form submission</a>.</p>
  40927. <dt>The <dfn id=sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag</dfn><dd>
  40928. <p>This flag disables the Pointer Lock API. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>
  40929. <dt>The <dfn id=sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</dfn><dd>
  40930. <p>This flag <a href=#sandboxScriptBlocked>blocks script execution</a>.</p>
  40931. <dt>The <dfn id=sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</dfn><dd>
  40932. <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>
  40933. <dt>The <dfn id=sandboxed-storage-area-urls-flag>sandboxed storage area URLs flag</dfn><dd>
  40934. <p>This flag prevents URL schemes that use storage areas from being able to access the origin's
  40935. data.</p>
  40936. <dt>The <dfn id=sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context flag</dfn><dd>
  40937. <p>This flag prevents content from using the <code id=sandboxing:dom-element-requestfullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code> method.</p>
  40938. <dt>The <dfn id=sandboxed-document.domain-browsing-context-flag>sandboxed <code>document.domain</code> browsing context flag</dfn><dd>
  40939. <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
  40940. origin</a>.</p>
  40941. </dl>
  40942. <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
  40943. optionally an <var>allow fullscreen flag</var>, it must run the following steps:</p>
  40944. <ol><li><p><a href=#split-a-string-on-spaces id=sandboxing:split-a-string-on-spaces>Split <var>input</var> on spaces</a>,
  40945. to obtain <var>tokens</var>.<li><p>Let <var>output</var> be empty.<li>
  40946. <p>Add the following flags to <var>output</var>:</p>
  40947. <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>
  40948. 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>
  40949. <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>
  40950. keyword.</p>
  40951. <div class=note>
  40952. <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
  40953. is intended for two cases.</p>
  40954. <p>First, it can be used to allow content from the same site to be sandboxed to disable
  40955. scripting, while still allowing access to the DOM of the sandboxed content.</p>
  40956. <p>Second, it can be used to embed content from a third-party site, sandboxed to prevent that
  40957. site from opening pop-up windows, etc, without preventing the embedded page from
  40958. communicating back to its originating site, using the database APIs to store data, etc.</p>
  40959. </div>
  40960. <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>
  40961. 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>
  40962. <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>
  40963. <p class=note>This flag is relaxed by the same keyword as scripts, because when scripts are
  40964. enabled these features are trivially possible anyway, and it would be unfortunate to force
  40965. authors to use script to do them when sandboxed rather than allowing them to use the
  40966. declarative features.</p>
  40967. <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
  40968. 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
  40969. context flag</a>.</ul>
  40970. </ol>
  40971. <hr>
  40972. <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
  40973. 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
  40974. <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
  40975. choosing a browsing context given a browsing context name</a>.</p>
  40976. <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
  40977. 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
  40978. 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
  40979. 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>
  40980. <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
  40981. <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
  40982. sandboxing flag set</a> must be empty. It is populated by the <a href=#navigate id=sandboxing:navigate>navigation
  40983. algorithm</a>.</p>
  40984. <p>Every resource that is obtained by the <a href=#navigate id=sandboxing:navigate-2>navigation algorithm</a> has a
  40985. <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
  40986. 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
  40987. can define that certain flags are set.</p>
  40988. <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
  40989. Security Policy specification. <a href=#refsCSP>[CSP]</a></p>
  40990. <hr>
  40991. <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
  40992. 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
  40993. the flags that are present in the following <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-6>sandboxing flag
  40994. sets</a> at the time the <code id=sandboxing:document-5><a href=#document>Document</a></code> object is created:</p>
  40995. <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
  40996. 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
  40997. 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
  40998. context</a>, then: the flags set on the <a href=#browsing-context id=sandboxing:browsing-context-8>browsing context</a>'s
  40999. <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
  41000. 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
  41001. 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
  41002. set</a>, if it has one.</ul>
  41003. <h3 id=history>7.5 Session history and navigation</h3>
  41004. <h4 id=the-session-history-of-browsing-contexts>7.5.1 The session history of browsing contexts</h4>
  41005. <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
  41006. 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
  41007. 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
  41008. 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
  41009. 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
  41010. associated with it.</p>
  41011. <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
  41012. <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
  41013. <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
  41014. 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
  41015. <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
  41016. itself having to reactivate that <code id=the-session-history-of-browsing-contexts:document-6><a href=#document>Document</a></code>.</p>
  41017. <p class=note>Titles associated with <a href=#session-history-entry id=the-session-history-of-browsing-contexts:session-history-entry-3>session history
  41018. 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
  41019. <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
  41020. the state of the document at that point, so that the user can navigate the document's history.</p>
  41021. <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
  41022. session history as the user (or script) navigates from page to page.</p>
  41023. <hr>
  41024. <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
  41025. 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
  41026. same underlying <a href=#session-history id=the-session-history-of-browsing-contexts:session-history-2>session history</a>.</p>
  41027. <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>
  41028. 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
  41029. <code>Document</code></a>.</p>
  41030. <hr>
  41031. <p>A <dfn id=state-object>state object</dfn> is an object representing a user interface state.</p>
  41032. <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
  41033. 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
  41034. script</a> when the user (or script) goes back in the history, thus enabling authors to use the
  41035. "navigation" metaphor even in one-page applications.</p>
  41036. <div class=note>
  41037. <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:
  41038. 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
  41039. case an author doesn't have to do the parsing (though one would still need the parsing for
  41040. 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
  41041. optimization), and second, so that the author can store state that one wouldn't store in the URL
  41042. 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
  41043. reconstructed if a new <code id=the-session-history-of-browsing-contexts:document-10><a href=#document>Document</a></code> were opened.</p>
  41044. <p>An example of the latter would be something like keeping track of the precise coordinate from
  41045. 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
  41046. made to animate to the same location. Or alternatively, it could be used to keep a pointer into a
  41047. cache of data that would be fetched from the server based on the information in the
  41048. <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
  41049. again.</p>
  41050. </div>
  41051. <hr>
  41052. <p>At any point, one of the entries in the session history is the <dfn id=current-entry>current entry</dfn>. This
  41053. 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>.
  41054. 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
  41055. specification, e.g. during <a href=#traverse-the-history id=the-session-history-of-browsing-contexts:traverse-the-history>session history
  41056. traversal</a>.</p>
  41057. <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
  41058. 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
  41059. document.</p>
  41060. <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.
  41061. This specification does not specify what kind of state can be stored.</p>
  41062. <p class=example>For example, some user agents might want to persist the scroll position, or the
  41063. values of form controls.</p>
  41064. <p class=note>User agents that persist the value of form controls are encouraged to also persist
  41065. 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).
  41066. This prevents values from being displayed incorrectly after a history traversal when the user had
  41067. originally entered the values with an explicit, non-default directionality.</p>
  41068. <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
  41069. <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>
  41070. <p>Contiguous entries that differ just by fragment identifier also share the same
  41071. <code id=the-session-history-of-browsing-contexts:document-13><a href=#document>Document</a></code>.</p>
  41072. <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
  41073. merely different states of one particular document) are contiguous by definition.</p>
  41074. <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
  41075. 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
  41076. 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>
  41077. <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>
  41078. 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
  41079. script, reloading the pages afresh when the user or script navigates back to such pages. This
  41080. 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
  41081. when they should cache them.</p>
  41082. <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
  41083. the algorithms given below, act as if they had not. When the user or script navigates back or
  41084. forwards to a page which has no in-memory DOM objects, any other entries that shared the same
  41085. <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>
  41086. <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>
  41087. <pre class=idl>interface <dfn id=history-3>History</dfn> {
  41088. readonly attribute long <a href=#dom-history-length id=the-history-interface:dom-history-length>length</a>;
  41089. readonly attribute any <a href=#dom-history-state id=the-history-interface:dom-history-state>state</a>;
  41090. void <a href=#dom-history-go id=the-history-interface:dom-history-go>go</a>(optional long delta);
  41091. void <a href=#dom-history-back id=the-history-interface:dom-history-back>back</a>();
  41092. void <a href=#dom-history-forward id=the-history-interface:dom-history-forward>forward</a>();
  41093. void <a href=#dom-history-pushstate id=the-history-interface:dom-history-pushstate>pushState</a>(any data, DOMString title, optional DOMString? url = null);
  41094. void <a href=#dom-history-replacestate id=the-history-interface:dom-history-replacestate>replaceState</a>(any data, DOMString title, optional DOMString? url = null);
  41095. };</pre>
  41096. <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>
  41097. <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>
  41098. <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>
  41099. <p>Returns the current <a href=#state-object id=the-history-interface:state-object>state object</a>.</p>
  41100. <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>
  41101. <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>
  41102. <p>A zero delta will reload the current page.</p>
  41103. <p>If the delta is out of range, does nothing.</p>
  41104. <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>
  41105. <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>
  41106. <p>If there is no previous page, does nothing.</p>
  41107. <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>
  41108. <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>
  41109. <p>If there is no next page, does nothing.</p>
  41110. <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>
  41111. <p>Pushes the given data onto the session history, with the given title, and, if provided and
  41112. not null, the given URL.</p>
  41113. <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>
  41114. <p>Updates the current entry in the session history to have the given data, title, and, if
  41115. provided and not null, URL.</p>
  41116. </dl>
  41117. <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
  41118. 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>
  41119. 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
  41120. <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
  41121. history</a>.</p>
  41122. <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
  41123. 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>
  41124. <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
  41125. were added to their respective <a href=#session-history id=the-history-interface:session-history-4>session histories</a>. Each entry
  41126. has an index; the earliest entry has index 0, and the subsequent entries are numbered with
  41127. consecutively increasing integers (1, 2, 3, etc).</p>
  41128. <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
  41129. 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
  41130. 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,
  41131. so their precise order might not be well-defined; similarly, since they might only find out about
  41132. 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
  41133. history</a>.</p>
  41134. <p>All the getters and setters for attributes, and all the methods, defined on the
  41135. <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
  41136. <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
  41137. <code id=the-history-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception instead of operating as described below.</p>
  41138. <p>The <dfn id=dom-history-length><code>length</code></dfn> attribute of the
  41139. <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
  41140. context</a>'s <a href=#joint-session-history id=the-history-interface:joint-session-history-8>joint session history</a>.</p>
  41141. <p>The actual entries are not accessible from script.</p>
  41142. <p>The <dfn id=dom-history-state><code>state</code></dfn> attribute of the
  41143. <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.
  41144. Initially, its value must be null.</p>
  41145. <p>When the <dfn id=dom-history-go><code>go(<var>delta</var>)</code></dfn> method is
  41146. invoked, if the argument to the method was omitted or has the value zero, the user agent must act
  41147. as if the <code id=the-history-interface:dom-location-reload><a href=#dom-location-reload>location.reload()</a></code> method was called instead.
  41148. 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
  41149. value of the method's argument.</p>
  41150. <p>When the <dfn id=dom-history-back><code>back()</code></dfn> method is invoked, the user
  41151. 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>
  41152. <p>When the <dfn id=dom-history-forward><code>forward()</code></dfn>method is invoked, the
  41153. 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>
  41154. <hr>
  41155. <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>,
  41156. initially empty, to which <a href=#concept-task id=the-history-interface:concept-task>tasks</a> can be added.</p>
  41157. <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
  41158. the following algorithm, known as the <dfn id=session-history-event-loop>session history event loop</dfn> for that
  41159. <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-6>top-level browsing context</a>:</p>
  41160. <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
  41161. 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
  41162. 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>
  41163. </ol>
  41164. <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
  41165. 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
  41166. 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
  41167. 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>),
  41168. transitions would otherwise have to involve cross-event-loop synchronisation.</p>
  41169. <hr>
  41170. <p>To <dfn id=traverse-the-history-by-a-delta>traverse the history by a delta</dfn> <var>delta</var>, the user agent must
  41171. 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
  41172. <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>
  41173. consisting of running the following steps:</p>
  41174. <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
  41175. <a href=#joint-session-history id=the-history-interface:joint-session-history-10>joint session history</a>, then abort these steps.</p>
  41176. <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
  41177. history</a> whose index is the sum of <var>delta</var> and the index of the
  41178. <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
  41179. 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
  41180. <a href=#unload-a-document id=the-history-interface:unload-a-document>unload a document</a> algorithm is currently running, abort these steps.<li>
  41181. <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
  41182. <a href=#event-loop id=the-history-interface:event-loop-4>event loop</a> is that of the <var>specified browsing context</var>'s
  41183. <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
  41184. <a href=#history-traversal-task-source id=the-history-interface:history-traversal-task-source>history traversal task source</a>.</p>
  41185. <ol><li><p>If there is an ongoing attempt to navigate <var>specified browsing context</var>
  41186. 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
  41187. 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
  41188. attempt to navigate the <a href=#browsing-context id=the-history-interface:browsing-context-5>browsing context</a>.<li>
  41189. <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
  41190. 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
  41191. entry</var>, then run these substeps:</p>
  41192. <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
  41193. document</a> of the <var>specified browsing context</var>. If the user
  41194. <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
  41195. <var>specified browsing context</var> with the <var>recycle</var> parameter
  41196. set to false.</ol>
  41197. <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
  41198. the <var>specified entry</var>.</p>
  41199. </ol>
  41200. </ol>
  41201. <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
  41202. 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
  41203. to the action specified by the user.</p>
  41204. <hr>
  41205. <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
  41206. the history.</p>
  41207. <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,
  41208. 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>
  41209. <p>When either of these methods is invoked, the user agent must run the following steps:</p>
  41210. <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
  41211. <var>data</var>. If this throws an exception, then rethrow that exception and abort
  41212. these steps.<li>
  41213. <p>If the third argument is not null, run these substeps:</p>
  41214. <ol><li><a href=#resolve-a-url id=the-history-interface:resolve-a-url>Resolve</a> the value of the third argument, relative to
  41215. 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
  41216. 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
  41217. <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
  41218. <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
  41219. 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
  41220. 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
  41221. URLs</a> compared in the previous step differ, throw a <code id=the-history-interface:securityerror-4><a href=#securityerror>SecurityError</a></code> exception
  41222. and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
  41223. 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>
  41224. <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
  41225. can only be the same if the <a href=#concept-url-scheme id=the-history-interface:concept-url-scheme>scheme</a> component of both
  41226. <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>
  41227. <li>
  41228. <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>
  41229. of the <a href=#current-entry id=the-history-interface:current-entry-4>current entry</a>.</p>
  41230. <li>
  41231. <p>If the method invoked was the <code id=the-history-interface:dom-history-pushstate-3><a href=#dom-history-pushstate>pushState()</a></code>
  41232. method:</p>
  41233. <ol><li>
  41234. <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>
  41235. 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
  41236. the session history, then no entries are removed.</p>
  41237. <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
  41238. agent's user interface.</p>
  41239. <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
  41240. task source</a> that are associated with any <code id=the-history-interface:document-7><a href=#document>Document</a></code> objects in the
  41241. <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
  41242. 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
  41243. 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
  41244. 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
  41245. <var>title</var> as the title, and <var>new URL</var> as the <a href=#url id=the-history-interface:url-4>URL</a>
  41246. 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>
  41247. <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>
  41248. <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>
  41249. 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>
  41250. <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
  41251. (e.g. it was the result of a POST submission) then update it to instead represent a GET request
  41252. (<a href=#concept-http-equivalent-get id=the-history-interface:concept-http-equivalent-get>or equivalent</a>).<li>
  41253. <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>
  41254. <p class=note>Since this is neither a <a href=#navigate id=the-history-interface:navigate>navigation</a> of the
  41255. <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>,
  41256. it does not cause a <code id=the-history-interface:event-hashchange><a href=#event-hashchange>hashchange</a></code> event to be fired.</p>
  41257. <li>
  41258. <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>
  41259. of <var>cloned data</var>.</p>
  41260. <li>
  41261. <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
  41262. entry</a> be the <a href=#current-entry id=the-history-interface:current-entry-13>current entry</a>.</p>
  41263. </ol>
  41264. <p class=note>The <var>title</var> is purely advisory. User agents might use the title
  41265. in the user interface.</p>
  41266. <p>User agents may limit the number of state objects added to the session history per page. If a
  41267. page hits the UA-defined limit, user agents must remove the entry immediately after the first
  41268. 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
  41269. entry. (Thus the state history acts as a FIFO buffer for eviction, but as a LIFO buffer for
  41270. navigation.)</p>
  41271. <div class=example>
  41272. <p>Consider a game where the user can navigate along a line, such that the user is always at some
  41273. coordinate, and such that the user can bookmark the page corresponding to a particular
  41274. coordinate, to return to it later.</p>
  41275. <p>A static page implementing the x=5 position in such a game could look like the following:</p>
  41276. <pre>&lt;!DOCTYPE HTML>
  41277. &lt;!-- this is http://example.com/line?x=5 -->
  41278. &lt;title>Line Game - 5&lt;/title>
  41279. &lt;p>You are at coordinate 5 on the line.&lt;/p>
  41280. &lt;p>
  41281. &lt;a href="?x=6">Advance to 6&lt;/a> or
  41282. &lt;a href="?x=4">retreat to 4&lt;/a>?
  41283. &lt;/p></pre>
  41284. <p>The problem with such a system is that each time the user clicks, the whole page has to be
  41285. reloaded. Here instead is another way of doing it, using script:</p>
  41286. <pre>&lt;!DOCTYPE HTML>
  41287. &lt;!-- this starts off as http://example.com/line?x=5 -->
  41288. &lt;title>Line Game - 5&lt;/title>
  41289. &lt;p>You are at coordinate &lt;span id="coord">5&lt;/span> on the line.&lt;/p>
  41290. &lt;p>
  41291. &lt;a href="?x=6" onclick="go(1); return false;">Advance to 6&lt;/a> or
  41292. &lt;a href="?x=4" onclick="go(-1); return false;">retreat to 4&lt;/a>?
  41293. &lt;/p>
  41294. &lt;script>
  41295. var currentPage = 5; // prefilled by server
  41296. function go(d) {
  41297. setupPage(currentPage + d);
  41298. history.pushState(currentPage, document.title, '?x=' + currentPage);
  41299. }
  41300. onpopstate = function(event) {
  41301. setupPage(event.state);
  41302. }
  41303. function setupPage(page) {
  41304. currentPage = page;
  41305. document.title = 'Line Game - ' + currentPage;
  41306. document.getElementById('coord').textContent = currentPage;
  41307. document.links[0].href = '?x=' + (currentPage+1);
  41308. document.links[0].textContent = 'Advance to ' + (currentPage+1);
  41309. document.links[1].href = '?x=' + (currentPage-1);
  41310. document.links[1].textContent = 'retreat to ' + (currentPage-1);
  41311. }
  41312. &lt;/script></pre>
  41313. <p>In systems without script, this still works like the previous example. However, users that
  41314. <em>do</em> have script support can now navigate much faster, since there is no network access
  41315. for the same experience. Furthermore, contrary to the experience the user would have with just a
  41316. naïve script-based approach, bookmarking and navigating the session history still work.</p>
  41317. <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
  41318. to the server, but in a more convenient form, so that the script doesn't have to parse the URL
  41319. each time the user navigates.</p>
  41320. </div>
  41321. <div class=example>
  41322. <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
  41323. 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
  41324. 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
  41325. a previous state the user does not go back in time, and therefore it would be inappropriate to
  41326. put the time in the session history title.</p>
  41327. <pre>&lt;!DOCTYPE HTML>
  41328. &lt;TITLE>Line&lt;/TITLE>
  41329. &lt;SCRIPT>
  41330. setInterval(function () { document.title = 'Line - ' + new Date(); }, 1000);
  41331. var i = 1;
  41332. function inc() {
  41333. set(i+1);
  41334. history.pushState(i, 'Line - ' + i);
  41335. }
  41336. function set(newI) {
  41337. i = newI;
  41338. document.forms.F.I.value = newI;
  41339. }
  41340. &lt;/SCRIPT>
  41341. &lt;BODY ONPOPSTATE="set(event.state)">
  41342. &lt;FORM NAME=F>
  41343. State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()">
  41344. &lt;/FORM></pre>
  41345. </div>
  41346. <h4 id=the-location-interface>7.5.3 The <code id=the-location-interface:location><a href=#location>Location</a></code> interface</h4>
  41347. <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
  41348. associated with a unique instance of a <code id=the-location-interface:location-2><a href=#location>Location</a></code> object.</p>
  41349. <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>
  41350. <p>Returns a <code id=the-location-interface:location-3><a href=#location>Location</a></code> object with the current page's location.</p>
  41351. <p>Can be set, to navigate to another page.</p>
  41352. </dl>
  41353. <p>The <dfn id=dom-document-location><code>location</code></dfn> attribute of the
  41354. <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
  41355. <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>
  41356. <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>
  41357. 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
  41358. <code id=the-location-interface:document-4><a href=#document>Document</a></code>.</p>
  41359. <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
  41360. <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
  41361. 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>
  41362. <pre class=idl>[Unforgeable] interface <dfn id=location>Location</dfn> {
  41363. void <a href=#dom-location-assign id=the-location-interface:dom-location-assign>assign</a>(DOMString url);
  41364. void <a href=#dom-location-replace id=the-location-interface:dom-location-replace>replace</a>(DOMString url);
  41365. void <a href=#dom-location-reload id=the-location-interface:dom-location-reload>reload</a>();
  41366. };
  41367. <a href=#location id=the-location-interface:location-7>Location</a> implements <a href=#urlutils id=the-location-interface:urlutils>URLUtils</a>;</pre>
  41368. <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>
  41369. <p>Navigates to the given page.</p>
  41370. <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>
  41371. <p>Removes the current page from the session history and navigates to the given page.</p>
  41372. <dt><var>location</var> . <code id=the-location-interface:dom-location-reload-2><a href=#dom-location-reload>reload</a></code>()<dd>
  41373. <p>Reloads the current page.</p>
  41374. </dl>
  41375. <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
  41376. <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>
  41377. <p>When the <dfn id=dom-location-assign><code>assign(<var>url</var>)</code></dfn>
  41378. method is invoked, the UA must <a href=#resolve-a-url id=the-location-interface:resolve-a-url>resolve</a> the argument, relative
  41379. 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
  41380. 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
  41381. context</a> to the specified <var>url</var>, with <a href=#exceptions-enabled id=the-location-interface:exceptions-enabled>exceptions enabled</a>. If
  41382. 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
  41383. <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
  41384. 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
  41385. <a href=#replacement-enabled id=the-location-interface:replacement-enabled>replacement enabled</a>.</p>
  41386. <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
  41387. <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>
  41388. <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
  41389. browsing context</a> specified by the <a href=#incumbent-settings-object id=the-location-interface:incumbent-settings-object>incumbent settings object</a> as the
  41390. <a href=#source-browsing-context id=the-location-interface:source-browsing-context>source browsing context</a>.</p>
  41391. <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
  41392. instead throw a <code id=the-location-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception.</p>
  41393. <p>When the <dfn id=dom-location-reload><code>reload()</code></dfn> method is invoked, the
  41394. user agent must run the appropriate steps from the following list:</p>
  41395. <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
  41396. 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
  41397. <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>
  41398. 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
  41399. 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
  41400. 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
  41401. 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
  41402. <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
  41403. 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
  41404. context</a> being navigated. This is a <a href=#reload-triggered-navigation id=the-location-interface:reload-triggered-navigation>reload-triggered navigation</a>.</dl>
  41405. <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>
  41406. 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
  41407. <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
  41408. methods (e.g. HTTP POST), the user agent should prompt the user to confirm the operation first,
  41409. since otherwise transactions (e.g. purchases or database modifications) could be repeated. User
  41410. 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
  41411. 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
  41412. 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
  41413. described in this paragraph (with the <a href=#browsing-context id=the-location-interface:browsing-context-21>browsing context</a> being reloaded as the
  41414. <a href=#source-browsing-context id=the-location-interface:source-browsing-context-3>source browsing context</a>).</p>
  41415. <hr>
  41416. <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>
  41417. <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
  41418. 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
  41419. 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
  41420. 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
  41421. <i>relevant <code id=the-location-interface:document-12><a href=#document>Document</a></code></i> as the given value.</p>
  41422. <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
  41423. 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
  41424. settings object</a>, if there is one, or null otherwise.</p>
  41425. <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
  41426. encoding</a> is the <a href="#document's-character-encoding" id="the-location-interface:document's-character-encoding">document's character encoding</a>.</p>
  41427. <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
  41428. user agent must run the following steps:</p>
  41429. <ol><li>
  41430. <p>If any of the following conditions are met, let <var>mode</var> be <i>normal
  41431. navigation</i>; otherwise, let it be <i>replace navigation</i>:</p>
  41432. <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
  41433. <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
  41434. <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
  41435. 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>
  41436. <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>
  41437. <h5 id=security-location>7.5.3.1 Security</h5>
  41438. <p class=critical>This section describes a security model that is underdefined, imperfect, and
  41439. does not match implementations. Work is ongoing to attempt to resolve this, but in the meantime,
  41440. please do not rely on this section for precision. Implementors are urged to send their feedback on
  41441. 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
  41442. should work. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20701">bug 20701</a>.</p>
  41443. <p id=security-3>User agents must throw a <code id=security-location:securityerror><a href=#securityerror>SecurityError</a></code> exception whenever any
  41444. 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
  41445. 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
  41446. <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
  41447. origin</a>, with the following exceptions:</p>
  41448. <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
  41449. 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>
  41450. 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
  41451. <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
  41452. 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
  41453. 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
  41454. associated
  41455. <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
  41456. 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
  41457. 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
  41458. <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
  41459. origin</a>
  41460. </ul>
  41461. <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
  41462. object</a> is different than a <code id=security-location:location-8><a href=#location>Location</a></code> object's associated
  41463. <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
  41464. changes to that <code id=security-location:location-9><a href=#location>Location</a></code> object's properties, getters, setters, etc, were not
  41465. present, and as if all the properties of that <code id=security-location:location-10><a href=#location>Location</a></code> object had their
  41466. [[Enumerable]] attribute set to false.</p>
  41467. <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin id=security-location:effective-script-origin-7>effective
  41468. 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>
  41469. 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
  41470. separate set of objects. These objects must have the prototype chain appropriate for the script
  41471. for which the objects are created (not those that would be appropriate for scripts whose
  41472. <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
  41473. <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>
  41474. <h4 id=history-notes>7.5.4 Implementation notes for session history</h4>
  41475. <p><i>This section is non-normative.</i></p>
  41476. <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
  41477. represent the session history to the user.</p>
  41478. <p>For example, session history could be implemented in a tree-like manner, with each page having
  41479. multiple "forward" pages. This specification doesn't define how the linear list of pages in the
  41480. <code id=history-notes:dom-history><a href=#dom-history>history</a></code> object are derived from the actual session history as
  41481. seen from the user's perspective.</p>
  41482. <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
  41483. user with just one "Back" button, with a session history that interleaves the navigation of the
  41484. two inner frames and the outer page.</p>
  41485. <p><strong>Security</strong>: It is suggested that to avoid letting a page "hijack" the history
  41486. navigation facilities of a UA by abusing <code id=history-notes:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code>,
  41487. the UA provide the user with a way to jump back to the previous page (rather than just going back
  41488. to the previous state). For example, the back button could have a drop down showing just the pages
  41489. in the session history, and not showing any of the states. Similarly, an aural browser could have
  41490. two "back" commands, one that goes back to the previous state, and one that jumps straight back to
  41491. the previous page.</p>
  41492. <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
  41493. listeners that are not triggered in response to a clear user action, or that are invoked in rapid
  41494. succession.</p>
  41495. <h3 id=browsing-the-web>7.6 Browsing the Web</h3>
  41496. <h4 id=navigating-across-documents>7.6.1 Navigating across documents</h4>
  41497. <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
  41498. a new resource. A user agent may provide various ways for the user to explicitly cause a browsing
  41499. context to navigate, in addition to those defined in this specification.</p>
  41500. <p class=example>For example, <a href=#following-hyperlinks-2 id=navigating-across-documents:following-hyperlinks-2>following a hyperlink</a>,
  41501. <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
  41502. navigate.</p>
  41503. <p class=note>A <i>resource</i> has a URL, but that might not be the only information necessary
  41504. to identify it. For example, a form submission that uses HTTP POST would also have the HTTP method
  41505. 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>
  41506. <p>Navigation always involves <dfn id=source-browsing-context>source browsing context</dfn>, which is the browsing context which
  41507. was responsible for starting the navigation.</p>
  41508. <p>When a browsing context is <dfn id=navigate>navigated</dfn> to a new resource, the user
  41509. agent must run the following steps:</p>
  41510. <ol><li><p>Release the <a href=#storage-mutex id=navigating-across-documents:storage-mutex>storage mutex</a>.<li id=sandboxLinks>
  41511. <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
  41512. <a href=#browsing-context id=navigating-across-documents:browsing-context-2>browsing context</a> being navigated, then abort these steps.</p>
  41513. <p>If these steps are aborted here, the user agent may instead offer to open the new resource in
  41514. 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>
  41515. 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
  41516. 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
  41517. browsing context</a> to the new resource as if the user had requested it independently.</p>
  41518. <p class=note>Doing so, however, can be dangerous, as it means that the user is overriding the
  41519. author's explicit request to sandbox the content.</p>
  41520. <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
  41521. is aborted on this step, then in addition to aborting this algorithm, the user agent must also
  41522. throw a <code id=navigating-across-documents:securityerror><a href=#securityerror>SecurityError</a></code> exception.</p>
  41523. <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
  41524. <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
  41525. 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
  41526. chosen using an <dfn id=explicit-self-navigation-override>explicit self-navigation override</dfn>, then find the nearest
  41527. <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
  41528. 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
  41529. 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
  41530. <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
  41531. 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,
  41532. 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
  41533. 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>
  41534. of the resource being loaded in <em>this</em> navigation, then abort these steps without
  41535. 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
  41536. 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
  41537. <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
  41538. 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
  41539. 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
  41540. <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
  41541. 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>
  41542. <p>Let <var>gone async</var> be false.</p>
  41543. <p class=note>The <a href=#navigate-redirect-step><i>handle redirects</i></a> step later in
  41544. 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,
  41545. 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
  41546. loop</a>, some of the intervening steps need to be able to handle both being synchronous and
  41547. being asynchronous. The <var>gone async</var> flag is thus used to make these steps
  41548. aware of which mode they are operating in.</p>
  41549. <li id=navigate-fragid-step><p><i>Fragment identifiers</i>: If this is not a
  41550. <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
  41551. <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>
  41552. being navigated; if all the components of the resulting <a href=#parsed-url id=navigating-across-documents:parsed-url>parsed
  41553. URLs</a>, ignoring any <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment>fragment</a> components, are
  41554. 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
  41555. new resource has a <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment-2>fragment</a> component that is not null
  41556. (even if it is empty), then <a href=#scroll-to-fragid id=navigating-across-documents:scroll-to-fragid>navigate to that fragment
  41557. 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
  41558. context</a>, including canceling any instances of the <a href=#fetch id=navigating-across-documents:fetch>fetch</a> algorithm started by
  41559. 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
  41560. 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,
  41561. later.)<li><p>If the new resource is to be handled using a mechanism that does not affect the browsing
  41562. context, e.g. ignoring the navigation request altogether because the specified scheme is not one
  41563. 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>
  41564. <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
  41565. 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
  41566. document to be unloaded</a>, then abort these steps.</p>
  41567. <p>If this instance of the <a href=#navigate id=navigating-across-documents:navigate-5>navigation</a> algorithm gets canceled
  41568. 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
  41569. nonetheless be run to completion.</p>
  41570. <li><p>If <var>gone async</var> is false, <a href=#abort-a-document id=navigating-across-documents:abort-a-document-2>abort</a>
  41571. 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>
  41572. <p>If the new resource is to be handled by displaying some sort of inline content, e.g. an error
  41573. message because the specified scheme is not one of the supported protocols, or an inline prompt
  41574. to allow the user to select <a href=#dom-navigator-registerprotocolhandler id=navigating-across-documents:dom-navigator-registerprotocolhandler>a registered
  41575. handler</a> for the given scheme, then <a href=#read-ua-inline id=navigating-across-documents:read-ua-inline>display the inline
  41576. content</a> and abort these steps.</p>
  41577. <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
  41578. with a new URL to handle the request.</p>
  41579. <li>
  41580. <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
  41581. 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
  41582. mode</a>.</p>
  41583. <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
  41584. <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
  41585. run all the steps, or being canceled, or being aborted), whichever happens first.</p>
  41586. <li>
  41587. <p>This is the step that attempts to obtain the resource, if necessary. Jump to the first
  41588. appropriate substep:</p>
  41589. <dl><dt>If the resource has already been obtained (e.g. because it is being used to populate an
  41590. <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>
  41591. <p><a href=#queue-a-task id=navigating-across-documents:queue-a-task>Queue a task</a> to run <dfn id=javascript-protocol>these
  41592. "<code>javascript:</code> URL" steps</dfn>, associated with the <a href=#active-document id=navigating-across-documents:active-document-5>active document</a>
  41593. of the <a href=#browsing-context id=navigating-across-documents:browsing-context-15>browsing context</a> being navigated:</p>
  41594. <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
  41595. <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
  41596. 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
  41597. the script was the void value, and jump to the step labeled <i>process results</i>
  41598. 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
  41599. 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
  41600. 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>
  41601. 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
  41602. 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
  41603. 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
  41604. <var>script source</var>.<li><p>Replace <var>script source</var> with the result of applying the
  41605. <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
  41606. 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
  41607. context</a> being navigated.<li>
  41608. <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
  41609. source, <var>address</var> as the script source URL, JavaScript as the scripting
  41610. 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
  41611. 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>
  41612. <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>
  41613. 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>
  41614. <li>
  41615. <p><i>Process results</i>: If the result of executing the script is void (there is no return
  41616. 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
  41617. 204 No Content response.</p>
  41618. <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
  41619. response whose <a href=#content-type id=navigating-across-documents:content-type>Content-Type metadata</a> is
  41620. <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
  41621. value.</p>
  41622. <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
  41623. <a href=#override-url id=navigating-across-documents:override-url>override URL</a>.</p>
  41624. </ol>
  41625. <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
  41626. <a href=#dom-manipulation-task-source id=navigating-across-documents:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  41627. <div class=example>
  41628. <p>So for example a <a href=#javascript-protocol id=navigating-across-documents:javascript-protocol-2><code>javascript:</code> URL</a> in
  41629. 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
  41630. 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
  41631. 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
  41632. 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
  41633. (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
  41634. 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>
  41635. </div>
  41636. <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
  41637. <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
  41638. entries, excluding entries marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign>foreign</a>,
  41639. 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
  41640. will avoid using <a href=#application-cache id=navigating-across-documents:application-cache>application caches</a><dd>
  41641. <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
  41642. appropriate application cache</a> of those that match.</p>
  41643. <p class=example>For example, imagine an HTML page with an associated application cache
  41644. displaying an image and a form, where the image is also used by several other application
  41645. caches. If the user right-clicks on the image and chooses "View Image", then the user agent
  41646. could decide to show the image from any of those caches, but it is likely that the most useful
  41647. cache for the user would be the one that was used for the aforementioned HTML page. On the
  41648. other hand, if the user submits the form, and the form does a POST submission, then the user
  41649. agent will not use an application cache at all; the submission will be made to the
  41650. network.</p>
  41651. <dt>Otherwise<dd>
  41652. <p><a href=#fetch id=navigating-across-documents:fetch-3>Fetch</a> the new resource, with the <i>manual redirect flag</i>
  41653. set.</p>
  41654. </dl>
  41655. <p>If the steps above invoked the <a href=#fetch id=navigating-across-documents:fetch-4>fetch</a> algorithm, the following requirements also
  41656. apply:</p>
  41657. <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
  41658. result of the <a href=#concept-form-submit id=navigating-across-documents:concept-form-submit-2>form submission algorithm</a>, then the
  41659. <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
  41660. 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>
  41661. <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
  41662. context</a>, then the <a href=#fetch id=navigating-across-documents:fetch-6>fetching algorithm</a> must be invoked from the
  41663. <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
  41664. <a href=#browsing-context id=navigating-across-documents:browsing-context-22>browsing context</a> being navigated, if it has one.</p>
  41665. <li>
  41666. <p>If <var>gone async</var> is false, return to whatever algorithm invoked the
  41667. navigation steps and continue running these steps asynchronously.</p>
  41668. <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
  41669. resource in question is empty. During this time, the user agent may allow the user to cancel this
  41670. navigation attempt or start other navigation attempts.<li id=navigate-redirect-step>
  41671. <p><i>Handle redirects</i>: If fetching the resource results in a redirect, and either the
  41672. <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
  41673. resource, or the resource is being obtained using the POST method or a safe method (in HTTP
  41674. terms), return to <a href=#navigate-fragid-step>the step labeled <i>fragment
  41675. 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
  41676. 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
  41677. led to the redirect does, then the fragment identifier of the resource that led to the redirect
  41678. must be propagated to the <a href=#url id=navigating-across-documents:url-8>URL</a> of the target of the redirect.</p>
  41679. <p class=example>So for instance, if the original URL was "<code>http://example.com/#!sample</code>" and "<code>http://example.com/</code>" is
  41680. found to redirect to "<code>https://example.com/</code>", the URL of the new resource
  41681. will be "<code>https://example.com/#!sample</code>".</p>
  41682. <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
  41683. 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
  41684. the resource is being obtained using a method that is neither the POST method nor a safe method
  41685. (in HTTP terms), then abort these steps. The user agent may indicate to the user that the
  41686. navigation has been aborted for security reasons.</p>
  41687. <li>
  41688. <p><strong>Fallback in prefer-online mode</strong>: If the resource was not fetched from an
  41689. <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
  41690. <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,
  41691. excluding entries marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign-2>foreign</a>, and whose
  41692. <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
  41693. navigation attempt during the earlier step, and the navigation attempt failed (e.g. the server
  41694. returned a 4xx or 5xx status code <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes-3>or
  41695. equivalent</a>, or there was a DNS error), then:</p>
  41696. <p>Let <var>candidate</var> be the resource identified by the URL in question from the
  41697. <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection-2>most appropriate application cache</a> of those that
  41698. match.</p>
  41699. <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
  41700. load and instead continue along these steps using <var>candidate</var> as the resource.
  41701. The user agent may indicate to the user that the original page load failed, and that the page
  41702. used was a previously cached resource.</p>
  41703. <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
  41704. 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
  41705. <code>Document</code> object</a> steps below; they still use the value as computed by the
  41706. original <a href=#fetch id=navigating-across-documents:fetch-7>fetch</a> algorithm.</p>
  41707. <li>
  41708. <p><strong>Fallback for fallback entries</strong>: If the resource was not fetched from an
  41709. <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
  41710. <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
  41711. does not have an entry in its <a href=#concept-appcache-onlinewhitelist id=navigating-across-documents:concept-appcache-onlinewhitelist>online
  41712. 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
  41713. <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
  41714. attempt during the earlier step, and the navigation attempt failed (e.g. the server returned a
  41715. 4xx or 5xx status code <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes-4>or equivalent</a>, or
  41716. there was a DNS error), then:</p>
  41717. <p>Let <var>candidate</var> be the <a href=#concept-appcache-fallback id=navigating-across-documents:concept-appcache-fallback>fallback
  41718. resource</a> specified for the <a href=#concept-appcache-fallback-ns id=navigating-across-documents:concept-appcache-fallback-ns>fallback
  41719. namespace</a> in question. If multiple application caches match, the user agent must use the
  41720. fallback of the <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection-4>most appropriate application
  41721. cache</a> of those that match.</p>
  41722. <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
  41723. load and instead continue along these steps using <var>candidate</var> as the resource.
  41724. <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,
  41725. not the fallback URL, but the user agent may indicate to the user that the original page load
  41726. failed, that the page used was a fallback resource, and what the URL of the fallback resource
  41727. actually is.</p>
  41728. <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
  41729. 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
  41730. <code>Document</code> object</a> steps below; they still use the value as computed by the
  41731. original <a href=#fetch id=navigating-across-documents:fetch-8>fetch</a> algorithm.</p>
  41732. <li>
  41733. <p><i>Resource handling</i>: If the resource's out-of-band metadata (e.g. HTTP headers), not
  41734. counting any <a href=#content-type id=navigating-across-documents:content-type-2>type information</a> (such as the Content-Type HTTP
  41735. header), requires some sort of processing that will not affect the browsing context, then
  41736. perform that processing and abort these steps.</p>
  41737. <div class=note>
  41738. <p>Such processing might be triggered by, amongst other things, the following:</p>
  41739. <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>
  41740. </div>
  41741. <p>Responses with HTTP <code id=navigating-across-documents:http-content-disposition><a href=#http-content-disposition>Content-Disposition</a></code> headers
  41742. specifying the <code>attachment</code> disposition type must be handled <a href=#as-a-download id=navigating-across-documents:as-a-download>as a
  41743. download</a>.</p>
  41744. <p>HTTP 401 responses that do not include a challenge recognised by the user agent must be
  41745. processed as if they had no challenge, e.g. rendering the entity body as if the response had
  41746. been 200 OK.</p>
  41747. <p>User agents may show the entity body of an HTTP 401 response even when the response does
  41748. include a recognised challenge, with the option to login being included in a non-modal fashion,
  41749. to enable the information provided by the server to be used by the user before authenticating.
  41750. Similarly, user agents should allow the user to authenticate (in a non-modal fashion) against
  41751. authentication challenges included in other responses such as HTTP 200 OK responses, effectively
  41752. allowing resources to present HTTP login forms without requiring their use.</p>
  41753. <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
  41754. 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
  41755. context</a>, then skip this step. Otherwise, if the <var>type</var> is one of the
  41756. following types, jump to the appropriate entry in the following list, and process the resource as
  41757. described there:</p>
  41758. <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,
  41759. 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
  41760. 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
  41761. that section determines that the content is <em>not</em> to be displayed as a generic XML
  41762. document, then proceed to the next step in this overall set of steps. Otherwise, once the steps
  41763. given in the <a href=#read-xml id=navigating-across-documents:read-xml-2>XML document</a> section have completed, abort this
  41764. <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,
  41765. 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,
  41766. 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,
  41767. 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
  41768. context</a><dd>Follow the steps given in the <a href=#read-plugin id=navigating-across-documents:read-plugin>plugin</a> section, and then,
  41769. once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-14>navigate</a> algorithm.</dl>
  41770. <p>An <dfn id=explicitly-supported-xml-type>explicitly supported XML type</dfn> is one for which the user agent is configured to
  41771. use an external application to render the content (either a <a href=#plugin id=navigating-across-documents:plugin>plugin</a> rendering
  41772. 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
  41773. user agent has dedicated processing rules (e.g. a Web browser with a built-in Atom feed viewer
  41774. 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
  41775. 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>
  41776. <p><dfn id="set-the-document's-address">Setting the document's address</dfn>: If there is no
  41777. <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
  41778. <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
  41779. originally to be <a href=#fetch id=navigating-across-documents:fetch-9>fetched</a>, ignoring any other data that was used to
  41780. obtain the resource (e.g. the entity body in the case of a POST submission is not part of
  41781. <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
  41782. 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>
  41783. 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
  41784. 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>
  41785. instead.</p>
  41786. <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
  41787. performing <a href=#an-overridden-reload id=navigating-across-documents:an-overridden-reload>an overridden reload</a>.</p>
  41788. <p><dfn id=initialise-the-document-object>Initializing a new <code>Document</code>
  41789. 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
  41790. will be required to additionally run the following algorithm after creating the new object:</p>
  41791. <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
  41792. <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
  41793. 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
  41794. added when the <a href=#browsing-context id=navigating-across-documents:browsing-context-27>browsing context</a> was created, and navigation is occurring with
  41795. <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
  41796. 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
  41797. <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>
  41798. 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>
  41799. <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
  41800. Request-URIs are obtained</i> as determined when the <a href=#fetch id=navigating-across-documents:fetch-10>fetch</a> algorithm obtained the
  41801. resource, if that algorithm was used and determined such a value; otherwise, set it to the
  41802. 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>
  41803. <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
  41804. <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
  41805. 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
  41806. flag</a> set, then skip this step.</p>
  41807. <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
  41808. 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
  41809. <code id=navigating-across-documents:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> attribute specified, or its
  41810. <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
  41811. skip this step.</p>
  41812. <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>
  41813. </ol>
  41814. <li id=navigate-non-Document>
  41815. <p><i>Non-document content</i>: If, given <var>type</var>, the new resource is to be
  41816. handled by displaying some sort of inline content, e.g. a native rendering of the content, an
  41817. error message because the specified type is not supported, or an inline prompt to allow the user
  41818. to select <a href=#dom-navigator-registercontenthandler id=navigating-across-documents:dom-navigator-registercontenthandler-2>a registered handler</a> for
  41819. the given type, then <a href=#read-ua-inline id=navigating-across-documents:read-ua-inline-2>display the inline content</a>, and
  41820. then abort these steps.</p>
  41821. <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
  41822. with a new URL to handle the request.</p>
  41823. <li><p>Otherwise, the document's <var>type</var> is such that the resource will not
  41824. affect the browsing context, e.g. because the resource is to be handed to an external application
  41825. 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>
  41826. </ol>
  41827. <p>When a resource is handled by <dfn id=hand-off-to-external-software>passing its URL or
  41828. 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
  41829. processor), user agents should attempt to mitigate the risk that this is an attempt to exploit the
  41830. 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
  41831. 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
  41832. specified software. In particular, if the <a href=#navigate id=navigating-across-documents:navigate-15>navigate</a> algorithm, when it was invoked,
  41833. 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
  41834. software package without prior user confirmation.</p>
  41835. <p class=example>For example, there could be a vulnerability in the target software's URL
  41836. handler which a hostile page would attempt to exploit by tricking a user into clicking a link.</p>
  41837. <hr>
  41838. <p>Some of the sections below, to which the above algorithm defers in certain cases, require the
  41839. 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
  41840. 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>
  41841. 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>
  41842. <ol><li>
  41843. <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
  41844. <a href=#current-entry id=navigating-across-documents:current-entry-2>current entry</a>, with the <var>recycle</var> parameter set to false.</p>
  41845. <p>If this instance of the <a href=#navigate id=navigating-across-documents:navigate-16>navigation</a> algorithm is canceled while
  41846. 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
  41847. 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
  41848. instance, the cancelation of this algorithm does not abort any event dispatch or script
  41849. execution occurring as part of unloading the document or its descendants.)</p>
  41850. <li>
  41851. <dl><dt>If the navigation was initiated for <dfn id=entry-update>entry update</dfn> of an entry<dd>
  41852. <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
  41853. 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>
  41854. <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
  41855. 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
  41856. 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>
  41857. object.)</p>
  41858. <dt>Otherwise<dd>
  41859. <ol><li>
  41860. <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
  41861. 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
  41862. the last entry in the session history, then no entries are removed.</p>
  41863. <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the
  41864. user agent's user interface.</p>
  41865. <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
  41866. 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
  41867. with <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled-3>replacement enabled</a>, then the traversal must itself be initiated with
  41868. <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled-4>replacement enabled</a>.</p>
  41869. </ol>
  41870. </dl>
  41871. <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
  41872. amount of time, as desired by the user agent implementor. (This is intended to allow the user
  41873. 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
  41874. 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
  41875. 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
  41876. indicated part of the document</a>, then return to the <i>fragment identifier loop</i>
  41877. step.</ol>
  41878. <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
  41879. <a href=#networking-task-source id=navigating-across-documents:networking-task-source>networking task source</a>.</p>
  41880. <h4 id=read-html>7.6.2 <dfn>Page load processing model for HTML files</dfn></h4>
  41881. <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
  41882. <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>",
  41883. <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
  41884. 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
  41885. <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
  41886. 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
  41887. parser</a> to perform the appropriate processing of the input stream.</p>
  41888. <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
  41889. <a href=#tokenization id=read-html:tokenization>tokenizer</a>. This process relies, in part, on character encoding
  41890. information found in the real <a href=#content-type id=read-html:content-type>Content-Type metadata</a> of the
  41891. resource; the "sniffed type" is not used for this purpose.</p>
  41892. <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
  41893. 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>
  41894. <p>After creating the <code id=read-html:document-3><a href=#document>Document</a></code> object, but before any script execution, certainly
  41895. 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
  41896. session history with the new page</a>.</p>
  41897. <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>
  41898. <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
  41899. <a href=#networking-task-source id=read-html:networking-task-source-2>networking task source</a>.</p>
  41900. <h4 id=read-xml>7.6.3 <dfn>Page load processing model for XML files</dfn></h4>
  41901. <p>When faced with displaying an XML file inline, user agents must follow the requirements defined
  41902. in the XML and Namespaces in XML recommendations, RFC 3023, DOM, and other relevant specifications
  41903. 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>
  41904. <p class=note>At the time of writing, the XML specification community had not actually yet
  41905. specified how XML and the DOM interact.</p>
  41906. <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
  41907. <code>Document</code> object</a>.</p>
  41908. <p>The actual HTTP headers and other metadata, not the headers as mutated or implied by the
  41909. algorithms given in this specification, are the ones that must be used when determining the
  41910. character encoding according to the rules given in the above specifications. Once the character
  41911. 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
  41912. character encoding.</p>
  41913. <p>If the root element, as parsed according to the XML specifications cited above, is found to be
  41914. 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>
  41915. 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
  41916. that is successful, must apply the <a href=#concept-url-serialiser id=read-xml:concept-url-serialiser>URL serialiser</a>
  41917. 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
  41918. obtain <var>manifest URL</var>, and then run the <a href=#concept-appcache-init id=read-xml:concept-appcache-init>application
  41919. cache selection algorithm</a> with <var>manifest URL</var> as the manifest URL, passing in the
  41920. 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
  41921. 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
  41922. passing in the <code id=read-xml:document-4><a href=#document>Document</a></code>.</p>
  41923. <p class=note>Because the processing of the <code id=read-xml:attr-html-manifest-2><a href=#attr-html-manifest>manifest</a></code>
  41924. attribute happens only once the root element is parsed, any URLs referenced by processing
  41925. instructions before the root element (such as <code>&lt;?xml-stylesheet?></code> PIs)
  41926. will be fetched from the network and cannot be cached.</p>
  41927. <p>User agents may examine the namespace of the root <code id=read-xml:element><a href=#element>Element</a></code> node of this
  41928. <code id=read-xml:document-5><a href=#document>Document</a></code> object to perform namespace-based dispatch to alternative processing tools,
  41929. e.g. determining that the content is actually a syndication feed and passing it to a feed handler.
  41930. 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
  41931. <a href=#navigate id=read-xml:navigate>navigate</a> steps above.</p>
  41932. <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
  41933. the session history with the new page</a>. User agents may do this before the complete document
  41934. has been parsed (thus achieving <i>incremental rendering</i>), and must do this before any scripts
  41935. are to be executed.</p>
  41936. <p>Error messages from the parse process (e.g. XML namespace well-formedness errors) may be
  41937. reported inline by mutating the <code id=read-xml:document-7><a href=#document>Document</a></code>.</p>
  41938. <h4 id=read-text>7.6.4 <dfn>Page load processing model for text files</dfn></h4>
  41939. <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
  41940. 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>",
  41941. <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>,
  41942. 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
  41943. 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
  41944. 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
  41945. <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
  41946. 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
  41947. parser</a> to perform the appropriate processing of the input stream.</p>
  41948. <p>The rules for how to convert the bytes of the plain text document into actual characters, and
  41949. the rules for actually rendering the text to the user, are defined in RFC 2046, RFC 3676, and
  41950. subsequent versions thereof. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsRFC3676>[RFC3676]</a></p>
  41951. <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
  41952. decode the document.</p>
  41953. <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
  41954. passing in the newly-created <code id=read-text:document-4><a href=#document>Document</a></code>.</p>
  41955. <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
  41956. 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>
  41957. <p>After creating the <code id=read-text:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
  41958. 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>
  41959. <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.
  41960. linking to a style sheet or a binding, providing script, giving the document a
  41961. <code id=read-text:the-title-element><a href=#the-title-element>title</a></code>, etc.</p>
  41962. <p class=note>In particular, if the user agent supports the <code>Format=Flowed</code>
  41963. feature of RFC 3676 then the user agent would need to apply extra styling to cause the text to
  41964. wrap correctly and to handle the quoting feature. This could be performed using, e.g., a
  41965. binding or a CSS extension.</p>
  41966. <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
  41967. <a href=#networking-task-source id=read-text:networking-task-source-2>networking task source</a>.</p>
  41968. <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>
  41969. <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
  41970. <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
  41971. multipart types. <a href=#refsRFC2046>[RFC2046]</a></p>
  41972. <p>For each body part obtained from the resource, the user agent must run a new instance of the
  41973. <a href=#navigate id=read-multipart-x-mixed-replace:navigate>navigate</a> algorithm, starting from the <i>resource handling</i> step, using the new
  41974. 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
  41975. 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
  41976. <a href=#initialise-the-document-object id=read-multipart-x-mixed-replace:initialise-the-document-object>initialized</a>, and otherwise using the same
  41977. 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
  41978. place.</p>
  41979. <p>For the purposes of algorithms processing these body parts as if they were complete stand-alone
  41980. resources, the user agent must act as if there were no more bytes for those resources whenever the
  41981. boundary following the body part is reached.</p>
  41982. <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>
  41983. <h4 id=read-media>7.6.6 <dfn>Page load processing model for media</dfn></h4>
  41984. <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
  41985. 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
  41986. type</a> to the sniffed MIME type of the resource (<var>type</var> in the
  41987. <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
  41988. 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
  41989. 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,
  41990. and set the appropriate attribute of the element <var>host element</var>, as described
  41991. below, to the address of the image, video, or audio resource.</p>
  41992. <p>The element <var>host element</var> to create for the media is the element given in
  41993. the table below in the second cell of the row whose first cell describes the media. The
  41994. appropriate attribute to set is the one given by the third cell in that same row.</p>
  41995. <table><thead><tr><th> Type of media
  41996. <th> Element for the media
  41997. <th> Appropriate attribute
  41998. <tr><td> Image
  41999. <td> <code id=read-media:the-img-element><a href=#the-img-element>img</a></code>
  42000. <td> <code id=read-media:attr-img-src><a href=#attr-img-src>src</a></code>
  42001. <tr><td> Video
  42002. <td> <code id=read-media:the-video-element><a href=#the-video-element>video</a></code>
  42003. <td> <code id=read-media:attr-media-src><a href=#attr-media-src>src</a></code>
  42004. <tr><td> Audio
  42005. <td> <code id=read-media:the-audio-element><a href=#the-audio-element>audio</a></code>
  42006. <td> <code id=read-media:attr-media-src-2><a href=#attr-media-src>src</a></code>
  42007. </table>
  42008. <p>Then, the user agent must act as if it had <a href=#stop-parsing id=read-media:stop-parsing>stopped
  42009. parsing</a>.</p>
  42010. <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
  42011. passing in the newly-created <code id=read-media:document-4><a href=#document>Document</a></code>.</p>
  42012. <p>After creating the <code id=read-media:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
  42013. 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>
  42014. <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
  42015. attributes to the element <var>host element</var>, e.g. to link to a style sheet or a
  42016. 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
  42017. <a href=#attr-media-autoplay id=read-media:attr-media-autoplay>autoplay</a>, etc.</p>
  42018. <h4 id=read-plugin>7.6.7 <dfn>Page load processing model for content that uses plugins</dfn></h4>
  42019. <p>When a resource that requires an external resource to be rendered is to be loaded in a
  42020. <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
  42021. it as being an <a href=#html-documents id=read-plugin:html-documents>HTML document</a> and mark it as being a
  42022. <dfn id=plugin-document>plugin document</dfn>, set its <a href=#concept-document-content-type id=read-plugin:concept-document-content-type>content
  42023. type</a> to the sniffed MIME type of the resource (<var>type</var> in the
  42024. <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
  42025. 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
  42026. 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
  42027. <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
  42028. <code id=read-plugin:the-embed-element-2><a href=#the-embed-element>embed</a></code> element to the address of the resource.</p>
  42029. <p class=note>The term <a href=#plugin-document id=read-plugin:plugin-document>plugin document</a> is used by the Content Security Policy
  42030. 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
  42031. <code>plugin-types</code> directives. <a href=#refsCSP>[CSP]</a></p>
  42032. <p>Then, the user agent must act as if it had <a href=#stop-parsing id=read-plugin:stop-parsing>stopped
  42033. parsing</a>.</p>
  42034. <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
  42035. passing in the newly-created <code id=read-plugin:document-4><a href=#document>Document</a></code>.</p>
  42036. <p>After creating the <code id=read-plugin:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
  42037. 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>
  42038. <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
  42039. 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
  42040. to give the document a <code id=read-plugin:the-title-element><a href=#the-title-element>title</a></code>.</p>
  42041. <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
  42042. 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
  42043. <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
  42044. 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>
  42045. <h4 id=read-ua-inline>7.6.8 <dfn>Page load processing model for inline
  42046. content that doesn't have a DOM</dfn></h4>
  42047. <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>,
  42048. 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>",
  42049. <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
  42050. <code id=read-ua-inline:document-2><a href=#document>Document</a></code> with a custom rendering that is not rendered using the normal
  42051. <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
  42052. the content the user agent wants to render.</p>
  42053. <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>
  42054. <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,
  42055. passing in the newly-created <code id=read-ua-inline:document-6><a href=#document>Document</a></code>.</p>
  42056. <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
  42057. 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
  42058. page</a>.</p>
  42059. <h4 id=scroll-to-fragid>7.6.9 <dfn>Navigating to a fragment identifier</dfn></h4>
  42060. <p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
  42061. run the following steps:</p>
  42062. <ol><li>
  42063. <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>
  42064. 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
  42065. session history, then no entries are removed.</p>
  42066. <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
  42067. agent's user interface.</p>
  42068. <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
  42069. task source</a> that are associated with any <code id=scroll-to-fragid:document><a href=#document>Document</a></code> objects in the
  42070. <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
  42071. 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
  42072. to the address to which the user agent was <a href=#navigate id=scroll-to-fragid:navigate>navigating</a>. The title
  42073. 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
  42074. set. This will <a href=#scroll-to-the-fragment-identifier id=scroll-to-fragid:scroll-to-the-fragment-identifier>scroll to the fragment
  42075. 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>
  42076. <p class=note>If the scrolling fails because the relevant <a href=#concept-id id=scroll-to-fragid:concept-id>ID</a> has
  42077. not yet been parsed, then the original <a href=#navigate id=scroll-to-fragid:navigate-2>navigation</a> algorithm will
  42078. 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
  42079. with the new page</a> algorithm.</p>
  42080. <hr>
  42081. <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
  42082. 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
  42083. either change the scrolling position of the document using the following algorithm, or perform
  42084. 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
  42085. 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
  42086. rendered</a>, then the user agent must do nothing. The aforementioned algorithm is as
  42087. follows:</p>
  42088. <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
  42089. 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
  42090. 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>
  42091. <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,
  42092. identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
  42093. is defined by the specification that defines the <a href=#mime-type id=scroll-to-fragid:mime-type>MIME type</a> used by the
  42094. <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>
  42095. <p>For HTML documents (and <a href=#html-mime-type id=scroll-to-fragid:html-mime-type>HTML MIME types</a>), the following
  42096. 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
  42097. document</a> is.</p>
  42098. <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
  42099. 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
  42100. 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
  42101. 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>
  42102. 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
  42103. 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
  42104. 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
  42105. <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
  42106. 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
  42107. 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
  42108. 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
  42109. 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
  42110. the document</a>.</ol>
  42111. <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>
  42112. 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
  42113. <i id=scroll-to-fragid:target-element><a href=#target-element>target element</a></i>. <a href=#refsSELECTORS>[SELECTORS]</a></p>
  42114. <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
  42115. manipulation task source</a>.</p>
  42116. <h4 id=history-traversal>7.6.10 History traversal</h4>
  42117. <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn> to a <var>specified
  42118. entry</var>, optionally with <a href=#replacement-enabled id=history-traversal:replacement-enabled>replacement enabled</a>, and optionally with the
  42119. <i>asynchronous events</i> flag set, the user agent must act as follows.</p>
  42120. <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
  42121. in other situations, for example when <a href=#navigate id=history-traversal:navigate>navigating a browsing context</a>,
  42122. 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
  42123. with the new page</a>.</p>
  42124. <ol><li>
  42125. <p>If there is no longer a <code id=history-traversal:document><a href=#document>Document</a></code> object for the entry in question,
  42126. <a href=#navigate id=history-traversal:navigate-2>navigate</a> the <a href=#browsing-context id=history-traversal:browsing-context>browsing
  42127. 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
  42128. entry, and abort these steps. The "<a href=#navigate id=history-traversal:navigate-3>navigate</a>" algorithm reinvokes this "traverse"
  42129. 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>
  42130. 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
  42131. browsing context</a> as was used the first time this entry was created. (This can never
  42132. happen with <a href=#replacement-enabled id=history-traversal:replacement-enabled-2>replacement enabled</a>.)</p>
  42133. <p class=note>If the resource was obtained usign a non-idempotent action, for example a POST
  42134. form submission, or if the resource is no longer available, for example because the computer is
  42135. now offline and the page wasn't cached, navigating to it again might not be possible. In this
  42136. case, the navigation will result in a different page than previously; for example, it might be
  42137. an error message explaining the problem or offering to resubmit the form.</p>
  42138. <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
  42139. 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
  42140. 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
  42141. 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
  42142. 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
  42143. than the <a href=#current-entry id=history-traversal:current-entry-3>current entry</a>, then run the following substeps:</p>
  42144. <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
  42145. task source</a> that are associated with any <code id=history-traversal:document-5><a href=#document>Document</a></code> objects in the
  42146. <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>
  42147. <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
  42148. 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
  42149. <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
  42150. sub-sub-steps:</p>
  42151. <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
  42152. 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
  42153. origin</a> as the <a href=#active-document id=history-traversal:active-document>active document</a> <em>and</em> that are contiguous with the
  42154. <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>,
  42155. but not an <a href=#auxiliary-browsing-context id=history-traversal:auxiliary-browsing-context>auxiliary browsing context</a>, then the browsing context's
  42156. <a href=#browsing-context-name id=history-traversal:browsing-context-name-2>browsing context name</a> must be unset.</ol>
  42157. <li id=appcache-history-2><p>Make the <var>specified entry</var>'s
  42158. <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
  42159. context</a>.<li>
  42160. <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
  42161. with it, then run the following sub-sub-steps:</p>
  42162. <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
  42163. the specified entry.<li><p>Clear any <a href=#browsing-context-name id=history-traversal:browsing-context-name-5>browsing context names</a> stored
  42164. with all entries in the history that are associated with <code id=history-traversal:document-10><a href=#document>Document</a></code> objects with
  42165. 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
  42166. with the specified entry.</ol>
  42167. <li id=history-autocomplete><p>If the <var>specified entry</var>'s
  42168. <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>
  42169. <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
  42170. <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
  42171. the following sub-sub-steps:</p>
  42172. <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
  42173. 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>
  42174. <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
  42175. are defined by <a href=#other-applicable-specifications id=history-traversal:other-applicable-specifications>other applicable specifications</a>.</p>
  42176. <p class=note>This is specifically intended for use by the Page Visibility specification. <a href=#refsPAGEVIS>[PAGEVIS]</a></p>
  42177. <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
  42178. <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>
  42179. object,
  42180. 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.
  42181. This event must not bubble, must not be cancelable, and has no default action.</ol>
  42182. </ol>
  42183. <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
  42184. entry</var>.<li><p>If the <var>specified entry</var> has a URL whose fragment identifier differs
  42185. 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>
  42186. manner, and the two share the same <code id=history-traversal:document-18><a href=#document>Document</a></code> object, then let <var>hash
  42187. 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
  42188. entry</a> and <var>new URL</var> be the URL of the <var>specified
  42189. 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
  42190. immediately before the <var>specified entry</var> in the session history.</p>
  42191. <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
  42192. 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
  42193. identifier</a>.<li>
  42194. <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
  42195. aspects of the document and its rendering, for instance the scroll position or values of form
  42196. fields, that it had previously recorded.</p>
  42197. <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
  42198. 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
  42199. directionality of user input in such controls.</p>
  42200. <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
  42201. <a href=#structured-clone id=history-traversal:structured-clone>structured clone</a> of that state object. Otherwise, let <var>state</var> be
  42202. 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>
  42203. <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>
  42204. <p>If the <i>asynchronous events</i> flag is not set, then run the following steps
  42205. 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>
  42206. to run the following substeps.</p>
  42207. <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>
  42208. 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>
  42209. 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
  42210. <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
  42211. 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>
  42212. 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
  42213. 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,
  42214. 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
  42215. initialised to <var>new URL</var>. This event must bubble but not be cancelable and
  42216. has no default action.</ol>
  42217. <li><p>The <a href=#current-entry id=history-traversal:current-entry-8>current entry</a> is now the <var>specified entry</var>.</ol>
  42218. <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
  42219. source</a>.</p>
  42220. <h5 id=the-popstateevent-interface>7.6.10.1 The <code id=the-popstateevent-interface:popstateevent><a href=#popstateevent>PopStateEvent</a></code> interface</h5>
  42221. <pre class=idl>[Constructor(DOMString type, optional <a href=#popstateeventinit id=the-popstateevent-interface:popstateeventinit>PopStateEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  42222. interface <dfn id=popstateevent>PopStateEvent</dfn> : <a href=#event id=the-popstateevent-interface:event>Event</a> {
  42223. readonly attribute any <a href=#dom-popstateevent-state id=the-popstateevent-interface:dom-popstateevent-state>state</a>;
  42224. };
  42225. dictionary <dfn id=popstateeventinit>PopStateEventInit</dfn> : <a href=#eventinit id=the-popstateevent-interface:eventinit>EventInit</a> {
  42226. any state;
  42227. };</pre>
  42228. <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>
  42229. <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>
  42230. </dl>
  42231. <p>The <dfn id=dom-popstateevent-state><code>state</code></dfn> attribute must return the
  42232. value it was initialised to. When the object is created, this attribute must be initialised to
  42233. null. It represents the context information for the event, or null, if the state represented is
  42234. the initial state of the <code id=the-popstateevent-interface:document><a href=#document>Document</a></code>.</p>
  42235. <h5 id=the-hashchangeevent-interface>7.6.10.2 The <code id=the-hashchangeevent-interface:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code> interface</h5>
  42236. <pre class=idl>[Constructor(DOMString type, optional <a href=#hashchangeeventinit id=the-hashchangeevent-interface:hashchangeeventinit>HashChangeEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  42237. interface <dfn id=hashchangeevent>HashChangeEvent</dfn> : <a href=#event id=the-hashchangeevent-interface:event>Event</a> {
  42238. readonly attribute DOMString <a href=#dom-hashchangeevent-oldurl id=the-hashchangeevent-interface:dom-hashchangeevent-oldurl>oldURL</a>;
  42239. readonly attribute DOMString <a href=#dom-hashchangeevent-newurl id=the-hashchangeevent-interface:dom-hashchangeevent-newurl>newURL</a>;
  42240. };
  42241. dictionary <dfn id=hashchangeeventinit>HashChangeEventInit</dfn> : <a href=#eventinit id=the-hashchangeevent-interface:eventinit>EventInit</a> {
  42242. DOMString oldURL;
  42243. DOMString newURL;
  42244. };</pre>
  42245. <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>
  42246. <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
  42247. current.</p>
  42248. <dt><var>event</var> . <code id=the-hashchangeevent-interface:dom-hashchangeevent-newurl-2><a href=#dom-hashchangeevent-newurl>newURL</a></code><dd>
  42249. <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
  42250. current.</p>
  42251. </dl>
  42252. <p>The <dfn id=dom-hashchangeevent-oldurl><code>oldURL</code></dfn> attribute must return the
  42253. value it was initialised to. When the object is created, this attribute must be initialised to
  42254. 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
  42255. history entry</a> that was traversed from.</p>
  42256. <p>The <dfn id=dom-hashchangeevent-newurl><code>newURL</code></dfn> attribute must return the
  42257. value it was initialised to. When the object is created, this attribute must be initialised to
  42258. 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
  42259. history entry</a> that was traversed to.</p>
  42260. <h5 id=the-pagetransitionevent-interface>7.6.10.3 The <code id=the-pagetransitionevent-interface:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface</h5>
  42261. <pre class=idl>[Constructor(DOMString type, optional <a href=#pagetransitioneventinit id=the-pagetransitionevent-interface:pagetransitioneventinit>PageTransitionEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  42262. interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event id=the-pagetransitionevent-interface:event>Event</a> {
  42263. readonly attribute boolean <a href=#dom-pagetransitionevent-persisted id=the-pagetransitionevent-interface:dom-pagetransitionevent-persisted>persisted</a>;
  42264. };
  42265. dictionary <dfn id=pagetransitioneventinit>PageTransitionEventInit</dfn> : <a href=#eventinit id=the-pagetransitionevent-interface:eventinit>EventInit</a> {
  42266. boolean persisted;
  42267. };</pre>
  42268. <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>
  42269. <p>For the <code id=the-pagetransitionevent-interface:event-pageshow><a href=#event-pageshow>pageshow</a></code> event, returns false if the page is
  42270. newly being loaded (and the <code id=the-pagetransitionevent-interface:event-load><a href=#event-load>load</a></code> event will fire). Otherwise,
  42271. returns true.</p>
  42272. <p>For the <code id=the-pagetransitionevent-interface:event-pagehide><a href=#event-pagehide>pagehide</a></code> event, returns false if the page is
  42273. going away for the last time. Otherwise, returns true, meaning that (if nothing conspires to
  42274. make the page unsalvageable) the page might be reused if the user navigates back to this
  42275. page.</p>
  42276. <p>Things that can cause the page to be unsalvageable include:</p>
  42277. <ul class=brief><li><code id=the-pagetransitionevent-interface:dom-document-open><a href=#dom-document-open>document.open()</a></code>
  42278. <li>Listening for <code id=the-pagetransitionevent-interface:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code> events
  42279. <li>Listening for <code id=the-pagetransitionevent-interface:event-unload><a href=#event-unload>unload</a></code> events
  42280. <li>Having <code id=the-pagetransitionevent-interface:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s that are not salvageable
  42281. <li>Active <code id=the-pagetransitionevent-interface:websocket><a href=#websocket>WebSocket</a></code> objects
  42282. <li><a href=#abort-a-document id=the-pagetransitionevent-interface:abort-a-document>Aborting a <code>Document</code></a>
  42283. </ul>
  42284. </dl>
  42285. <p>The <dfn id=dom-pagetransitionevent-persisted><code>persisted</code></dfn> attribute must
  42286. return the value it was initialised to. When the object is created, this attribute must be
  42287. initialised to false. It represents the context information for the event.</p>
  42288. <h4 id=unloading-documents>7.6.11 Unloading documents</h4>
  42289. <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
  42290. true, a <dfn id=fired-unload>fired unload</dfn> flag, which must initially be false, and a <dfn id=page-showing>page showing</dfn>
  42291. 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
  42292. 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
  42293. receive two <code id=unloading-documents:event-pagehide-2><a href=#event-pagehide>pagehide</a></code> events in a row without an intervening
  42294. <code id=unloading-documents:event-pageshow-2><a href=#event-pageshow>pageshow</a></code>, or vice versa).</p>
  42295. <p><a href=#event-loop id=unloading-documents:event-loop>Event loops</a> have a <dfn id=termination-nesting-level>termination nesting level</dfn>
  42296. counter, which must initially be zero.</p>
  42297. <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
  42298. steps.</p>
  42299. <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
  42300. 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
  42301. one.<li><p>Let <var>event</var> be a new <a href=#concept-events-trusted id=unloading-documents:concept-events-trusted>trusted</a>
  42302. <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
  42303. 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
  42304. <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
  42305. false.<li>
  42306. <p>If the <code id=unloading-documents:dom-beforeunloadevent-returnvalue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute of the
  42307. <var>event</var> object is not the empty string, or if the event was canceled, then the
  42308. user agent should ask the user to confirm that they wish to unload the document.</p>
  42309. <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
  42310. thereof. (A user agent may want to truncate the string to 1024 characters for display, for
  42311. instance.)</p>
  42312. <p>The user agent must <a href=#pause id=unloading-documents:pause>pause</a> while waiting for the user's response.</p>
  42313. <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
  42314. the document to be unloaded</dfn>.</p>
  42315. <li><p>If this algorithm was invoked by another instance of the "prompt to unload a document"
  42316. algorithm (i.e. through the steps below that invoke this algorithm for all descendant browsing
  42317. 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
  42318. contexts</a> of the <code id=unloading-documents:document-5><a href=#document>Document</a></code>.<li>
  42319. <p>If <var>descendants</var> is not an empty list, then for each <a href=#browsing-context id=unloading-documents:browsing-context>browsing
  42320. context</a> <var>b</var> in <var>descendants</var> run the following
  42321. substeps:</p>
  42322. <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
  42323. document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-2>browsing context</a> <var>b</var>. If the user
  42324. <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
  42325. be unloaded</a>; jump to the step labeled <i>end</i>.</p>
  42326. <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
  42327. document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-3>browsing context</a> <var>b</var> is false, then set
  42328. the <i id=unloading-documents:concept-document-salvageable-3><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document to
  42329. false also.</ol>
  42330. <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
  42331. counter</a> by one.</ol>
  42332. <p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run the following steps. These
  42333. steps are passed an argument, <var>recycle</var>, which is either true or false,
  42334. 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
  42335. <code id=unloading-documents:dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>
  42336. <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
  42337. 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
  42338. 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
  42339. 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
  42340. 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
  42341. <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>
  42342. object, using the <code id=unloading-documents:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface,
  42343. with the <code id=unloading-documents:dom-pagetransitionevent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized
  42344. 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
  42345. event must not bubble, must not be cancelable, and has no default action.<li>
  42346. <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
  42347. are defined by <a href=#other-applicable-specifications id=unloading-documents:other-applicable-specifications>other applicable specifications</a>.</p>
  42348. <p class=note>This is specifically intended for use by the Page Visibility specification. <a href=#refsPAGEVIS>[PAGEVIS]</a></p>
  42349. <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
  42350. 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
  42351. <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
  42352. <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
  42353. 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
  42354. 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
  42355. 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
  42356. 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
  42357. (i.e. by the steps below that invoke this algorithm for all descendant browsing contexts), then
  42358. 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
  42359. contexts</a> of the <code id=unloading-documents:document-21><a href=#document>Document</a></code>.<li>
  42360. <p>If <var>descendants</var> is not an empty list, then for each <a href=#browsing-context id=unloading-documents:browsing-context-4>browsing
  42361. context</a> <var>b</var> in <var>descendants</var> run the following
  42362. substeps:</p>
  42363. <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
  42364. <a href=#browsing-context id=unloading-documents:browsing-context-5>browsing context</a> <var>b</var> with the <var>recycle</var>
  42365. 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
  42366. document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-6>browsing context</a> <var>b</var> is false, then set
  42367. the <i id=unloading-documents:concept-document-salvageable-7><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document to
  42368. false also.</ol>
  42369. <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
  42370. 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
  42371. counter</a> by one.</ol>
  42372. <p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document cleanup steps</dfn>. Other
  42373. specifications can define more.</p>
  42374. <ol><li>
  42375. <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
  42376. <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>
  42377. <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>
  42378. <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>
  42379. state is false, <a href=#concept-eventsource-forcibly-close id=unloading-documents:concept-eventsource-forcibly-close>forcibly close</a> any
  42380. <code id=unloading-documents:eventsource><a href=#eventsource>EventSource</a></code> objects that whose constructor was invoked from the
  42381. <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>
  42382. 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
  42383. timers</a>.</ol>
  42384. <h5 id=the-beforeunloadevent-interface>7.6.11.1 The <code id=the-beforeunloadevent-interface:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> interface</h5>
  42385. <pre class=idl>interface <dfn id=beforeunloadevent>BeforeUnloadEvent</dfn> : <a href=#event id=the-beforeunloadevent-interface:event>Event</a> {
  42386. attribute DOMString <a href=#dom-beforeunloadevent-returnvalue id=the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue>returnValue</a>;
  42387. };</pre>
  42388. <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>
  42389. <p>Returns the current return value of the event (the message to show the user).</p>
  42390. <p>Can be set, to update the message.</p>
  42391. </dl>
  42392. <p class=note>There are no <code id=the-beforeunloadevent-interface:beforeunloadevent-2><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>-specific initialization methods.</p>
  42393. <p>The <dfn id=dom-beforeunloadevent-returnvalue><code>returnValue</code></dfn> attribute
  42394. represents the message to show the user. When the event is created, the attribute must be set to
  42395. the empty string. On getting, it must return the last value it was set to. On setting, the
  42396. attribute must be set to the new value.</p>
  42397. <h4 id=aborting-a-document-load>7.6.12 Aborting a document load</h4>
  42398. <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
  42399. run the following steps:</p>
  42400. <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
  42401. 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
  42402. <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
  42403. <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
  42404. also.<li><p>Cancel any instances of the <a href=#fetch id=aborting-a-document-load:fetch>fetch</a> algorithm in the context of
  42405. 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
  42406. network for them. If this resulted in any instances of the <a href=#fetch id=aborting-a-document-load:fetch-2>fetch</a>
  42407. 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
  42408. <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
  42409. 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>
  42410. <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
  42411. 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
  42412. <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
  42413. 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
  42414. 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>
  42415. <h3 id=offline>7.7 Offline Web applications</h3>
  42416. <h4 id=introduction-11>7.7.1 Introduction</h4>
  42417. <p><i>This section is non-normative.</i></p>
  42418. <p>In order to enable users to continue interacting with Web applications and documents even when
  42419. their network connection is unavailable — for instance, because they are traveling outside
  42420. of their ISP's coverage area — authors can provide a manifest which lists the files that are
  42421. needed for the Web application to work offline and which causes the user's browser to keep a copy
  42422. of the files for use offline.</p>
  42423. <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
  42424. script "<code>clock.js</code>".</p>
  42425. <p>Before adding the manifest, these three files might look like this:</p>
  42426. <pre>&lt;!-- clock.html -->
  42427. &lt;!DOCTYPE HTML>
  42428. &lt;html>
  42429. &lt;head>
  42430. &lt;title>Clock&lt;/title>
  42431. &lt;script src="clock.js">&lt;/script>
  42432. &lt;link rel="stylesheet" href="clock.css">
  42433. &lt;/head>
  42434. &lt;body>
  42435. &lt;p>The time is: &lt;output id="clock">&lt;/output>&lt;/p>
  42436. &lt;/body>
  42437. &lt;/html></pre>
  42438. <pre>/* clock.css */
  42439. output { font: 2em sans-serif; }</pre>
  42440. <pre>/* clock.js */
  42441. setInterval(function () {
  42442. document.getElementById('clock').value = new Date();
  42443. }, 1000);</pre>
  42444. <p>If the user tries to open the "<code>clock.html</code>" page while offline, though,
  42445. the user agent (unless it happens to have it still in the local cache) will fail with an
  42446. error.</p>
  42447. <p>The author can instead provide a manifest of the three files, say "<code>clock.appcache</code>":</p>
  42448. <pre>CACHE MANIFEST
  42449. clock.html
  42450. clock.css
  42451. clock.js
  42452. </pre>
  42453. <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>)
  42454. is linked to the application:</p>
  42455. <pre>&lt;!-- clock.html -->
  42456. &lt;!DOCTYPE HTML>
  42457. &lt;html manifest="clock.appcache">
  42458. &lt;head>
  42459. &lt;title>Clock&lt;/title>
  42460. &lt;script src="clock.js">&lt;/script>
  42461. &lt;link rel="stylesheet" href="clock.css">
  42462. &lt;/head>
  42463. &lt;body>
  42464. &lt;p>The time is: &lt;output id="clock">&lt;/output>&lt;/p>
  42465. &lt;/body>
  42466. &lt;/html></pre>
  42467. <p>Now, if the user goes to the page, the browser will cache the files and make them available
  42468. even when the user is offline.</p>
  42469. <p class=note>Authors are encouraged to include the main page in the manifest also, but in
  42470. practice the page that referenced the manifest is automatically cached even if it isn't explicitly
  42471. mentioned.</p>
  42472. <p class=note>With the exception of "no-store" directive, HTTP cache headers and restrictions on
  42473. 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
  42474. overridden by manifests. Thus, pages will not expire from an application cache before the user
  42475. agent has updated it, and even applications served over TLS can be made to work offline.</p>
  42476. <p><a href=//www.whatwg.org/demos/offline/clock/live-demo/clock.html>View this example online</a>.</p>
  42477. <h5 id=supporting-offline-caching-for-legacy-applications>7.7.1.1 Supporting offline caching for legacy applications</h5>
  42478. <p><i>This section is non-normative.</i></p>
  42479. <p>The application cache feature works best if the application logic is separate from the
  42480. application and user data, with the logic (markup, scripts, style sheets, images, etc) listed in
  42481. the manifest and stored in the application cache, with a finite number of static HTML pages for
  42482. the application, and with the application and user data stored in Web Storage or a client-side
  42483. Indexed Database, updated dynamically using Web Sockets, <code id=supporting-offline-caching-for-legacy-applications:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code>, server-sent
  42484. events, or some other similar mechanism.</p>
  42485. <p>This model results in a fast experience for the user: the application immediately loads, and
  42486. fresh data is obtained as fast as the network will allow it (possibly while stale data shows).</p>
  42487. <p>Legacy applications, however, tend to be designed so that the user data and the logic are mixed
  42488. together in the HTML, with each operation resulting in a new HTML page from the server.</p>
  42489. <div class=example>
  42490. <p>For example, consider a news application. The typical architecture of such an application,
  42491. when not using the application cache feature, is that the user fetches the main page, and the
  42492. server returns a dynamically-generated page with the current headlines and the user interface
  42493. logic mixed together.</p>
  42494. <p>A news application designed for the application cache feature, however, would instead have the
  42495. main page just consist of the logic, and would then have the main page fetch the data separately
  42496. from the server, e.g. using <code id=supporting-offline-caching-for-legacy-applications:xmlhttprequest-2><a href=#xmlhttprequest>XMLHttpRequest</a></code>.</p>
  42497. </div>
  42498. <p>The mixed-content model does not work well with the application cache feature: since the
  42499. content is cached, it would result in the user always seeing the stale data from the previous time
  42500. the cache was updated.</p>
  42501. <p>While there is no way to make the legacy model work as fast as the separated model, it
  42502. <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
  42503. 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,
  42504. and then add the following line at the bottom of the manifest:</p>
  42505. <pre>SETTINGS:
  42506. prefer-online
  42507. NETWORK:
  42508. *</pre>
  42509. <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
  42510. application cache to be used as an atomic HTTP cache (essentially pinning resources listed in the
  42511. manifest), while allowing all resources not listed in the manifest to be accessed normally when
  42512. the user is online.</p>
  42513. <h5 id=appcacheevents>7.7.1.2 Event summary</h5>
  42514. <p><i>This section is non-normative.</i></p>
  42515. <p>When the user visits a page that declares a manifest, the browser will try to update the cache.
  42516. It does this by fetching a copy of the manifest and, if the manifest has changed since the user
  42517. agent last saw it, redownloading all the resources it mentions and caching them anew.</p>
  42518. <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
  42519. to keep the script updated as to the state of the cache update, so that the user can be notified
  42520. appropriately. The events are as follows:</p>
  42521. <table><thead><tr><th> Event name
  42522. <th> Interface
  42523. <th> Fired when...
  42524. <th> Next events
  42525. <tbody><tr><td> <dfn id=event-appcache-checking><code>checking</code></dfn>
  42526. <td> <code id=appcacheevents:event><a href=#event>Event</a></code>
  42527. <td> The user agent is checking for an update, or attempting to download the manifest for the
  42528. first time. <strong>This is always the first event in the sequence.</strong>
  42529. <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>
  42530. <tr><td> <dfn id=event-appcache-noupdate><code>noupdate</code></dfn>
  42531. <td> <code id=appcacheevents:event-2><a href=#event>Event</a></code>
  42532. <td> The manifest hadn't changed.
  42533. <td> Last event in sequence.
  42534. <tr><td> <dfn id=event-appcache-downloading><code>downloading</code></dfn>
  42535. <td> <code id=appcacheevents:event-3><a href=#event>Event</a></code>
  42536. <td> The user agent has found an update and is fetching it, or is downloading the resources
  42537. listed by the manifest for the first time.
  42538. <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>
  42539. <tr><td> <dfn id=event-appcache-progress><code>progress</code></dfn>
  42540. <td> <code id=appcacheevents:progressevent><a href=#progressevent>ProgressEvent</a></code>
  42541. <td> The user agent is downloading resources listed by the manifest.
  42542. 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.
  42543. 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.
  42544. <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>
  42545. <tr><td> <dfn id=event-appcache-cached><code>cached</code></dfn>
  42546. <td> <code id=appcacheevents:event-4><a href=#event>Event</a></code>
  42547. <td> The resources listed in the manifest have been downloaded, and the application is now cached.
  42548. <td> Last event in sequence.
  42549. <tr><td> <dfn id=event-appcache-updateready><code>updateready</code></dfn>
  42550. <td> <code id=appcacheevents:event-5><a href=#event>Event</a></code>
  42551. <td> The resources listed in the manifest have been newly redownloaded, and the script can use
  42552. <code id=appcacheevents:dom-appcache-swapcache><a href=#dom-appcache-swapcache>swapCache()</a></code> to switch to the new cache.
  42553. <td> Last event in sequence.
  42554. <tr><td> <dfn id=event-appcache-obsolete><code>obsolete</code></dfn>
  42555. <td> <code id=appcacheevents:event-6><a href=#event>Event</a></code>
  42556. <td> The manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
  42557. <td> Last event in sequence.
  42558. <tr><td rowspan=4> <dfn id=event-appcache-error><code>error</code></dfn>
  42559. <td rowspan=4> <code id=appcacheevents:event-7><a href=#event>Event</a></code>
  42560. <td> The manifest was a 404 or 410 page, so the attempt to cache the application has been aborted.
  42561. <td rowspan=3> Last event in sequence.
  42562. <tr><td> The manifest hadn't changed, but the page referencing the manifest failed to download properly.
  42563. <tr><td> A fatal error occurred while fetching the resources listed in the manifest.
  42564. <tr><td> The manifest changed while the update was being run.
  42565. <td> The user agent will try fetching the files again momentarily.
  42566. </table>
  42567. <p>These events are cancelable; their default action is for the user agent to show download
  42568. progress information. If the page shows its own update UI, canceling the events will prevent the
  42569. user agent from showing redundant progress information.</p>
  42570. <h4 id=appcache>7.7.2 Application caches</h4>
  42571. <p>An <dfn id=application-cache>application cache</dfn> is a set of cached resources consisting of:</p>
  42572. <ul><li>
  42573. <p>One or more resources (including their out-of-band metadata, such as HTTP headers, if any),
  42574. identified by URLs, each falling into one (or more) of the following categories:</p>
  42575. <dl><dt><dfn id=concept-appcache-master>Master entries</dfn>
  42576. <dd><p class=note>These are documents that were added to the cache because a <a href=#browsing-context id=appcache:browsing-context>browsing
  42577. context</a> was <a href=#navigate id=appcache:navigate>navigated</a> to that document and the document
  42578. indicated that this was its cache, using the <code id=appcache:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
  42579. attribute.</p>
  42580. <dt><dfn id=concept-appcache-manifest>The manifest</dfn>
  42581. <dd><p class=note>This is the resource corresponding to the URL that was given in a master
  42582. 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.
  42583. The manifest is fetched and processed during the <a href=#application-cache-download-process id=appcache:application-cache-download-process>application cache download
  42584. process</a>. All the <a href=#concept-appcache-master id=appcache:concept-appcache-master>master entries</a> have the
  42585. <a href=#same-origin id=appcache:same-origin>same origin</a> as the manifest.</p>
  42586. <dt><dfn id=concept-appcache-explicit>Explicit entries</dfn>
  42587. <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>
  42588. <dt><dfn id=concept-appcache-fallback>Fallback entries</dfn>
  42589. <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>
  42590. </dl>
  42591. <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
  42592. <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-3>manifest</a>.</p>
  42593. <p class=note>A URL in the list can be flagged with multiple different types, and thus an
  42594. entry can end up being categorised as multiple entries. For example, an entry can be a manifest
  42595. entry and an explicit entry at the same time, if the manifest is listed within the manifest.</p>
  42596. <li>
  42597. <p>Zero or more <dfn id=concept-appcache-fallback-ns>fallback namespaces</dfn>, each of
  42598. which is mapped to a <a href=#concept-appcache-fallback id=appcache:concept-appcache-fallback-2>fallback entry</a>.</p>
  42599. <p class=note>These are URLs used as <a href=#concept-appcache-matches-fallback id=appcache:concept-appcache-matches-fallback>prefix
  42600. match patterns</a> for resources that are to be fetched from the network if possible, or to
  42601. be replaced by the corresponding <a href=#concept-appcache-fallback id=appcache:concept-appcache-fallback-3>fallback entry</a>
  42602. 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>
  42603. <li>
  42604. <p>Zero or more URLs that form the <dfn id=concept-appcache-onlinewhitelist>online
  42605. whitelist namespaces</dfn>.</p>
  42606. <p class=note>These are used as prefix match patterns, and declare URLs for which the user
  42607. agent will ignore the application cache, instead fetching them normally (i.e. from the network
  42608. or local HTTP cache as appropriate).</p>
  42609. <li>
  42610. <p>An <dfn id=concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard
  42611. flag</dfn>, which is either <i>open</i> or <i>blocking</i>.</p>
  42612. <p class=note>The <i>open</i> state indicates that any URL not listed as cached is to
  42613. be implicitly treated as being in the <a href=#concept-appcache-onlinewhitelist id=appcache:concept-appcache-onlinewhitelist>online
  42614. whitelist namespaces</a>; the <i>blocking</i> state indicates that URLs not listed
  42615. explicitly in the manifest are to be treated as unavailable.</p>
  42616. <li>
  42617. <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>
  42618. </ul>
  42619. <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
  42620. <i>incomplete</i>.</p>
  42621. <hr>
  42622. <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
  42623. 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
  42624. group.</p>
  42625. <p>An <a href=#application-cache id=appcache:application-cache-3>application cache</a> is <dfn id=concept-appcache-newer>newer</dfn> than
  42626. 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
  42627. order).</p>
  42628. <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
  42629. have its <a href=#concept-appcache-completeness id=appcache:concept-appcache-completeness>completeness flag</a> set to
  42630. <i>incomplete</i>; the others are always all <i>complete</i>.</p>
  42631. <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
  42632. status</dfn>, which is one of the following: <i>idle</i>, <i>checking</i>, <i>downloading</i>.</p>
  42633. <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>
  42634. <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
  42635. list consists of a resource and a corresponding <code id=appcache:document><a href=#document>Document</a></code> object. It is used during
  42636. 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
  42637. 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
  42638. <a href=#application-cache-group id=appcache:application-cache-group-6>application cache group</a> when they were loaded.</p>
  42639. <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
  42640. what <a href=#application-cache-group id=appcache:application-cache-group-8>application cache groups</a> exist.</p>
  42641. <hr>
  42642. <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>
  42643. 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>
  42644. <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
  42645. 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>
  42646. sections cause <a href=#concept-appcache-init id=appcache:concept-appcache-init>cache selection</a> to occur.</p>
  42647. <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>
  42648. when it is created.</p>
  42649. <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>
  42650. <hr>
  42651. <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,
  42652. 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
  42653. user agent must use the application cache that the user most likely wants to see the resource
  42654. from, taking into account the following:</p>
  42655. <ul><li>which application cache was most recently updated,
  42656. <li>which application cache was being used to display the resource from which the user decided to
  42657. look at the new resource, and
  42658. <li>which application cache the user prefers.
  42659. </ul>
  42660. <hr>
  42661. <p>A URL <dfn id=concept-appcache-matches-fallback>matches a fallback namespace</dfn> if
  42662. 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
  42663. URL in question, and that has a <a href=#concept-appcache-fallback-ns id=appcache:concept-appcache-fallback-ns>fallback
  42664. namespace</a> that is a <a href=#prefix-match id=appcache:prefix-match>prefix match</a> for the URL being examined. If multiple
  42665. fallback namespaces match the same URL, the longest one is the one that matches. A URL looking for
  42666. a fallback namespace can match more than one application cache at a time, but only matches one
  42667. namespace in each cache.</p>
  42668. <div class=example>
  42669. <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
  42670. navigates to <code>HTTP://EXAMPLE.COM:80/resources/images/cat.png</code>, then the user
  42671. agent will decide that the application cache identified by <code>http://example.com/app1/manifest</code> contains a namespace with a match for that
  42672. URL.</p>
  42673. </div>
  42674. <h4 id=manifests>7.7.3 The cache manifest syntax</h4>
  42675. <h5 id=some-sample-manifests>7.7.3.1 Some sample manifests</h5>
  42676. <p><i>This section is non-normative.</i></p>
  42677. <div class=example>
  42678. <p>This example manifest requires two images and a style sheet to be cached and whitelists a CGI
  42679. script.</p>
  42680. <pre>CACHE MANIFEST
  42681. # the above line is required
  42682. # this is a comment
  42683. # there can be as many of these anywhere in the file
  42684. # they are all ignored
  42685. # comments can have spaces before them
  42686. # but must be alone on the line
  42687. # blank lines are ignored too
  42688. # these are files that need to be cached they can either be listed
  42689. # first, or a "CACHE:" header could be put before them, as is done
  42690. # lower down.
  42691. images/sound-icon.png
  42692. images/background.png
  42693. # note that each file has to be put on its own line
  42694. # here is a file for the online whitelist -- it isn't cached, and
  42695. # references to this file will bypass the cache, always hitting the
  42696. # network (or trying to, if the user is offline).
  42697. NETWORK:
  42698. comm.cgi
  42699. # here is another set of files to cache, this time just the CSS file.
  42700. CACHE:
  42701. style/default.css</pre>
  42702. <p>It could equally well be written as follows:</p>
  42703. <pre>CACHE MANIFEST
  42704. NETWORK:
  42705. comm.cgi
  42706. CACHE:
  42707. style/default.css
  42708. images/sound-icon.png
  42709. images/background.png</pre>
  42710. </div>
  42711. <div class=example>
  42712. <p>Offline application cache manifests can use absolute paths or even absolute URLs:</p>
  42713. <pre>CACHE MANIFEST
  42714. /main/home
  42715. /main/app.js
  42716. /settings/home
  42717. /settings/app.js
  42718. http://img.example.com/logo.png
  42719. http://img.example.com/check.png
  42720. http://img.example.com/cross.png</pre>
  42721. </div>
  42722. <div class=example>
  42723. <p>The following manifest defines a catch-all error page that is displayed for any page on the
  42724. 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.
  42725. (Resources on the same site are already not blocked because of the catch-all fallback
  42726. namespace.)</p>
  42727. <p>So long as all pages on the site reference this manifest, they will get cached locally as they
  42728. are fetched, so that subsequent hits to the same page will load the page immediately from the
  42729. cache. Until the manifest is changed, those pages will not be fetched from the server again. When
  42730. the manifest changes, then all the files will be redownloaded.</p>
  42731. <p>Subresources, such as style sheets, images, etc, would only be cached using the regular HTTP
  42732. caching semantics, however.</p>
  42733. <pre>CACHE MANIFEST
  42734. FALLBACK:
  42735. / /offline.html
  42736. NETWORK:
  42737. *</pre>
  42738. </div>
  42739. <h5 id=writing-cache-manifests>7.7.3.2 Writing cache manifests</h5>
  42740. <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
  42741. 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
  42742. syntax of application cache manifests, as described in this section.</p>
  42743. <p>An application cache manifest is a text file, whose text is encoded using UTF-8. Data in
  42744. application cache manifests is line-based. Newlines must be represented by U+000A LINE FEED (LF)
  42745. characters, U+000D CARRIAGE RETURN (CR) characters, or U+000D CARRIAGE RETURN (CR) U+000A LINE
  42746. FEED (LF) pairs. <a href=#refsENCODING>[ENCODING]</a></p>
  42747. <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
  42748. outdated; the use of CR, LF, and CRLF line breaks is commonly supported and indeed sometimes CRLF
  42749. is <em>not</em> supported by text editors. <a href=#refsRFC2046>[RFC2046]</a></p>
  42750. <p>The first line of an application cache manifest must consist of the string "CACHE", a single
  42751. U+0020 SPACE character, the string "MANIFEST", and either a U+0020 SPACE character, a U+0009
  42752. CHARACTER TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a U+000D CARRIAGE
  42753. RETURN (CR) character. The first line may optionally be preceded by a U+FEFF BYTE ORDER MARK (BOM)
  42754. character. If any other text is found on the first line, it is ignored.</p>
  42755. <p>Subsequent lines, if any, must all be one of the following:</p>
  42756. <dl><dt>A blank line
  42757. <dd>
  42758. <p>Blank lines must consist of zero or more U+0020 SPACE and
  42759. U+0009 CHARACTER TABULATION (tab) characters only.</p>
  42760. <dt>A comment
  42761. <dd>
  42762. <p>Comment lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
  42763. characters, followed by a single U+0023 NUMBER SIGN character (#), followed by zero or more
  42764. characters other than U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters.</p>
  42765. <p class=note>Comments must be on a line on their own. If they were to be included on a line
  42766. with a URL, the "#" would be mistaken for part of a fragment identifier.</p>
  42767. <dt>A section header
  42768. <dd>
  42769. <p>Section headers change the current section. There are four possible section headers:
  42770. <dl><dt><code>CACHE:</code>
  42771. <dd>Switches to the <dfn id=concept-appcache-manifest-explicit>explicit section</dfn>.
  42772. <dt><code>FALLBACK:</code>
  42773. <dd>Switches to the <dfn id=concept-appcache-manifest-fallback>fallback section</dfn>.
  42774. <dt><code>NETWORK:</code>
  42775. <dd>Switches to the <dfn id=concept-appcache-manifest-network>online whitelist section</dfn>.
  42776. <dt><code>SETTINGS:</code>
  42777. <dd>Switches to the <dfn id=concept-appcache-manifest-settings>settings section</dfn>.
  42778. </dl>
  42779. <p>Section header lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
  42780. TABULATION (tab) characters, followed by one of the names above (including the U+003A COLON
  42781. character (:)) followed by zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
  42782. characters.</p>
  42783. <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>
  42784. <dt>Data for the current section
  42785. <dd>
  42786. <p>The format that data lines must take depends on the current section.</p>
  42787. <p>When the current section is the <a href=#concept-appcache-manifest-explicit id=writing-cache-manifests:concept-appcache-manifest-explicit-2>explicit
  42788. section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
  42789. TABULATION (tab) characters, a <a href=#valid-url id=writing-cache-manifests:valid-url>valid URL</a> identifying a resource other than the
  42790. manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
  42791. characters.</p>
  42792. <p>When the current section is the <a href=#concept-appcache-manifest-fallback id=writing-cache-manifests:concept-appcache-manifest-fallback>fallback
  42793. section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
  42794. TABULATION (tab) characters, a <a href=#valid-url id=writing-cache-manifests:valid-url-2>valid URL</a> identifying a resource other than the
  42795. manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters,
  42796. 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
  42797. zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>
  42798. <p>When the current section is the <a href=#concept-appcache-manifest-network id=writing-cache-manifests:concept-appcache-manifest-network>online
  42799. whitelist section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009
  42800. 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
  42801. other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER
  42802. TABULATION (tab) characters.</p>
  42803. <p>When the current section is the <a href=#concept-appcache-manifest-settings id=writing-cache-manifests:concept-appcache-manifest-settings>settings
  42804. section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
  42805. TABULATION (tab) characters, a <a href=#concept-appcache-manifest-setting id=writing-cache-manifests:concept-appcache-manifest-setting>setting</a>,
  42806. and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>
  42807. <p>Currently only one <dfn id=concept-appcache-manifest-setting>setting</dfn> is
  42808. defined:</p>
  42809. <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>
  42810. <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>
  42811. </dl>
  42812. <p>Manifests may contain sections more than once. Sections may be empty.</p>
  42813. <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,
  42814. must be given in <a href=#concept-appcache-manifest-fallback id=writing-cache-manifests:concept-appcache-manifest-fallback-2>fallback sections</a>, with
  42815. the namespace being the first URL of the data line, and the corresponding fallback page being the
  42816. 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>
  42817. <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>
  42818. as the manifest itself. <a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-3>Fallback namespaces</a>
  42819. must also be <span>in the same path</span> as the manifest's URL.</p>
  42820. <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
  42821. than once.</p>
  42822. <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
  42823. any URL that the page is intending to use to communicate back to the server.) To specify that all
  42824. URLs are automatically whitelisted in this way, a U+002A ASTERISK character (*) may be specified
  42825. as one of the URLs. </p>
  42826. <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
  42827. 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
  42828. match</a>.</p>
  42829. <p><a href=#relative-url id=writing-cache-manifests:relative-url>Relative URLs</a> must be given relative to the manifest's own
  42830. 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
  42831. 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>
  42832. <p>URLs in manifests must not have fragment identifiers (i.e. the U+0023 NUMBER SIGN character
  42833. isn't allowed in URLs in manifests).</p>
  42834. <p><a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-5>Fallback namespaces</a> and namespaces in the
  42835. <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
  42836. match</a>.</p>
  42837. <h5 id=parsing-cache-manifests>7.7.3.3 Parsing cache manifests</h5>
  42838. <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
  42839. following steps:</p>
  42840. <ol><li>
  42841. <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>
  42842. <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>
  42843. <li><p>Let <var>base URL</var> be the <a href=#absolute-url id=parsing-cache-manifests:absolute-url>absolute URL</a> representing the
  42844. 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>
  42845. 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
  42846. character (/), if any. (The first character and the last character in <var>manifest path</var>
  42847. 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
  42848. 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
  42849. 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
  42850. 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
  42851. 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
  42852. pointing at the first character.<li><p>If the characters starting from <var>position</var> are "CACHE", followed by a
  42853. U+0020 SPACE character, followed by "MANIFEST", then advance <var>position</var> to the
  42854. next character after those. Otherwise, this isn't a cache manifest; abort this algorithm with a
  42855. failure while checking for the magic signature.<li><p>If the character at <var>position</var> is neither a U+0020 SPACE character, a
  42856. U+0009 CHARACTER TABULATION (tab) character, U+000A LINE FEED (LF) character, nor a U+000D
  42857. CARRIAGE RETURN (CR) character, then this isn't a cache manifest; abort this algorithm with a
  42858. failure while checking for the magic signature.<li><p>This is a cache manifest. The algorithm cannot fail beyond
  42859. 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)
  42860. or U+000D CARRIAGE RETURN (CR) characters, and ignore those characters. (Extra text on the first
  42861. 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
  42862. characters</a> that are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, or
  42863. 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
  42864. (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
  42865. of <var>line</var>.<li><p>If <var>line</var> is the empty string, then jump back to the step labeled <i>start
  42866. of line</i>.<li><p>If the first character in <var>line</var> is a U+0023 NUMBER SIGN character (#),
  42867. 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
  42868. character (:)), then set <var>mode</var> to "explicit" and jump back to the step labeled
  42869. <i>start of line</i>.<li><p>If <var>line</var> equals "FALLBACK:" (the word "FALLBACK" followed by a U+003A
  42870. COLON character (:)), then set <var>mode</var> to "fallback" and jump back to the step
  42871. labeled <i>start of line</i>.<li><p>If <var>line</var> equals "NETWORK:" (the word "NETWORK" followed by a U+003A
  42872. COLON character (:)), then set <var>mode</var> to "online whitelist" and jump back to
  42873. the step labeled <i>start of line</i>.<li><p>If <var>line</var> equals "SETTINGS:" (the word "SETTINGS" followed by a U+003A
  42874. COLON character (:)), then set <var>mode</var> to "settings" and jump back to the step
  42875. 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
  42876. pointing at the start of the string.<li><p>Let <var>tokens</var> be a list of strings, initially empty.<li>
  42877. <p>While <var>position</var> doesn't point past the end of <var>line</var>:</p>
  42878. <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
  42879. 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
  42880. or a U+0009 CHARACTER TABULATION (tab) character, advance <var>position</var> to the
  42881. next character in <var>input</var>.</ol>
  42882. <li>
  42883. <p>Process <var>tokens</var> as follows:</p>
  42884. <dl class=switch><dt>If <var>mode</var> is "explicit"<dd>
  42885. <p><a href=#resolve-a-url id=parsing-cache-manifests:resolve-a-url>Resolve</a> the first item in <var>tokens</var>,
  42886. relative to <var>base URL</var>, with the URL character encoding set to UTF-8;
  42887. ignore the rest.</p>
  42888. <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>
  42889. <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
  42890. manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>
  42891. <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
  42892. URL</a>, with the <i>exclude fragment flag</i> set.</p>
  42893. <p>Add <var>new URL</var> to the <var>explicit URLs</var>.</p>
  42894. <dt>If <var>mode</var> is "fallback"<dd>
  42895. <p>Let <var>part one</var> be the first token in <var>tokens</var>, and let
  42896. <var>part two</var> be the second token in <var>tokens</var>.</p>
  42897. <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
  42898. encoding set to UTF-8.</p>
  42899. <p>If either fails, then jump back to the step labeled <i>start of line</i>.</p>
  42900. <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
  42901. <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,
  42902. then jump back to the step labeled <i>start of line</i>.</p>
  42903. <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
  42904. of the <a href=#resulting-parsed-url id=parsing-cache-manifests:resulting-parsed-url>resulting parsed URL</a> for <var>part one</var>.</p>
  42905. <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
  42906. path</var>, then jump back to the step labeled <i>start of line</i>.</p>
  42907. <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
  42908. <a href=#parsed-url id=parsing-cache-manifests:parsed-url-4>parsed URL</a>, with the <i>exclude fragment flag</i> set.</p>
  42909. <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
  42910. <a href=#parsed-url id=parsing-cache-manifests:parsed-url-5>parsed URL</a>, with the <i>exclude fragment flag</i> set.</p>
  42911. <p>If <var>part one</var> is already in the <var>fallback URLs</var> mapping
  42912. as a <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-2>fallback namespace</a>, then jump back to
  42913. the step labeled <i>start of line</i>.</p>
  42914. <p>Otherwise, add <var>part one</var> to the <var>fallback URLs</var>
  42915. mapping as a <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-3>fallback namespace</a>, mapped to
  42916. <var>part two</var> as the <a href=#concept-appcache-fallback id=parsing-cache-manifests:concept-appcache-fallback-2>fallback
  42917. entry</a>.</p>
  42918. <dt>If <var>mode</var> is "online whitelist"<dd>
  42919. <p>If the first item in <var>tokens</var> is a U+002A ASTERISK character (*), then
  42920. set <var>online whitelist wildcard flag</var> to <i>open</i> and jump back
  42921. to the step labeled <i>start of line</i>.</p>
  42922. <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
  42923. encoding set to UTF-8; ignore the rest.</p>
  42924. <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>
  42925. <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
  42926. manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>
  42927. <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
  42928. URL</a>, with the <i>exclude fragment flag</i> set.</p>
  42929. <p>Add <var>new URL</var> to the <var>online whitelist namespaces</var>.</p>
  42930. <dt>If <var>mode</var> is "settings"<dd>
  42931. <p>If <var>tokens</var> contains a single token, and that token is a
  42932. <a href=#case-sensitive id=parsing-cache-manifests:case-sensitive>case-sensitive</a> match for the string "<code>prefer-online</code>", then
  42933. set <var>cache mode flag</var> to <i>prefer-online</i> and jump back to the
  42934. step labeled <i>start of line</i>.</p>
  42935. <p>Otherwise, the line is an unsupported setting: do nothing; the line is ignored.</p>
  42936. <dt>If <var>mode</var> is "unknown"<dd>
  42937. <p>Do nothing. The line is ignored.</p>
  42938. </dl>
  42939. <li><p>Jump back to the step labeled <i>start of line</i>. (That step jumps to the next, and last,
  42940. step when the end of the file is reached.)<li><p>Return the <var>explicit URLs</var> list, the <var>fallback URLs</var>
  42941. mapping, the <var>online whitelist namespaces</var>, the <var>online whitelist
  42942. wildcard flag</var>, and the <var>cache mode flag</var>.</ol>
  42943. <div class=note>
  42944. <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,
  42945. 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>
  42946. <p>If a resource is listed in the <a href=#concept-appcache-manifest-explicit id=parsing-cache-manifests:concept-appcache-manifest-explicit>explicit
  42947. 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
  42948. 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>
  42949. <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>
  42950. <p>The <a href=#concept-appcache-onlinewhitelist-wildcard id=parsing-cache-manifests:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard
  42951. 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
  42952. <a href=#concept-appcache-manifest-explicit id=parsing-cache-manifests:concept-appcache-manifest-explicit-2>explicit section</a>.</p>
  42953. </div>
  42954. <h4 id=downloading-or-updating-an-application-cache>7.7.4 Downloading or updating an application cache</h4>
  42955. <p>When the user agent is required (by other parts of this specification) to start the
  42956. <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
  42957. 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
  42958. 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
  42959. 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
  42960. 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>
  42961. <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task>tasks</a>.</p>
  42962. <p>Some of these steps have requirements that only apply if the user agent <dfn id=shows-caching-progress>shows caching
  42963. progress</dfn>. Support for this is optional. Caching progress UI could consist of a progress bar
  42964. or message panel in the user agent's interface, or an overlay, or something else. Certain events
  42965. 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
  42966. 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.)
  42967. The goal of this is to allow Web applications to provide more
  42968. seamless update mechanisms, hiding from the user the mechanics of the application cache mechanism.
  42969. User agents may display user interfaces independent of this, but are encouraged to not show
  42970. prominent update progress notifications for applications that cancel the relevant events.</p>
  42971. <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:
  42972. <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
  42973. process</a> has been obtained from the user and until the user agent is confident that the
  42974. network is available. This could include doing nothing until the user explicitly opts-in to
  42975. caching the site, or could involve prompting the user for permission. The algorithm might never
  42976. get past this point. (This step is particularly intended to be used by user agents running on
  42977. severely space-constrained devices or in highly privacy-sensitive environments).<li>
  42978. <p>Atomically, so as to avoid race conditions, perform the following substeps:</p>
  42979. <ol><li>
  42980. <p>Pick the appropriate substeps:</p>
  42981. <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
  42982. <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest-2>manifest</a><dd>
  42983. <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>
  42984. <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
  42985. 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>
  42986. <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>
  42987. <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
  42988. cache group</a> to be updated.</p>
  42989. <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
  42990. <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
  42991. algorithm found the manifest to be 404 or 410 while this algorithm was waiting in the first
  42992. step above.</p>
  42993. </dl>
  42994. <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>
  42995. 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>
  42996. 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
  42997. 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
  42998. <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
  42999. 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
  43000. 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
  43001. 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>,
  43002. the display of some sort of user interface indicating to the user that the user agent is
  43003. 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
  43004. <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
  43005. event</a> named <code id=downloading-or-updating-an-application-cache:event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code> that is
  43006. 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
  43007. 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>,
  43008. the display of some sort of user interface indicating to the user the application is being
  43009. 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
  43010. group</var> is either <i>checking</i> or <i>downloading</i>, then abort this instance of the
  43011. <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
  43012. group</var> to <i>checking</i>.</p>
  43013. <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
  43014. <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
  43015. 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
  43016. 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
  43017. 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
  43018. some sort of user interface indicating to the user that the user agent is checking for the
  43019. availability of updates.</ol>
  43020. <p class=note>The remainder of the steps run asynchronously.</p>
  43021. <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
  43022. this is an <dfn id=concept-appcache-upgrade>upgrade attempt</dfn>. Otherwise, this is a
  43023. <dfn id=concept-appcache-cache>cache attempt</dfn>.</p>
  43024. <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
  43025. 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
  43026. <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
  43027. 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
  43028. 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
  43029. display of some sort of user interface indicating to the user that the user agent is checking for
  43030. the availability of updates.<li>
  43031. <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
  43032. request.</p>
  43033. <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
  43034. parsing manifests</a>, obtaining a list of <a href=#concept-appcache-explicit id=downloading-or-updating-an-application-cache:concept-appcache-explicit>explicit
  43035. 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
  43036. the <a href=#concept-appcache-onlinewhitelist id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist>online whitelist</a>, and values for the
  43037. <a href=#concept-appcache-onlinewhitelist-wildcard id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard flag</a>
  43038. and the <a href=#concept-appcache-mode id=downloading-or-updating-an-application-cache:concept-appcache-mode>cache mode flag</a>.</p>
  43039. <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
  43040. 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
  43041. different types will probably be distinguished on the basis of the file signatures (for the
  43042. current format, that is the "<code>CACHE MANIFEST</code>" string at the top of the
  43043. file).</p>
  43044. <li>
  43045. <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>
  43046. <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
  43047. 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
  43048. 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
  43049. 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>
  43050. <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
  43051. <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
  43052. 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
  43053. 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
  43054. append it to <var>task list</var>. The default action of these events must be, if the
  43055. 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
  43056. 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
  43057. <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>
  43058. 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
  43059. <var>task list</var>. The default action of this event must be, if the user agent
  43060. <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
  43061. 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
  43062. discard that <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-7>application cache</a>.</p>
  43063. <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
  43064. 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
  43065. 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>
  43066. <li>
  43067. <p>Otherwise, if <i>fetching the manifest</i> fails in some other way (e.g. the server returns
  43068. 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
  43069. there is a DNS error, or the connection times out, or the user cancels the download, or the
  43070. parser for manifests fails when checking the magic signature), or if the server returned a
  43071. 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>
  43072. <li>
  43073. <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
  43074. downloaded <var>manifest</var> is byte-for-byte identical to the manifest found in the
  43075. <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>
  43076. <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>
  43077. <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>
  43078. <li>
  43079. <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
  43080. resource for this entry to have either completely downloaded or failed.</p>
  43081. <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
  43082. connection times out, or the user cancels the download), or if the resource is labeled with
  43083. 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
  43084. <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
  43085. 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
  43086. <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
  43087. the user that the user agent failed to save the application for offline use.</p>
  43088. <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
  43089. 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>
  43090. 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
  43091. 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>
  43092. 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>
  43093. obtained from applying the <a href=#concept-url-serialiser id=downloading-or-updating-an-application-cache:concept-url-serialiser>URL serialiser</a>
  43094. 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
  43095. (application caches never include fragment identifiers).</p>
  43096. <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
  43097. <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
  43098. 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
  43099. 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
  43100. 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
  43101. display of some sort of user interface indicating to the user that the application is up to
  43102. 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
  43103. 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
  43104. 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>
  43105. <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
  43106. <var>cache group</var>. Set its <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-2>completeness
  43107. 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
  43108. <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
  43109. 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
  43110. 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>
  43111. 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
  43112. 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
  43113. some sort of user interface indicating to the user that a new version is being
  43114. 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
  43115. entries</a> obtained by parsing <var>manifest</var> to <var>file list</var>,
  43116. 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
  43117. entries</a> obtained by parsing <var>manifest</var> to <var>file list</var>,
  43118. 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
  43119. 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
  43120. flag</a> is <i>complete</i> to <var>file list</var>, each flagged with "master
  43121. entry".<li><p>If any URL is in <var>file list</var> more than once, then merge the entries into
  43122. one entry for that URL, that entry having all the flags that the original entries had.<li>
  43123. <p>For each URL in <var>file list</var>, run the following steps. These steps may be
  43124. run in parallel for two or more of the URLs at a time. If, while running these steps, the
  43125. <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
  43126. <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
  43127. 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>
  43128. instead.</p>
  43129. <ol><li>
  43130. <p>If the resource URL being processed was flagged as neither an "explicit entry" nor or a
  43131. "fallback entry", then the user agent may skip this URL.</p>
  43132. <p class=note>This is intended to allow user agents to expire resources not listed in the
  43133. manifest from the cache. Generally, implementors are urged to use an approach that expires
  43134. lesser-used resources first.</p>
  43135. <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
  43136. <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>
  43137. 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
  43138. 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
  43139. <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
  43140. 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
  43141. 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
  43142. <var>file list</var> that have been either downloaded or skipped so far. The default
  43143. 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
  43144. display of some sort of user interface indicating to the user that a file is being downloaded
  43145. in preparation for updating the application. <a href=#refsXHR>[XHR]</a><li>
  43146. <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
  43147. <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
  43148. 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
  43149. expiration, ETags, and so forth) with respect to that cache. User agents may also have other
  43150. caches in place that are also honored.</p>
  43151. <p class=note>If the resource in question is already being downloaded for other reasons then
  43152. the existing download process can sometimes be used for the purposes of this step, as defined
  43153. by the <a href=#fetch id=downloading-or-updating-an-application-cache:fetch-3>fetching</a> algorithm.</p>
  43154. <p class=example>An example of a resource that might already be being downloaded is a large
  43155. image on a Web page that is being seen for the first time. The image would get downloaded to
  43156. 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
  43157. manifest. According to the rules for <a href=#fetch id=downloading-or-updating-an-application-cache:fetch-4>fetching</a> that image only need
  43158. be downloaded once, and it can be used both for the cache and for the rendered Web page.</p>
  43159. <li>
  43160. <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
  43161. connection times out, or the user cancels the download), or if the server returned a redirect,
  43162. or if the resource is labeled with the "no-store" cache directive, then run the first
  43163. appropriate step from the following list: <a href=#refsHTTP>[HTTP]</a></p>
  43164. <dl class=switch><dt>If the URL being processed was flagged as an "explicit entry" or a "fallback entry"<dd>
  43165. <p>If these steps are being run in parallel for any other URLs in <var>file
  43166. 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
  43167. steps</a>.</p>
  43168. <p class=note>Redirects are fatal because they are either indicative of a network problem
  43169. (e.g. a captive portal); or would allow resources to be added to the cache under URLs that
  43170. differ from any URL that the networking model will allow access to, leaving orphan entries;
  43171. or would allow resources to be stored under URLs different than their true URLs. All of
  43172. these situations are bad.</p>
  43173. <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>
  43174. <p>Skip this resource. It is dropped from the cache.</p>
  43175. <dt>Otherwise<dd>
  43176. <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
  43177. flag</a> is <i>complete</i>, and act as if that was the fetched resource, ignoring the
  43178. resource obtained from the network.</p>
  43179. </dl>
  43180. <p>User agents may warn the user of these errors as an aid to development.</p>
  43181. <p class=note>These rules make errors for resources listed in the manifest fatal, while
  43182. making it possible for other resources to be removed from caches when they are removed from
  43183. the server, without errors, and making non-manifest resources survive server-side errors.</p>
  43184. <p class=note>Except for the "no-store" directive, HTTP caching rules that would cause a
  43185. file to be expired or otherwise not cached are ignored for the purposes of the
  43186. <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-9>application cache download process</a>.</p>
  43187. <li>
  43188. <p>Otherwise, the fetching succeeded. Store the resource in the <var>new
  43189. cache</var>.</p>
  43190. <p>If the user agent is not able to store the resource (e.g. because of quota restrictions),
  43191. the user agent may prompt the user or try to resolve the problem in some other manner (e.g.
  43192. automatically pruning content in other caches). If the problem cannot be resolved, the user
  43193. 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>
  43194. <li><p>If the URL being processed was flagged as an "explicit entry" in <var>file
  43195. 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
  43196. entry</a>.<li><p>If the URL being processed was flagged as a "fallback entry" in <var>file
  43197. 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
  43198. entry</a>.<li><p>If the URL being processed was flagged as an "master entry" in <var>file
  43199. 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
  43200. entry</a>.<li><p>As an optimization, if the resource is an HTML or XML file whose root element is an
  43201. <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
  43202. whose value doesn't match the manifest URL of the application cache being processed, then the
  43203. 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>
  43204. </ol>
  43205. <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>
  43206. 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,
  43207. 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
  43208. <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
  43209. 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
  43210. <var>file list</var>. The default action of these events must be, if the user agent
  43211. <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
  43212. 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>,
  43213. 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
  43214. 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
  43215. 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
  43216. 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
  43217. <var>new cache</var>.<li>
  43218. <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
  43219. resource for this entry to have either completely downloaded or failed.</p>
  43220. <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
  43221. connection times out, or the user cancels the download), or if the resource is labeled with the
  43222. "no-store" cache directive, then run these substeps:</p>
  43223. <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
  43224. 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
  43225. cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-error-3><a href=#event-appcache-error>error</a></code> at the
  43226. <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
  43227. 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
  43228. progress</a>, the display of some sort of user interface indicating to the user that the
  43229. user agent failed to save the application for offline use.</p>
  43230. <li>
  43231. <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
  43232. 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
  43233. further substeps:</p>
  43234. <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>,
  43235. <var>new cache</var>.</p>
  43236. <li><p>If appropriate, remove any user interface indicating that an update for this cache is
  43237. 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>
  43238. <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>
  43239. <p>Otherwise, store the resource for this entry in <var>new cache</var>, if it isn't
  43240. 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
  43241. entry</a>.</p>
  43242. <li>
  43243. <p><a href=#fetch id=downloading-or-updating-an-application-cache:fetch-5>Fetch</a> the resource from <var>manifest URL</var> again, with
  43244. the <i>synchronous flag</i> set, and let <var>second manifest</var> be that resource.
  43245. HTTP caching semantics should again be honored for this request.</p>
  43246. <p class=note>Since caching can be honored, authors are encouraged to avoid setting the cache
  43247. headers on the manifest in such a way that the user agent would simply not contact the network
  43248. for this second request; otherwise, the user agent would not notice if the cache had changed
  43249. during the cache update process.</p>
  43250. <li>
  43251. <p>If the previous step failed for any reason, or if the fetching attempt involved a redirect,
  43252. or if <var>second manifest</var> and <var>manifest</var> are not byte-for-byte
  43253. identical, then schedule a rerun of the entire algorithm with the same parameters after a short
  43254. 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>
  43255. <li>
  43256. <p>Otherwise, store <var>manifest</var> in <var>new cache</var>, if it's not
  43257. there already, and categorise its entry as <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest-4>the
  43258. manifest</a>.</p>
  43259. <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>
  43260. <li>
  43261. <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
  43262. <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
  43263. 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>
  43264. 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
  43265. <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
  43266. <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
  43267. the user that the application has been cached and that they can now use it offline.</p>
  43268. <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
  43269. <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
  43270. 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>
  43271. 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
  43272. <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
  43273. <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
  43274. the user that a new version is available and that they can activate it by reloading the
  43275. page.</p>
  43276. <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
  43277. 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
  43278. 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>
  43279. <p>The <dfn id=cache-failure-steps>cache failure steps</dfn> are as follows:</p>
  43280. <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>
  43281. <li>
  43282. <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
  43283. following further substeps. These steps may be run in parallel for two or more entries at a
  43284. time.</p>
  43285. <ol><li><p>Wait for the resource for this entry to have either completely downloaded or failed.</p>
  43286. <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
  43287. 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
  43288. 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
  43289. <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
  43290. still is one, and append it to <var>task list</var>. The default action of these
  43291. 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
  43292. of user interface indicating to the user that the user agent failed to save the application for
  43293. offline use.</p>
  43294. </ol>
  43295. <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>
  43296. 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
  43297. 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
  43298. 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
  43299. <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
  43300. 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
  43301. that <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-24>application cache</a>.</p>
  43302. <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
  43303. 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
  43304. 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>
  43305. <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>
  43306. <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
  43307. process</a> may be done with cache-defeating semantics, to avoid problems with stale or
  43308. inconsistent intermediary caches.</p>
  43309. <hr>
  43310. <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,
  43311. 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
  43312. allows user agents to keep caches primed and to update caches even before the user visits a
  43313. site.</p>
  43314. <hr>
  43315. <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
  43316. 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
  43317. list must be empty.</p>
  43318. <p>When the steps above say to <dfn id=queue-a-post-load-task>queue a post-load task</dfn> <var>task</var>, where
  43319. <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
  43320. 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
  43321. the appropriate steps from the following list:</p>
  43322. <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
  43323. <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
  43324. 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>
  43325. <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
  43326. <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
  43327. 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
  43328. the following steps:</p>
  43329. <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
  43330. 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
  43331. <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>
  43332. <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
  43333. <a href=#networking-task-source id=downloading-or-updating-an-application-cache:networking-task-source>networking task source</a>.</p>
  43334. <h4 id=the-application-cache-selection-algorithm>7.7.5 The application cache selection algorithm</h4>
  43335. <p>When the <dfn id=concept-appcache-init>application cache selection algorithm</dfn>
  43336. 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
  43337. manifest <a href=#url id=the-application-cache-selection-algorithm:url>URL</a> <var>manifest URL</var>, the user agent must run the first
  43338. applicable set of steps from the following list:</p>
  43339. <dl class=switch><dt>If there is a <var>manifest URL</var>, and <var>document</var> was loaded
  43340. 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
  43341. group</a> is <em>not</em> the same as <var>manifest URL</var><dd>
  43342. <p>Mark the entry for the resource from which <var>document</var> was taken in the
  43343. <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>
  43344. <p>Restart the current navigation from the top of the <a href=#navigate id=the-application-cache-selection-algorithm:navigate>navigation
  43345. algorithm</a>, undoing any changes that were made as part of the initial load (changes can be
  43346. 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>
  43347. is only ever completed <em>after</em> this <a href=#concept-appcache-init id=the-application-cache-selection-algorithm:concept-appcache-init>application cache
  43348. selection algorithm</a> is run, though this is not required).</p>
  43349. <p class=note>The navigation will not result in the same resource being loaded, because
  43350. "foreign" entries are never picked during navigation.</p>
  43351. <p>User agents may notify the user of the inconsistency between the cache manifest and the
  43352. document's own metadata, to aid in application development.</p>
  43353. <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
  43354. <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>
  43355. <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
  43356. 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
  43357. 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>
  43358. <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
  43359. equivalent</a>, and, there is a <var>manifest URL</var>, and <var>manifest
  43360. URL</var> has the <a href=#same-origin id=the-application-cache-selection-algorithm:same-origin>same origin</a> as <var>document</var><dd>
  43361. <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>
  43362. 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>
  43363. <p>If there are <a href=#relevant-application-cache id=the-application-cache-selection-algorithm:relevant-application-cache>relevant application caches</a> that
  43364. 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
  43365. 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
  43366. the <a href=#concept-appcache-selection id=the-application-cache-selection-algorithm:concept-appcache-selection>most appropriate application cache</a> of those
  43367. that match as an HTTP cache for any subresource loads. User agents may also have other caches in
  43368. place that are also honored.</p>
  43369. <dt>Otherwise<dd>
  43370. <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>
  43371. <p>If there was a <var>manifest URL</var>, the user agent may report to the user that
  43372. it was ignored, to aid in application development.</p>
  43373. </dl>
  43374. <h4 id=changesToNetworkingModel>7.7.6 Changes to the networking model</h4>
  43375. <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
  43376. 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
  43377. instead of immediately invoking the mechanisms appropriate to that resource's scheme:</p>
  43378. <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
  43379. 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
  43380. <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,
  43381. 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>,
  43382. <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>,
  43383. 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
  43384. 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
  43385. URL, then <a href=#fetch id=changesToNetworkingModel:fetch-2>fetch</a> the resource normally and abort these steps.<li>
  43386. <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
  43387. <a href=#concept-appcache-fallback-ns id=changesToNetworkingModel:concept-appcache-fallback-ns>fallback namespace</a> <var>f</var> in
  43388. 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,
  43389. then:</p>
  43390. <p><a href=#fetch id=changesToNetworkingModel:fetch-3>Fetch</a> the resource normally. If this results in a redirect to a resource with
  43391. 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
  43392. not if the user canceled the download), then instead get, from the cache, the resource of the
  43393. <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
  43394. these steps.</p>
  43395. <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>
  43396. <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
  43397. <a href=#application-cache id=changesToNetworkingModel:application-cache-7>application cache</a> has been primed the first time), making the testing of offline
  43398. applications simpler.</p>
  43399. <h4 id=expiring-application-caches>7.7.7 Expiring application caches</h4>
  43400. <p>As a general rule, user agents should not expire application caches, except on request from the
  43401. user, or after having been left unused for an extended period of time.</p>
  43402. <p>Application caches and cookies have similar implications with respect to privacy (e.g. if the
  43403. site can identify the user when providing the cache, it can store data in the cache that can be
  43404. used for cookie resurrection). Implementors are therefore encouraged to expose application caches
  43405. in a manner related to HTTP cookies, allowing caches to be expunged together with cookies and
  43406. other origin-specific data.</p>
  43407. <p class=example>For example, a user agent could have a "delete site-specific data" feature that
  43408. clears all cookies, application caches, local storage, databases, etc, from an origin all at
  43409. once.</p>
  43410. <h4 id=disk-space>7.7.8 Disk space</h4>
  43411. <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
  43412. be easily worked around using subdomains.</p>
  43413. <p>User agents should allow users to see how much space each domain is using, and may offer the
  43414. user the ability to delete specific <a href=#application-cache id=disk-space:application-cache-2>application caches</a>.</p>
  43415. <p>For predictability, quotas should be based on the uncompressed size of data stored.</p>
  43416. <p class=note>How quotas are presented to the user is not defined by this specification. User
  43417. agents are encouraged to provide features such as allowing a user to indicate that certain sites
  43418. are trusted to use more than the default quota, e.g. by asynchronously presenting a user interface
  43419. while a cache is being updated, or by having an explicit whitelist in the user agent's
  43420. configuration interface.</p>
  43421. <h4 id=security-concerns-with-offline-applications-caches>7.7.9 Security concerns with offline applications caches</h4>
  43422. <p><i>This section is non-normative.</i></p>
  43423. <p>The main risk introduced by offline application caches is that an injection attack can be
  43424. elevated into persistent site-wide page replacement. This attack involves using an injection
  43425. vulnerability to upload two files to the victim site. The first file is an application cache
  43426. manifest consisting of just a fallback entry pointing to the second file, which is an HTML page
  43427. whose manifest is declared as that first file. Once the user has been directed to that second
  43428. file, all subsequent accesses to any file covered by the given fallback namespace while either the
  43429. user or the site is offline will instead show that second file. Targetted denial-of-service
  43430. attacks can be used to ensure that the site appears offline.</p>
  43431. <p>To mitigate this, manifests can only specify fallbacks that are in the same path as the
  43432. manifest itself. This means that a content injection upload vulnerability in a particular
  43433. directory on a server can only be escalated to a take-over of that directory and its
  43434. subdirectories. If there is no way to inject a file into the root directory, the entire site
  43435. cannot be taken over.</p>
  43436. <p>If a site has been attacked in this way, simply removing the offending manifest will eventually
  43437. clear the problem, since the next time the manifest is updated, a 404 error will be seen, and the
  43438. user agent will clear the cache. "Eventually" is the key word here, however; while the attack on
  43439. the user or server is ongoing, such that connections from an affected user to the affected site
  43440. are blocked, the user agent will simply assume that the user is offline and will continue to use
  43441. the hostile manifest.</p>
  43442. <p>TLS does not inherently protect a site from this attack, since the attack relies on content
  43443. being served from the server itself. Not using application caches also does not prevent this
  43444. attack, since the attack relies on an attacker-provided manifest.</p>
  43445. <h4 id=application-cache-api>7.7.10 Application cache API</h4>
  43446. <pre class=idl>[Exposed=(Window,SharedWorker)]
  43447. interface <dfn id=applicationcache>ApplicationCache</dfn> : <a href=#eventtarget id=application-cache-api:eventtarget>EventTarget</a> {
  43448. // <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status>update status</a>
  43449. const unsigned short <a href=#dom-appcache-uncached id=application-cache-api:dom-appcache-uncached>UNCACHED</a> = 0;
  43450. const unsigned short <a href=#dom-appcache-idle id=application-cache-api:dom-appcache-idle>IDLE</a> = 1;
  43451. const unsigned short <a href=#dom-appcache-checking id=application-cache-api:dom-appcache-checking>CHECKING</a> = 2;
  43452. const unsigned short <a href=#dom-appcache-downloading id=application-cache-api:dom-appcache-downloading>DOWNLOADING</a> = 3;
  43453. const unsigned short <a href=#dom-appcache-updateready id=application-cache-api:dom-appcache-updateready>UPDATEREADY</a> = 4;
  43454. const unsigned short <a href=#dom-appcache-obsolete id=application-cache-api:dom-appcache-obsolete>OBSOLETE</a> = 5;
  43455. readonly attribute unsigned short <a href=#dom-appcache-status id=application-cache-api:dom-appcache-status>status</a>;
  43456. // updates
  43457. void <a href=#dom-appcache-update id=application-cache-api:dom-appcache-update>update</a>();
  43458. void <a href=#dom-appcache-abort id=application-cache-api:dom-appcache-abort>abort</a>();
  43459. void <a href=#dom-appcache-swapcache id=application-cache-api:dom-appcache-swapcache>swapCache</a>();
  43460. // events
  43461. 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>;
  43462. 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>;
  43463. 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>;
  43464. 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>;
  43465. 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>;
  43466. 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>;
  43467. 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>;
  43468. 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>;
  43469. };</pre>
  43470. <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>
  43471. <p>(In a window.) Returns the <code id=application-cache-api:applicationcache><a href=#applicationcache>ApplicationCache</a></code> object that applies to the
  43472. <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>
  43473. <dt><var>cache</var> = <var>self</var> . <code id=application-cache-api:dom-applicationcache-2><a href=#dom-applicationcache>applicationCache</a></code><dd>
  43474. <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
  43475. current shared worker.</p>
  43476. <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-status-2><a href=#dom-appcache-status>status</a></code><dd>
  43477. <p>Returns the current status of the application cache, as given by the constants defined
  43478. below.</p>
  43479. <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-update-2><a href=#dom-appcache-update>update</a></code>()<dd>
  43480. <p>Invokes the <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process>application cache download process</a>.</p>
  43481. <p>Throws an <code id=application-cache-api:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if there is no application cache to
  43482. update.</p>
  43483. <p>Calling this method is not usually necessary, as user agents will generally take care of
  43484. updating <a href=#application-cache id=application-cache-api:application-cache>application caches</a> automatically.</p>
  43485. <p>The method can be useful in situations such as long-lived applications. For example, a Web
  43486. mail application might stay open in a browser tab for weeks at a time. Such an application could
  43487. want to test for updates each day.</p>
  43488. <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-abort-2><a href=#dom-appcache-abort>abort</a></code>()<dd>
  43489. <p>Cancels the <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process-2>application cache download process</a>.</p>
  43490. <p>This method is intended to be used by Web application showing their own caching progress UI,
  43491. in case the user wants to stop the update (e.g. because bandwidth is limited).</p>
  43492. <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-swapcache-2><a href=#dom-appcache-swapcache>swapCache</a></code>()<dd>
  43493. <p>Switches to the most recent application cache, if there is a newer one. If there isn't,
  43494. throws an <code id=application-cache-api:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
  43495. <p>This does not cause previously-loaded resources to be reloaded; for example, images do not
  43496. suddenly get reloaded and style sheets and scripts do not get reparsed or reevaluated. The only
  43497. change is that subsequent requests for cached resources will obtain the newer copies.</p>
  43498. <p>The <code id=application-cache-api:event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> event will fire before this
  43499. method can be called. Once it fires, the Web application can, at its leisure, call this method
  43500. to switch the underlying cache to the one with the more recent updates. To make proper use of
  43501. this, applications have to be able to bring the new features into play; for example, reloading
  43502. scripts to enable new features.</p>
  43503. <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
  43504. 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>
  43505. </dl>
  43506. <p>There is a one-to-one mapping from <a href=#cache-host id=application-cache-api:cache-host>cache hosts</a> to
  43507. <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>
  43508. objects must return the <code id=application-cache-api:applicationcache-4><a href=#applicationcache>ApplicationCache</a></code> object associated with the
  43509. <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
  43510. 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>
  43511. object associated with the worker.</p>
  43512. <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
  43513. 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
  43514. <a href=#application-cache id=application-cache-api:application-cache-2>application cache</a>.</p>
  43515. <hr>
  43516. <p>The <dfn id=dom-appcache-status><code>status</code></dfn> attribute, on getting, must
  43517. return the current state of the <a href=#application-cache id=application-cache-api:application-cache-3>application cache</a> that the
  43518. <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
  43519. must be the appropriate value from the following list:</p>
  43520. <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
  43521. 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
  43522. <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
  43523. cache</a> is the <a href=#concept-appcache-newer id=application-cache-api:concept-appcache-newer>newest</a> cache in its
  43524. <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
  43525. 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
  43526. <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
  43527. <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
  43528. <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
  43529. cache group</a> is not marked as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete-2>obsolete</a>, but
  43530. 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
  43531. <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>
  43532. <hr>
  43533. <p>If the <dfn id=dom-appcache-update><code>update()</code></dfn> method is invoked, the user
  43534. 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
  43535. <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
  43536. <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
  43537. 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>,
  43538. 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
  43539. <code id=application-cache-api:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception instead.</p>
  43540. <p>If the <dfn id=dom-appcache-abort><code>abort()</code></dfn> method is invoked, the user
  43541. 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>
  43542. 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
  43543. <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
  43544. 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
  43545. download process</a>, then do nothing.</p>
  43546. <p>If the <dfn id=dom-appcache-swapcache><code>swapCache()</code></dfn> method is invoked,
  43547. the user agent must run the following steps:
  43548. <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
  43549. with an <a href=#application-cache id=application-cache-api:application-cache-16>application cache</a>. If it is not, then throw an
  43550. <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
  43551. <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,
  43552. 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
  43553. <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
  43554. 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>
  43555. as <var>cache</var> whose <a href=#concept-appcache-completeness id=application-cache-api:concept-appcache-completeness>completeness
  43556. 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
  43557. <var>cache</var>. If there is not, then throw an <code id=application-cache-api:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code>
  43558. 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
  43559. <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>
  43560. <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
  43561. 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
  43562. <code id=application-cache-api:applicationcache-20><a href=#applicationcache>ApplicationCache</a></code> interface:</p>
  43563. <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>
  43564. <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>
  43565. <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>
  43566. <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>
  43567. <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>
  43568. <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>
  43569. <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>
  43570. <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>
  43571. <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>
  43572. </table>
  43573. <h4 id=browser-state>7.7.11 Browser state</h4>
  43574. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  43575. interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
  43576. readonly attribute boolean <a href=#dom-navigator-online id=browser-state:dom-navigator-online>onLine</a>;
  43577. };</pre>
  43578. <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>
  43579. <p>Returns false if the user agent is definitely offline (disconnected from the network).
  43580. Returns true if the user agent might be online.</p>
  43581. <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>
  43582. </dl>
  43583. <p>The <dfn id=dom-navigator-online><code>navigator.onLine</code></dfn> attribute must return
  43584. false if the user agent will not contact the network when the user follows links or when a script
  43585. requests a remote page (or knows that such an attempt would fail), and must return true
  43586. otherwise.</p>
  43587. <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
  43588. <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
  43589. 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>
  43590. 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>
  43591. <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
  43592. <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
  43593. 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
  43594. 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>
  43595. <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
  43596. <a href=#networking-task-source id=browser-state:networking-task-source>networking task source</a>.</p>
  43597. <p class=note>This attribute is inherently unreliable. A computer can be connected to a network
  43598. without having Internet access.</p>
  43599. <div class=example>
  43600. <p>In this example, an indicator is updated as the browser goes online and offline.</p>
  43601. <pre>&lt;!DOCTYPE HTML>
  43602. &lt;html>
  43603. &lt;head>
  43604. &lt;title>Online status&lt;/title>
  43605. &lt;script>
  43606. function updateIndicator() {
  43607. document.getElementById('indicator').textContent = navigator.onLine ? 'online' : 'offline';
  43608. }
  43609. &lt;/script>
  43610. &lt;/head>
  43611. &lt;body onload="updateIndicator()" ononline="updateIndicator()" onoffline="updateIndicator()">
  43612. &lt;p>The network is: &lt;span id="indicator">(state unknown)&lt;/span>
  43613. &lt;/body>
  43614. &lt;/html></pre>
  43615. </div>
  43616. <h2 id=webappapis>8 Web application APIs</h2>
  43617. <h3 id=scripting>8.1 Scripting</h3>
  43618. <h4 id=introduction-12>8.1.1 Introduction</h4>
  43619. <p>Various mechanisms can cause author-provided executable code to run in the context of a
  43620. document. These mechanisms include, but are probably not limited to:</p>
  43621. <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
  43622. <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>
  43623. <h4 id=enabling-and-disabling-scripting>8.1.2 Enabling and disabling scripting</h4>
  43624. <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
  43625. context</a></em> when all of the following conditions are true:</p>
  43626. <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.
  43627. (User agents may provide users with the option to disable scripting globally, or in a
  43628. finer-grained manner, e.g. on a per-origin basis.)
  43629. <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>
  43630. <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
  43631. <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
  43632. context flag</a> set.</ul>
  43633. <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>
  43634. 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>
  43635. <hr>
  43636. <p><dfn id=concept-n-script>Scripting is enabled</dfn> for a <em>node</em> if the
  43637. <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>
  43638. 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>
  43639. <p><dfn id=concept-n-noscript>Scripting is disabled</dfn> for a node if there is no such
  43640. <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
  43641. disabled</a> in that <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-8>browsing context</a>.</p>
  43642. <h4 id=processing-model-8>8.1.3 Processing model</h4>
  43643. <h5 id=definitions-2>8.1.3.1 Definitions</h5>
  43644. <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
  43645. <dfn id=dedicated-worker-environment>dedicated worker environment</dfn>, and the <dfn id=shared-worker-environment>shared worker environment</dfn>. The
  43646. <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
  43647. types of <dfn id=worker-environment>worker environments</dfn>.</p>
  43648. <p>Except where otherwise specified, a <a href=#javascript-global-environment id=definitions-2:javascript-global-environment-2>JavaScript global environment</a> is a
  43649. <a href=#document-environment id=definitions-2:document-environment>document environment</a>.</p>
  43650. <hr>
  43651. <p>A <dfn id=concept-script>script</dfn> has:</p>
  43652. <dl><dt>A <dfn id=code-entry-point>code entry-point</dfn><dd>
  43653. <p>A code entry-point represents a block of executable code that the script exposes to other
  43654. scripts and to the user agent. Typically, the code corresponding to the code entry-point is
  43655. executed immediately after the script is parsed, but for event handlers, it is called each time
  43656. the handler is invoked.</p>
  43657. <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
  43658. context of the global code.</p>
  43659. <dt>Optionally, a <dfn id=muted-errors>muted errors</dfn> flag<dd>
  43660. <p>A flag which, if set, means that error information will not be provided for errors in this
  43661. script (used to mute errors for cross-origin scripts, since that can leak private
  43662. information).</p>
  43663. <dt>A <dfn id=settings-object>settings object</dfn><dd>
  43664. <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
  43665. the same context.</p>
  43666. </dl>
  43667. <hr>
  43668. <p>A <dfn id=script-settings-object>script settings object</dfn> specifies algorithms for obtaining the following:</p>
  43669. <dl><dt>A <dfn id=script-execution-environment>script execution environment</dfn> for each language supported by the user agent<dd>
  43670. <p>The characteristics of the script execution environment depend on the language, and are not
  43671. defined by this specification.</p>
  43672. <p class=example>In JavaScript, the script execution environment consists of the interpreter,
  43673. the stack of <i>execution contexts</i>, the <i>global code</i> and <i>function code</i> and the
  43674. <code id=definitions-2:idl-function><a href=#idl-function>Function</a></code> objects resulting, and so forth.</p>
  43675. <dt>A <dfn id=global-object>global object</dfn><dd>
  43676. <p>An object that provides the APIs that can be called by the code in scripts that use this
  43677. <a href=#script-settings-object id=definitions-2:script-settings-object-2>settings object</a>.</p>
  43678. <p class=note>This is typically a <code id=definitions-2:window><a href=#window>Window</a></code> object or a
  43679. <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
  43680. can't do anything that interacts with the environment.</p>
  43681. <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
  43682. ThisBinding of the global execution context for this script must be the <code id=definitions-2:window-3><a href=#window>Window</a></code>
  43683. 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>
  43684. <p class=note>This is a <a href=#willful-violation id=definitions-2:willful-violation>willful violation</a> of the JavaScript specification current
  43685. at the time of writing (ECMAScript edition 5, as defined in section 10.4.1.1 Initial Global
  43686. 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
  43687. compatible with the security design prevalent in implementations as specified herein. <a href=#refsECMA262>[ECMA262]</a></p>
  43688. <dt>A <dfn id=responsible-browsing-context>responsible browsing context</dfn><dd>
  43689. <p>A <a href=#browsing-context id=definitions-2:browsing-context>browsing context</a> that is assigned responsibility for actions taken by the
  43690. scripts that use this <a href=#script-settings-object id=definitions-2:script-settings-object-3>script settings object</a>.</p>
  43691. <p class=example>When a script creates and <a href=#navigate id=definitions-2:navigate>navigates</a> a new
  43692. <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
  43693. 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
  43694. <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>
  43695. <dt>A <dfn id=responsible-document>responsible document</dfn><dd>
  43696. <p>A <code id=definitions-2:document><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the scripts that
  43697. use this <a href=#script-settings-object id=definitions-2:script-settings-object-4>script settings object</a>.</p>
  43698. <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
  43699. <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>
  43700. <dt>A <dfn id=responsible-event-loop>responsible event loop</dfn><dd>
  43701. <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
  43702. loop to use.</p>
  43703. <dt>An <dfn id=api-referrer-source>API referrer source</dfn><dd>
  43704. <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
  43705. <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>
  43706. <dt>An <dfn id=api-url-character-encoding>API URL character encoding</dfn><dd>
  43707. <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
  43708. settings object</a>.</p>
  43709. <dt>An <dfn id=api-base-url>API base URL</dfn><dd>
  43710. <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
  43711. settings object</a> to resolve <a href=#relative-url id=definitions-2:relative-url>relative URLs</a>.</p>
  43712. <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>
  43713. <p>An instrument used in security checks.</p>
  43714. </dl>
  43715. <p>The <dfn id=relevant-settings-object-for-a-global-object>relevant settings object for a global object</dfn> <var>o</var> is the
  43716. <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>.
  43717. (There is always a 1:1 mapping of global objects to script settings objects.)</p>
  43718. <p>The <dfn id=relevant-settings-object-for-a-script>relevant settings object for a script</dfn> <var>s</var> is the
  43719. <a href=#settings-object id=definitions-2:settings-object>settings object</a> of <var>s</var>.</p>
  43720. <h5 id=script-settings-for-browsing-contexts>8.1.3.2 Script settings for browsing contexts</h5>
  43721. <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
  43722. settings object</a> whose algorithms are defined as follows:</p>
  43723. <dl><dt>The <a href=#script-execution-environment id=script-settings-for-browsing-contexts:script-execution-environment>script execution environments</a><dd>
  43724. <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
  43725. user agent, create an appropriate execution environment as defined by the relevant
  43726. specification.</p>
  43727. <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
  43728. 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>
  43729. <dt>The <a href=#global-object id=script-settings-for-browsing-contexts:global-object>global object</a><dd>
  43730. <p>Return the <code id=script-settings-for-browsing-contexts:window-2><a href=#window>Window</a></code> object itself.</p>
  43731. <dt>The <a href=#responsible-browsing-context id=script-settings-for-browsing-contexts:responsible-browsing-context>responsible browsing context</a><dd>
  43732. <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
  43733. associated.</p>
  43734. <dt>The <a href=#responsible-document id=script-settings-for-browsing-contexts:responsible-document>responsible document</a><dd>
  43735. <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
  43736. associated.</p>
  43737. <dt>The <a href=#responsible-event-loop id=script-settings-for-browsing-contexts:responsible-event-loop>responsible event loop</a><dd>
  43738. <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
  43739. 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
  43740. context</a> belongs.</p>
  43741. <dt>The <a href=#api-referrer-source id=script-settings-for-browsing-contexts:api-referrer-source>API referrer source</a><dd>
  43742. <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
  43743. associated.</p>
  43744. <dt>The <a href=#api-url-character-encoding id=script-settings-for-browsing-contexts:api-url-character-encoding>API URL character encoding</a><dd>
  43745. <p>Return the current <a href="#document's-character-encoding" id="script-settings-for-browsing-contexts:document's-character-encoding">character encoding</a> of
  43746. 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>
  43747. <dt>The <a href=#api-base-url id=script-settings-for-browsing-contexts:api-base-url>API base URL</a><dd>
  43748. <p>Return the current <a href=#document-base-url id=script-settings-for-browsing-contexts:document-base-url>base URL</a> of the
  43749. <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>
  43750. <dt>The <a href=#origin-2 id=script-settings-for-browsing-contexts:origin-2>origin</a><dd>
  43751. <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
  43752. <code id=script-settings-for-browsing-contexts:window-9><a href=#window>Window</a></code> is currently associated.</p>
  43753. <dt>The <a href=#effective-script-origin id=script-settings-for-browsing-contexts:effective-script-origin>effective script origin</a><dd>
  43754. <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
  43755. <code id=script-settings-for-browsing-contexts:window-10><a href=#window>Window</a></code> is currently associated.</p>
  43756. </dl>
  43757. <h5 id=calling-scripts>8.1.3.3 Calling scripts</h5>
  43758. <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
  43759. settings objects</dfn>, which must be initially empty. When a new <a href=#script-settings-object id=calling-scripts:script-settings-object>script settings
  43760. 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>
  43761. 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
  43762. most recently pushed onto it is to be <i>popped</i> from the stack, it must be removed. Entries on
  43763. this stack can be labeled as <dfn id=candidate-entry-settings-object>candidate entry
  43764. settings objects</dfn>.</p>
  43765. <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
  43766. following steps:</p>
  43767. <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
  43768. <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
  43769. 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
  43770. 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>
  43771. <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>
  43772. <var>o</var> are as follows. They return either "run" or "do not run".</p>
  43773. <ol><li><p>If the <a href=#global-object id=calling-scripts:global-object>global object</a> specified by <var>o</var> is a
  43774. <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>,
  43775. then return "do not run" and abort these steps.</p>
  43776. <li><p>If <a href=#concept-bc-noscript id=calling-scripts:concept-bc-noscript>scripting is disabled</a> for the
  43777. <a href=#responsible-browsing-context id=calling-scripts:responsible-browsing-context>responsible browsing context</a> specified by <var>o</var>, then return "do
  43778. not run" and abort these steps.</p>
  43779. <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
  43780. 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>
  43781. <p>The steps to <dfn id=clean-up-after-running-a-callback>clean up after running a callback</dfn> are as follows:</p>
  43782. <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
  43783. 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
  43784. 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
  43785. microtask checkpoint</a>. (If this runs scripts, these algorithms will be invoked
  43786. reentrantly.)</ol>
  43787. <p class=note>These algorithms are not invoked by one script directly calling another, but they
  43788. can be invoked reentrantly in an indirect manner, e.g. if a script dispatches an event which has
  43789. event listeners registered.</p>
  43790. <p>When a JavaScript <i>SourceElements</i> production is to be evaluated, the <a href=#settings-object id=calling-scripts:settings-object-2>settings
  43791. object</a> of the <a href=#concept-script id=calling-scripts:concept-script-2>script</a> corresponding to that
  43792. <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
  43793. the evaluation begins, and popped when the evaluation ends (regardless of whether it's an abrupt
  43794. completion or not).</p>
  43795. <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
  43796. 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
  43797. <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
  43798. 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
  43799. 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
  43800. <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
  43801. similar-origin browsing contexts</a>.</p>
  43802. <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
  43803. <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
  43804. 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
  43805. used in some security checks.</p>
  43806. <p class=note>The Web IDL specification also uses these algorithms. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  43807. <hr>
  43808. <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
  43809. clean-up jobs list</dfn>, which must initially be empty. A global script clean-up job cannot run
  43810. scripts, and cannot be sensitive to the order in which other clean-up jobs are executed. The File
  43811. 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>
  43812. <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
  43813. 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
  43814. list.</p>
  43815. <h5 id=creating-scripts>8.1.3.4 Creating scripts</h5>
  43816. <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
  43817. scripting language, a <a href=#script-settings-object id=creating-scripts:script-settings-object>script settings object</a>, and optionally a <var>muted
  43818. errors</var> flag, the user agent must run the following steps:</p>
  43819. <ol><li><p>Let <var>script</var> be a new <a href=#concept-script id=creating-scripts:concept-script-2>script</a> that
  43820. 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
  43821. context</a> passed to this algorithm, then abort these steps, as if the script source
  43822. described a program that did nothing but return void.</p>
  43823. <li><p>Obtain the appropriate <a href=#script-execution-environment id=creating-scripts:script-execution-environment>script execution environment</a> for the given scripting
  43824. 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
  43825. 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
  43826. 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>
  43827. <p>If all the steps above succeeded (in particular, if the script was compiled successfully),
  43828. <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
  43829. entry-point</a>.</p>
  43830. <p>Otherwise, <a href=#report-the-error id=creating-scripts:report-the-error>report the error</a> for <var>script</var>, with the
  43831. problematic position (line number and column number), using the <a href=#global-object id=creating-scripts:global-object>global object</a>
  43832. 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
  43833. the user.</p>
  43834. </ol>
  43835. <h5 id=killing-scripts>8.1.3.5 Killing scripts</h5>
  43836. <p>User agents may impose resource limitations on scripts, for example CPU quotas, memory limits,
  43837. total execution time limits, or bandwidth limitations. When a script exceeds a limit, the user
  43838. agent may either throw a <code id=killing-scripts:quotaexceedederror><a href=#quotaexceedederror>QuotaExceededError</a></code> exception, abort the script without an
  43839. exception, prompt the user, or throttle script execution.</p>
  43840. <div class=example>
  43841. <p>For example, the following script never terminates. A user agent could, after waiting for a
  43842. few seconds, prompt the user to either terminate the script or let it continue.</p>
  43843. <pre>&lt;script>
  43844. while (true) { /* loop */ }
  43845. &lt;/script></pre>
  43846. </div>
  43847. <p>User agents are encouraged to allow users to disable scripting whenever the user is prompted
  43848. 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
  43849. of a script's actions (e.g. because it has exceeded a time limit).</p>
  43850. <p>If scripting is disabled while a script is executing, the script should be terminated
  43851. immediately.</p>
  43852. <p>User agents may allow users to specifically disable scripts just for the purposes of closing a
  43853. <a href=#browsing-context id=killing-scripts:browsing-context>browsing context</a>.</p>
  43854. <p class=example>For example, the prompt mentioned in the example above could also offer the
  43855. 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>
  43856. <h5 id=runtime-script-errors>8.1.3.6 Runtime script errors</h5>
  43857. <p>When the user agent is required to <dfn id=report-the-error>report an error</dfn> for a
  43858. particular <a href=#concept-script id=runtime-script-errors:concept-script>script</a> <var>script</var> with a particular
  43859. 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
  43860. handled</i></dfn>:</p>
  43861. <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
  43862. 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
  43863. helpful manner.
  43864. <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>
  43865. <li><p>Let <var>error object</var> be the object that represents the error: in the case of an
  43866. uncaught exception, that would be the object that was thrown; in the case of a JavaScript error
  43867. that would be an <code id=runtime-script-errors:idl-error><a href=#idl-error>Error</a></code> object. If there is no corresponding
  43868. object, then the null value must be used instead.<li>
  43869. <p>Let <var>location</var> be an <a href=#absolute-url id=runtime-script-errors:absolute-url>absolute URL</a> that corresponds to the
  43870. resource from which <var>script</var> was obtained.</p>
  43871. <p class=note>The resource containing the script will typically be the file from which the
  43872. <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
  43873. handler content attributes</a>; or the JavaScript file that the script was in, for external
  43874. scripts. Even for dynamically-generated scripts, user agents are strongly encouraged to attempt
  43875. to keep track of the original source of a script. For example, if an external script uses the
  43876. <code id=runtime-script-errors:dom-document-write><a href=#dom-document-write>document.write()</a></code> API to insert an inline
  43877. <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
  43878. ideally be reported as being the external script, and the line number might ideally be reported
  43879. 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
  43880. string passed to that call was first constructed. Naturally, implementing this can be somewhat
  43881. non-trivial.</p>
  43882. <p class=note>User agents are similarly encouraged to keep careful track of the original line
  43883. 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
  43884. 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
  43885. multiple lines.</p>
  43886. <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>
  43887. 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>
  43888. <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
  43889. 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>
  43890. 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>
  43891. 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>
  43892. 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>
  43893. 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>
  43894. </ol>
  43895. <h6 id=runtime-script-errors-in-documents>8.1.3.6.1 Runtime script errors in documents</h6>
  43896. <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
  43897. <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
  43898. 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
  43899. 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
  43900. the user.</p>
  43901. <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>
  43902. <pre class=idl>[Constructor(DOMString type, optional <a href=#erroreventinit id=the-errorevent-interface:erroreventinit>ErrorEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  43903. interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event id=the-errorevent-interface:event>Event</a> {
  43904. readonly attribute DOMString <a href=#dom-errorevent-message id=the-errorevent-interface:dom-errorevent-message>message</a>;
  43905. readonly attribute DOMString <a href=#dom-errorevent-filename id=the-errorevent-interface:dom-errorevent-filename>filename</a>;
  43906. readonly attribute unsigned long <a href=#dom-errorevent-lineno id=the-errorevent-interface:dom-errorevent-lineno>lineno</a>;
  43907. readonly attribute unsigned long <a href=#dom-errorevent-colno id=the-errorevent-interface:dom-errorevent-colno>colno</a>;
  43908. readonly attribute any <a href=#dom-errorevent-error id=the-errorevent-interface:dom-errorevent-error>error</a>;
  43909. };
  43910. dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit id=the-errorevent-interface:eventinit>EventInit</a> {
  43911. DOMString message;
  43912. DOMString filename;
  43913. unsigned long lineno;
  43914. unsigned long colno;
  43915. any error;
  43916. };</pre>
  43917. <p>The <dfn id=dom-errorevent-message><code>message</code></dfn> attribute must return the
  43918. value it was initialised to. When the object is created, this attribute must be initialised to the
  43919. empty string. It represents the error message.</p>
  43920. <p>The <dfn id=dom-errorevent-filename><code>filename</code></dfn> attribute must return the
  43921. value it was initialised to. When the object is created, this attribute must be initialised to the
  43922. 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
  43923. originally occurred.</p>
  43924. <p>The <dfn id=dom-errorevent-lineno><code>lineno</code></dfn> attribute must return the
  43925. value it was initialised to. When the object is created, this attribute must be initialised to
  43926. zero. It represents the line number where the error occurred in the script.</p>
  43927. <p>The <dfn id=dom-errorevent-colno><code>colno</code></dfn> attribute must return the value
  43928. it was initialised to. When the object is created, this attribute must be initialised to zero. It
  43929. represents the column number where the error occurred in the script.</p>
  43930. <p>The <dfn id=dom-errorevent-error><code>error</code></dfn> attribute must return the value
  43931. it was initialised to. When the object is created, this attribute must be initialised to null.
  43932. Where appropriate, it is set to the object representing the error (e.g. the exception object in
  43933. the case of an uncaught DOM exception).</p>
  43934. <h4 id=event-loops>8.1.4 Event loops</h4>
  43935. <h5 id=definitions-3>8.1.4.1 Definitions</h5>
  43936. <p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
  43937. agents must use <dfn id=event-loop>event loops</dfn> as described in this section. There are
  43938. two kinds of event loops: those for <a href=#browsing-context id=definitions-3:browsing-context>browsing contexts</a>, and
  43939. those for <a href=#workers>workers</a>.</p>
  43940. <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
  43941. 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>
  43942. <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
  43943. browsing contexts</a>, complications arise when a <a href=#browsing-context id=definitions-3:browsing-context-3>browsing context</a> in that group
  43944. 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
  43945. similar-origin browsing contexts</a> to another. This specification does not currently describe
  43946. how to handle these complications.</p>
  43947. <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
  43948. 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
  43949. 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
  43950. context</a> always has an <a href=#event-loop id=definitions-3:event-loop-6>event loop</a> coordinating its activities.</p>
  43951. <p><a href=#worker-event-loop>Worker event loops</a> are simpler: each worker has one
  43952. <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>
  43953. manages the <a href=#event-loop id=definitions-3:event-loop-8>event loop</a>'s lifetime.</p>
  43954. <hr>
  43955. <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
  43956. <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
  43957. algorithms that are responsible for such work as:</p>
  43958. <dl><dt>Events<dd>
  43959. <p>Asynchronously dispatching an <code id=definitions-3:event><a href=#event>Event</a></code> object at a particular
  43960. <code id=definitions-3:eventtarget><a href=#eventtarget>EventTarget</a></code> object is often done by a dedicated task.</p>
  43961. <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
  43962. dispatched synchronously during other tasks.</p>
  43963. <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
  43964. 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
  43965. asynchronously then the processing of the resource once some or all of the resource is available
  43966. 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
  43967. 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>
  43968. </dl>
  43969. <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
  43970. 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
  43971. 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
  43972. 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
  43973. 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>
  43974. specified by the script's <a href=#settings-object id=definitions-3:settings-object>settings object</a>.</p>
  43975. <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>:
  43976. 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
  43977. <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>
  43978. <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>
  43979. <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
  43980. source</dfn>. All the tasks from one particular <a href=#task-source id=definitions-3:task-source>task source</a> and destined to a
  43981. particular <a href=#event-loop id=definitions-3:event-loop-14>event loop</a> (e.g. the callbacks generated by timers of a
  43982. <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
  43983. 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
  43984. <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
  43985. queues</a>.</p>
  43986. <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
  43987. 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
  43988. user agent could then give keyboard and mouse events preference over other tasks three quarters of
  43989. the time, keeping the interface responsive but not starving other task queues, and never
  43990. processing events from any one <a href=#task-source id=definitions-3:task-source-3>task source</a> out of order.</p>
  43991. <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.
  43992. 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
  43993. microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
  43994. invocation of the <a href=#perform-a-microtask-checkpoint id=definitions-3:perform-a-microtask-checkpoint>perform a microtask checkpoint</a> algorithm.</p>
  43995. <hr>
  43996. <p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
  43997. 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
  43998. 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>
  43999. <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
  44000. the requirements that require it to acquire or release it.</p>
  44001. <p class=note>User agent implementors have to make a choice between two evils. On the one hand,
  44002. not implementing the storage mutex means that there is a risk of data corruption: a site could,
  44003. for instance, try to read a cookie, increment its value, then write it back out, using the new
  44004. value of the cookie as a unique identifier for the session; if the site does this twice in two
  44005. different browser windows at the same time, it might end up using the same "unique" identifier for
  44006. both sessions, with potentially disastrous effects. On the other hand, implementing the storage
  44007. mutex has potentially serious performance implications: whenever a site uses Web Storage or
  44008. cookies, all other sites that try to use Web Storage or cookies are blocked until the first site
  44009. finishes.</p>
  44010. <p class=warning>So far, all browsers faced with this decision have opted to not implement the
  44011. <a href=#storage-mutex id=definitions-3:storage-mutex-3>storage mutex</a>.</p>
  44012. <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
  44013. 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
  44014. agent must release the <a href=#storage-mutex id=definitions-3:storage-mutex-4>storage mutex</a>.</p>
  44015. <h5 id=processing-model-9>8.1.4.2 Processing model</h5>
  44016. <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
  44017. exists:</p>
  44018. <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
  44019. loop</a>'s <a href=#task-queue id=processing-model-9:task-queue>task queues</a>, if any, ignoring, in the case of a
  44020. <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
  44021. <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
  44022. 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
  44023. 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
  44024. 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
  44025. 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
  44026. 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
  44027. loop</a>), then, if necessary, update the rendering or user interface of any
  44028. <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
  44029. <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
  44030. <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
  44031. <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
  44032. 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
  44033. 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>
  44034. <hr>
  44035. <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
  44036. <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
  44037. 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
  44038. microtasks</dfn>, and <dfn id=compound-microtask>compound microtasks</dfn>.</p>
  44039. <p class=note>This specification only has <a href=#solitary-callback-microtask id=processing-model-9:solitary-callback-microtask>solitary
  44040. callback microtasks</a>. Specifications that use <a href=#compound-microtask id=processing-model-9:compound-microtask>compound
  44041. 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
  44042. loop</a>.</p>
  44043. <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
  44044. <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
  44045. <dfn id=microtask-task-source>microtask task source</dfn>.</p>
  44046. <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
  44047. 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
  44048. 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
  44049. 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
  44050. irrelevant.</p>
  44051. <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
  44052. microtask checkpoint</a> flag is false, then the user agent must run the following steps:</p>
  44053. <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
  44054. 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
  44055. 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>
  44056. <p><i>Run</i>: Run the selected <a href=#concept-task id=processing-model-9:concept-task-7>task</a>.</p>
  44057. <p class=note>This might involve invoking scripted callbacks, which eventually calls the
  44058. <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
  44059. 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
  44060. checkpoint</a> flag to avoid reentrancy.</p>
  44061. <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
  44062. 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
  44063. 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
  44064. 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
  44065. false.</ol>
  44066. <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
  44067. <dfn id=execute-a-compound-microtask-subtask>execute a compound microtask subtask</dfn> to run a series of steps, the user agent must run
  44068. the following steps:</p>
  44069. <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
  44070. 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
  44071. 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
  44072. <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
  44073. 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>
  44074. <hr>
  44075. <p>When an asynchronously-running algorithm is to <dfn id=await-a-stable-state>await a stable state</dfn>, the user agent
  44076. 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
  44077. section</dfn>, and then resumes running the asynchronous algorithm (if appropriate), as described
  44078. in the algorithm's steps.</p>
  44079. <p class=note>Steps in <a href=#synchronous-section id=processing-model-9:synchronous-section>synchronous sections</a> are marked
  44080. with ⌛.</p>
  44081. <hr>
  44082. <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>
  44083. <ol><li>
  44084. <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
  44085. task</a>.</p>
  44086. <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
  44087. 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
  44088. 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
  44089. <em>not</em> be a <a href=#compound-microtask id=processing-model-9:compound-microtask-4>compound microtask</a>.</p>
  44090. <li><p>Let <var>task source</var> be <var>task</var>'s <a href=#task-source id=processing-model-9:task-source-5>task
  44091. 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
  44092. 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>
  44093. <p>Stop <var>task</var>, allowing whatever algorithm that invoked it to resume, but
  44094. continue these steps asynchronously.</p>
  44095. <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
  44096. 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
  44097. 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>
  44098. <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
  44099. source</a> <var>task source</var>. Wait until this new task runs before continuing
  44100. 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
  44101. stack of script settings objects</var>.<li><p>Return to the caller.</ol>
  44102. <hr>
  44103. <p>Some of the algorithms in this specification, for historical reasons, require the user agent to
  44104. <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>
  44105. <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
  44106. <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
  44107. <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
  44108. 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
  44109. 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
  44110. doing anything.</ol>
  44111. <hr>
  44112. <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>
  44113. <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
  44114. <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>
  44115. <h5 id=generic-task-sources>8.1.4.3 Generic task sources</h5>
  44116. <p>The following <a href=#task-source id=generic-task-sources:task-source>task sources</a> are used by a number of mostly
  44117. unrelated features in this and other specifications.</p>
  44118. <dl><dt>The <dfn id=dom-manipulation-task-source>DOM manipulation task source</dfn><dd>
  44119. <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
  44120. 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>
  44121. <dt>The <dfn id=user-interaction-task-source>user interaction task source</dfn><dd>
  44122. <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
  44123. example keyboard or mouse input.</p>
  44124. <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
  44125. interaction task source</a>. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
  44126. <dt>The <dfn id=networking-task-source>networking task source</dfn><dd>
  44127. <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
  44128. activity.</p>
  44129. <dt>The <dfn id=history-traversal-task-source>history traversal task source</dfn><dd>
  44130. <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>
  44131. </dl>
  44132. <h4 id=events>8.1.5 Events</h4>
  44133. <h5 id=event-handler-attributes>8.1.5.1 Event handlers</h5>
  44134. <p>Many objects can have <dfn id=event-handlers>event handlers</dfn> specified. These act as non-capture event
  44135. listeners for the object on which they are specified. <a href=#refsDOM>[DOM]</a></p>
  44136. <p>An <a href=#event-handlers id=event-handler-attributes:event-handlers>event handler</a> has a name, which always starts with
  44137. "<code>on</code>" and is followed by the name of the event for which it is intended.</p>
  44138. <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
  44139. 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
  44140. handler</a>. The <code id=event-handler-attributes:eventhandler><a href=#eventhandler>EventHandler</a></code> callback function type describes how this is
  44141. exposed to scripts. Initially, event handlers must be set to null.</p>
  44142. <p>Event handlers are exposed in one of two ways.</p>
  44143. <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>
  44144. <p>The second way is as an <a href=#event-handler-content-attributes id=event-handler-attributes:event-handler-content-attributes>event handler content
  44145. 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
  44146. <code id=event-handler-attributes:window><a href=#window>Window</a></code> objects are exposed in this way.</p>
  44147. <hr>
  44148. <p>An <dfn id=event-handler-idl-attributes>event handler IDL attribute</dfn> is an IDL
  44149. attribute for a specific <a href=#event-handlers id=event-handler-attributes:event-handlers-3>event handler</a>. The name of the IDL
  44150. attribute is the same as the name of the <a href=#event-handlers id=event-handler-attributes:event-handlers-4>event handler</a>.</p>
  44151. <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
  44152. 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
  44153. an exception, in which case the getting propagates it to the caller, it does not catch it).</p>
  44154. <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
  44155. <a href=#event-handlers id=event-handler-attributes:event-handlers-6>event handler</a> of an object that doesn't exist, it must always
  44156. return null on getting and must do nothing on setting.</p>
  44157. <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
  44158. 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
  44159. <code id=event-handler-attributes:window-2><a href=#window>Window</a></code> objects.</p>
  44160. <p class=note>Certain event handler IDL attributes have additional requirements, in particular
  44161. the <code id=event-handler-attributes:handler-messageport-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
  44162. <code id=event-handler-attributes:messageport><a href=#messageport>MessagePort</a></code> objects.</p>
  44163. <hr>
  44164. <p>An <dfn id=event-handler-content-attributes>event handler content attribute</dfn> is a
  44165. content attribute for a specific <a href=#event-handlers id=event-handler-attributes:event-handlers-7>event handler</a>. The name of
  44166. the content attribute is the same as the name of the <a href=#event-handlers id=event-handler-attributes:event-handlers-8>event
  44167. handler</a>.</p>
  44168. <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
  44169. code which, when parsed, would match the <code>FunctionBody</code> production after
  44170. automatic semicolon insertion. <a href=#refsECMA262>[ECMA262]</a></p>
  44171. <p>When an <a href=#event-handler-content-attributes id=event-handler-attributes:event-handler-content-attributes-3>event handler content attribute</a>
  44172. is set, the user agent must set the corresponding <a href=#event-handlers id=event-handler-attributes:event-handlers-9>event
  44173. 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
  44174. new value and the script location where the attribute was set to this value</p>
  44175. <p>When an event handler content attribute is removed, the user agent must set the corresponding
  44176. <a href=#event-handlers id=event-handler-attributes:event-handlers-10>event handler</a> to null.</p>
  44177. <hr>
  44178. <p>When an <a href=#event-handlers id=event-handler-attributes:event-handlers-11>event handler</a> <var>H</var> of an element
  44179. or object <var>T</var> implementing the <code id=event-handler-attributes:eventtarget><a href=#eventtarget>EventTarget</a></code> interface is first set
  44180. to a non-null value, the user agent must append an <a href=#concept-event-listener id=event-handler-attributes:concept-event-listener>event
  44181. listener</a> to the list of <a href=#concept-event-listener id=event-handler-attributes:concept-event-listener-2>event listeners</a>
  44182. associated with <var>T</var> with <i>type</i> set to the <dfn id=event-handler-event-type>event handler event
  44183. type</dfn> corresponding to <var>H</var>, <i>capture</i> set to false, and
  44184. <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>
  44185. <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
  44186. <i>listener</i>, the algorithm defined below, which takes care of invoking the right callback, and
  44187. processing the callback's return value.</p>
  44188. <p class=note>This only happens the first time the <a href=#event-handlers id=event-handler-attributes:event-handlers-13>event
  44189. handler</a>'s value is set. Since listeners are called in the order they were registered, the
  44190. order of event listeners for a particular event type will always be first the event listeners
  44191. registered with <code id=event-handler-attributes:dom-eventtarget-addeventlistener><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code> before
  44192. 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,
  44193. then the callback to which it is currently set, if any, and finally the event listeners registered
  44194. with <code id=event-handler-attributes:dom-eventtarget-addeventlistener-2><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code> <em>after</em> the
  44195. 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>
  44196. <div class=example>
  44197. <p>This example demonstrates the order in which event listeners are invoked. If the button in
  44198. this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO",
  44199. "THREE", and "FOUR" respectively.</p>
  44200. <pre>&lt;button id="test">Start Demo&lt;/button>
  44201. &lt;script>
  44202. var button = document.getElementById('test');
  44203. button.addEventListener('click', function () { alert('ONE') }, false);
  44204. button.setAttribute('onclick', "alert('NOT CALLED')"); // event handler listener is registered here
  44205. button.addEventListener('click', function () { alert('THREE') }, false);
  44206. button.onclick = function () { alert('TWO'); };
  44207. button.addEventListener('click', function () { alert('FOUR') }, false);
  44208. &lt;/script></pre>
  44209. </div>
  44210. <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>
  44211. <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
  44212. 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
  44213. follows:</p>
  44214. <ol><li>
  44215. <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
  44216. event handler</a> <var>H</var>.</p>
  44217. <li><p>If <var>callback</var> is null, then abort these steps.<li>
  44218. <p>Process the <code id=event-handler-attributes:event-2><a href=#event>Event</a></code> object <var>E</var> as follows:</p>
  44219. <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
  44220. <code id=event-handler-attributes:onerroreventhandler><a href=#onerroreventhandler>OnErrorEventHandler</a></code><dd>
  44221. <p><a href=#concept-invoke-event-handler id=event-handler-attributes:concept-invoke-event-handler>Invoke</a> <var>callback</var> with five
  44222. 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
  44223. <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute, the third
  44224. having the value of <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>
  44225. 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
  44226. <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
  44227. callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>
  44228. <dt>Otherwise<dd>
  44229. <p><a href=#concept-invoke-event-handler id=event-handler-attributes:concept-invoke-event-handler-2>Invoke</a> <var>callback</var>
  44230. 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>,
  44231. 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>
  44232. </dl>
  44233. <p class=XXX>In this step, <dfn id=concept-invoke-event-handler>invoke</dfn> means to run the
  44234. <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>
  44235. <li>
  44236. <p>Process <var>return value</var> as follows:</p>
  44237. <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>
  44238. <p class=note>The <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-6>event handler IDL
  44239. 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
  44240. DOMString.</p>
  44241. <p>If the <var>return value</var> is null, then cancel the event.</p>
  44242. <p>Otherwise, If the <code id=event-handler-attributes:event-4><a href=#event>Event</a></code> object <var>E</var> is a
  44243. <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>
  44244. 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>
  44245. <dt>Otherwise<dd><p>If <var>return value</var> is a Web IDL boolean false value, then cancel the
  44246. event.</dl>
  44247. </ol>
  44248. <hr>
  44249. <p>The <code id=event-handler-attributes:eventhandler-2><a href=#eventhandler>EventHandler</a></code> callback function type represents a callback used for event
  44250. handlers. It is represented in Web IDL as follows:</p>
  44251. <pre class=idl>[TreatNonCallableAsNull]
  44252. callback <dfn id=eventhandlernonnull>EventHandlerNonNull</dfn> = any (<a href=#event id=event-handler-attributes:event-6>Event</a> event);
  44253. typedef <a href=#eventhandlernonnull id=event-handler-attributes:eventhandlernonnull>EventHandlerNonNull</a>? <dfn id=eventhandler>EventHandler</dfn>;</pre>
  44254. <p class=note>In JavaScript, any <code id=event-handler-attributes:idl-function><a href=#idl-function>Function</a></code> object implements
  44255. this interface.</p>
  44256. <div class=example>
  44257. <p>For example, the following document fragment:</p>
  44258. <pre>&lt;body onload="alert(this)" onclick="alert(this)"></pre>
  44259. <p>...leads to an alert saying "<code>[object Window]</code>" when the document is
  44260. loaded, and an alert saying "<code>[object HTMLBodyElement]</code>" whenever the
  44261. user clicks something in the page.</p>
  44262. </div>
  44263. <p class=note>The return value of the function affects whether the event is canceled or not:
  44264. as described above, if the return value is false, the event is canceled
  44265. (except for <code id=event-handler-attributes:event-mouseover-2><a href=#event-mouseover>mouseover</a></code> events, where the return value has to
  44266. be true to cancel the event). With <code id=event-handler-attributes:event-beforeunload-2><a href=#event-beforeunload>beforeunload</a></code> events,
  44267. the value is instead used to determine the message to show the user.</p>
  44268. <p>For historical reasons, the <code id=event-handler-attributes:handler-onerror><a href=#handler-onerror>onerror</a></code> handler has different
  44269. arguments:</p>
  44270. <pre class=idl>[TreatNonCallableAsNull]
  44271. 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);
  44272. typedef <a href=#onerroreventhandlernonnull id=event-handler-attributes:onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
  44273. <p>Similarly, the <code id=event-handler-attributes:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
  44274. different return value:</p>
  44275. <pre class=idl>[TreatNonCallableAsNull]
  44276. callback <dfn id=onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString? (<a href=#event id=event-handler-attributes:event-8>Event</a> event);
  44277. typedef <a href=#onbeforeunloadeventhandlernonnull id=event-handler-attributes:onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</a>? <dfn id=onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</dfn>;</pre>
  44278. <hr>
  44279. <p>An <dfn id=internal-raw-uncompiled-handler>internal raw uncompiled handler</dfn> is a tuple with the following information:</p>
  44280. <ul class=brief><li>An uncompiled script body
  44281. <li>A location where the script body originated, in case an error needs to be reported
  44282. </ul>
  44283. <p>When the user agent is to <dfn id=getting-the-current-value-of-the-event-handler>get the
  44284. current value of the event handler</dfn> <var>H</var>, it must run these steps:</p>
  44285. <ol><li>
  44286. <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
  44287. substeps:</p>
  44288. <ol><li>
  44289. <p>If <var>H</var> is an element's <a href=#event-handlers id=event-handler-attributes:event-handlers-18>event
  44290. 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>
  44291. <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
  44292. <code id=event-handler-attributes:window-4><a href=#window>Window</a></code> object.</p>
  44293. <li><p>If <var>document</var> is
  44294. 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
  44295. enabled</a> for <var>document</var>'s <a href=#browsing-context id=event-handler-attributes:browsing-context-2>browsing context</a>, then return
  44296. 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
  44297. 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
  44298. uncompiled handler</a>.<li><p>Let <var>location</var> be the location where the script body originated, as
  44299. 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
  44300. <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>.
  44301. 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>
  44302. created for the <code id=event-handler-attributes:window-5><a href=#window>Window</a></code> object with which <var>document</var> is
  44303. 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>
  44304. <p>If <var>body</var> is not parsable as <i>FunctionBody</i> or if parsing detects
  44305. an <i>early error</i>, then follow these substeps:</p>
  44306. <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
  44307. column number) given by <var>location</var>, using the <a href=#global-object id=event-handler-attributes:global-object>global object</a>
  44308. 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
  44309. to the user.<li><p>Jump to the step labeled <i>end</i> below.</ol>
  44310. <p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
  44311. Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
  44312. <li>
  44313. <p>If <var>body</var> begins with a Directive Prologue that contains a Use Strict
  44314. Directive then let <var>strict</var> be true, otherwise let <var>strict</var> be false.</p>
  44315. <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
  44316. ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
  44317. <li>
  44318. <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
  44319. object (as defined in ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
  44320. <dl><dt>Parameter list <var>FormalParameterList</var><dd>
  44321. <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
  44322. <code>error</code>.<dt>Otherwise<dd>Let the function have a single argument called <code>event</code>.</dl>
  44323. <dt>Function body <var>FunctionBody</var><dd>The result of parsing <var>body</var> above.<dt>Lexical Environment <var>Scope</var><dd>
  44324. <ol><li>
  44325. <p>If <var>H</var> is an element's <a href=#event-handlers id=event-handler-attributes:event-handlers-21>event
  44326. handler</a>, then let <var>Scope</var> be the result of
  44327. NewObjectEnvironment(<var>document</var>, the <var>global
  44328. environment</var>).</p>
  44329. <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>
  44330. <li><p>If <var>form owner</var> is not null, let <var>Scope</var> be
  44331. 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
  44332. result of NewObjectEnvironment(<var>element</var>, <var>Scope</var>).</ol>
  44333. <p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
  44334. NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
  44335. <dt>Boolean flag <var>Strict</var><dd>The value of <var>strict</var>.</dl>
  44336. <p>Let <var>function</var> be this new function.</p>
  44337. <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
  44338. settings</var>.<li><p>Set <var>H</var> to <var>function</var>.</ol>
  44339. <li><p><i>End</i>: Return <var>H</var>'s value.</ol>
  44340. <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>
  44341. <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
  44342. 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>
  44343. 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
  44344. 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
  44345. attributes</a>:</p>
  44346. <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>
  44347. <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>
  44348. <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>
  44349. <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>
  44350. <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>
  44351. <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>
  44352. <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>
  44353. <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>
  44354. <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>
  44355. <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>
  44356. <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>
  44357. <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>
  44358. <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>
  44359. <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>
  44360. <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>
  44361. <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>
  44362. <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>
  44363. <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>
  44364. <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>
  44365. <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>
  44366. <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>
  44367. <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>
  44368. <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>
  44369. <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>
  44370. <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>
  44371. <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>
  44372. <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>
  44373. <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>
  44374. <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>
  44375. <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>
  44376. <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>
  44377. <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>
  44378. <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>
  44379. <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>
  44380. <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>
  44381. <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>
  44382. <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>
  44383. <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>
  44384. <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>
  44385. <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>
  44386. <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>
  44387. <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>
  44388. <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>
  44389. <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>
  44390. <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>
  44391. <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>
  44392. <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>
  44393. <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>
  44394. <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>
  44395. <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>
  44396. <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>
  44397. <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>
  44398. <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>
  44399. <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>
  44400. <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>
  44401. <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>
  44402. <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>
  44403. <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>
  44404. </table>
  44405. <hr>
  44406. <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
  44407. 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>
  44408. 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
  44409. 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>
  44410. 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
  44411. 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
  44412. <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
  44413. 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>
  44414. 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
  44415. <code>Window</code> object's <code>Document</code>s</a>:</p>
  44416. <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>
  44417. <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>
  44418. <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>
  44419. <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>
  44420. <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>
  44421. <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>
  44422. <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>
  44423. </table>
  44424. <hr>
  44425. <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
  44426. 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
  44427. <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
  44428. 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>
  44429. 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
  44430. <code>Window</code> object's <code>Document</code>s</a>:</p>
  44431. <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>
  44432. <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>
  44433. <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>
  44434. <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>
  44435. <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>
  44436. <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>
  44437. <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>
  44438. <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>
  44439. <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>
  44440. <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>
  44441. <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>
  44442. <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>
  44443. <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>
  44444. <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>
  44445. </table>
  44446. <hr>
  44447. <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
  44448. 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>
  44449. <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>
  44450. <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>
  44451. </table>
  44452. <h6 id=idl-definitions>8.1.5.2.1 IDL definitions</h6>
  44453. <pre class=idl>[NoInterfaceObject]
  44454. interface <dfn id=globaleventhandlers>GlobalEventHandlers</dfn> {
  44455. attribute <a href=#eventhandler id=idl-definitions:eventhandler>EventHandler</a> <a href=#handler-onabort id=idl-definitions:handler-onabort>onabort</a>;
  44456. attribute <a href=#eventhandler id=idl-definitions:eventhandler-2>EventHandler</a> <a href=#handler-onautocomplete id=idl-definitions:handler-onautocomplete>onautocomplete</a>;
  44457. attribute <a href=#eventhandler id=idl-definitions:eventhandler-3>EventHandler</a> <a href=#handler-onautocompleteerror id=idl-definitions:handler-onautocompleteerror>onautocompleteerror</a>;
  44458. attribute <a href=#eventhandler id=idl-definitions:eventhandler-4>EventHandler</a> <a href=#handler-onblur id=idl-definitions:handler-onblur>onblur</a>;
  44459. attribute <a href=#eventhandler id=idl-definitions:eventhandler-5>EventHandler</a> <a href=#handler-oncancel id=idl-definitions:handler-oncancel>oncancel</a>;
  44460. attribute <a href=#eventhandler id=idl-definitions:eventhandler-6>EventHandler</a> <a href=#handler-oncanplay id=idl-definitions:handler-oncanplay>oncanplay</a>;
  44461. attribute <a href=#eventhandler id=idl-definitions:eventhandler-7>EventHandler</a> <a href=#handler-oncanplaythrough id=idl-definitions:handler-oncanplaythrough>oncanplaythrough</a>;
  44462. attribute <a href=#eventhandler id=idl-definitions:eventhandler-8>EventHandler</a> <a href=#handler-onchange id=idl-definitions:handler-onchange>onchange</a>;
  44463. attribute <a href=#eventhandler id=idl-definitions:eventhandler-9>EventHandler</a> <a href=#handler-onclick id=idl-definitions:handler-onclick>onclick</a>;
  44464. attribute <a href=#eventhandler id=idl-definitions:eventhandler-10>EventHandler</a> <a href=#handler-onclose id=idl-definitions:handler-onclose>onclose</a>;
  44465. attribute <a href=#eventhandler id=idl-definitions:eventhandler-11>EventHandler</a> <a href=#handler-oncontextmenu id=idl-definitions:handler-oncontextmenu>oncontextmenu</a>;
  44466. attribute <a href=#eventhandler id=idl-definitions:eventhandler-12>EventHandler</a> <a href=#handler-oncuechange id=idl-definitions:handler-oncuechange>oncuechange</a>;
  44467. attribute <a href=#eventhandler id=idl-definitions:eventhandler-13>EventHandler</a> <a href=#handler-ondblclick id=idl-definitions:handler-ondblclick>ondblclick</a>;
  44468. attribute <a href=#eventhandler id=idl-definitions:eventhandler-14>EventHandler</a> <a href=#handler-ondrag id=idl-definitions:handler-ondrag>ondrag</a>;
  44469. attribute <a href=#eventhandler id=idl-definitions:eventhandler-15>EventHandler</a> <a href=#handler-ondragend id=idl-definitions:handler-ondragend>ondragend</a>;
  44470. attribute <a href=#eventhandler id=idl-definitions:eventhandler-16>EventHandler</a> <a href=#handler-ondragenter id=idl-definitions:handler-ondragenter>ondragenter</a>;
  44471. attribute <a href=#eventhandler id=idl-definitions:eventhandler-17>EventHandler</a> <a href=#handler-ondragexit id=idl-definitions:handler-ondragexit>ondragexit</a>;
  44472. attribute <a href=#eventhandler id=idl-definitions:eventhandler-18>EventHandler</a> <a href=#handler-ondragleave id=idl-definitions:handler-ondragleave>ondragleave</a>;
  44473. attribute <a href=#eventhandler id=idl-definitions:eventhandler-19>EventHandler</a> <a href=#handler-ondragover id=idl-definitions:handler-ondragover>ondragover</a>;
  44474. attribute <a href=#eventhandler id=idl-definitions:eventhandler-20>EventHandler</a> <a href=#handler-ondragstart id=idl-definitions:handler-ondragstart>ondragstart</a>;
  44475. attribute <a href=#eventhandler id=idl-definitions:eventhandler-21>EventHandler</a> <a href=#handler-ondrop id=idl-definitions:handler-ondrop>ondrop</a>;
  44476. attribute <a href=#eventhandler id=idl-definitions:eventhandler-22>EventHandler</a> <a href=#handler-ondurationchange id=idl-definitions:handler-ondurationchange>ondurationchange</a>;
  44477. attribute <a href=#eventhandler id=idl-definitions:eventhandler-23>EventHandler</a> <a href=#handler-onemptied id=idl-definitions:handler-onemptied>onemptied</a>;
  44478. attribute <a href=#eventhandler id=idl-definitions:eventhandler-24>EventHandler</a> <a href=#handler-onended id=idl-definitions:handler-onended>onended</a>;
  44479. attribute <a href=#onerroreventhandler id=idl-definitions:onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-onerror id=idl-definitions:handler-onerror>onerror</a>;
  44480. attribute <a href=#eventhandler id=idl-definitions:eventhandler-25>EventHandler</a> <a href=#handler-onfocus id=idl-definitions:handler-onfocus>onfocus</a>;
  44481. attribute <a href=#eventhandler id=idl-definitions:eventhandler-26>EventHandler</a> <a href=#handler-oninput id=idl-definitions:handler-oninput>oninput</a>;
  44482. attribute <a href=#eventhandler id=idl-definitions:eventhandler-27>EventHandler</a> <a href=#handler-oninvalid id=idl-definitions:handler-oninvalid>oninvalid</a>;
  44483. attribute <a href=#eventhandler id=idl-definitions:eventhandler-28>EventHandler</a> <a href=#handler-onkeydown id=idl-definitions:handler-onkeydown>onkeydown</a>;
  44484. attribute <a href=#eventhandler id=idl-definitions:eventhandler-29>EventHandler</a> <a href=#handler-onkeypress id=idl-definitions:handler-onkeypress>onkeypress</a>;
  44485. attribute <a href=#eventhandler id=idl-definitions:eventhandler-30>EventHandler</a> <a href=#handler-onkeyup id=idl-definitions:handler-onkeyup>onkeyup</a>;
  44486. attribute <a href=#eventhandler id=idl-definitions:eventhandler-31>EventHandler</a> <a href=#handler-onload id=idl-definitions:handler-onload>onload</a>;
  44487. attribute <a href=#eventhandler id=idl-definitions:eventhandler-32>EventHandler</a> <a href=#handler-onloadeddata id=idl-definitions:handler-onloadeddata>onloadeddata</a>;
  44488. attribute <a href=#eventhandler id=idl-definitions:eventhandler-33>EventHandler</a> <a href=#handler-onloadedmetadata id=idl-definitions:handler-onloadedmetadata>onloadedmetadata</a>;
  44489. attribute <a href=#eventhandler id=idl-definitions:eventhandler-34>EventHandler</a> <a href=#handler-onloadstart id=idl-definitions:handler-onloadstart>onloadstart</a>;
  44490. attribute <a href=#eventhandler id=idl-definitions:eventhandler-35>EventHandler</a> <a href=#handler-onmousedown id=idl-definitions:handler-onmousedown>onmousedown</a>;
  44491. [LenientThis] attribute <a href=#eventhandler id=idl-definitions:eventhandler-36>EventHandler</a> <a href=#handler-onmouseenter id=idl-definitions:handler-onmouseenter>onmouseenter</a>;
  44492. [LenientThis] attribute <a href=#eventhandler id=idl-definitions:eventhandler-37>EventHandler</a> <a href=#handler-onmouseleave id=idl-definitions:handler-onmouseleave>onmouseleave</a>;
  44493. attribute <a href=#eventhandler id=idl-definitions:eventhandler-38>EventHandler</a> <a href=#handler-onmousemove id=idl-definitions:handler-onmousemove>onmousemove</a>;
  44494. attribute <a href=#eventhandler id=idl-definitions:eventhandler-39>EventHandler</a> <a href=#handler-onmouseout id=idl-definitions:handler-onmouseout>onmouseout</a>;
  44495. attribute <a href=#eventhandler id=idl-definitions:eventhandler-40>EventHandler</a> <a href=#handler-onmouseover id=idl-definitions:handler-onmouseover>onmouseover</a>;
  44496. attribute <a href=#eventhandler id=idl-definitions:eventhandler-41>EventHandler</a> <a href=#handler-onmouseup id=idl-definitions:handler-onmouseup>onmouseup</a>;
  44497. attribute <a href=#eventhandler id=idl-definitions:eventhandler-42>EventHandler</a> <a href=#handler-onmousewheel id=idl-definitions:handler-onmousewheel>onmousewheel</a>;
  44498. attribute <a href=#eventhandler id=idl-definitions:eventhandler-43>EventHandler</a> <a href=#handler-onpause id=idl-definitions:handler-onpause>onpause</a>;
  44499. attribute <a href=#eventhandler id=idl-definitions:eventhandler-44>EventHandler</a> <a href=#handler-onplay id=idl-definitions:handler-onplay>onplay</a>;
  44500. attribute <a href=#eventhandler id=idl-definitions:eventhandler-45>EventHandler</a> <a href=#handler-onplaying id=idl-definitions:handler-onplaying>onplaying</a>;
  44501. attribute <a href=#eventhandler id=idl-definitions:eventhandler-46>EventHandler</a> <a href=#handler-onprogress id=idl-definitions:handler-onprogress>onprogress</a>;
  44502. attribute <a href=#eventhandler id=idl-definitions:eventhandler-47>EventHandler</a> <a href=#handler-onratechange id=idl-definitions:handler-onratechange>onratechange</a>;
  44503. attribute <a href=#eventhandler id=idl-definitions:eventhandler-48>EventHandler</a> <a href=#handler-onreset id=idl-definitions:handler-onreset>onreset</a>;
  44504. attribute <a href=#eventhandler id=idl-definitions:eventhandler-49>EventHandler</a> <a href=#handler-onresize id=idl-definitions:handler-onresize>onresize</a>;
  44505. attribute <a href=#eventhandler id=idl-definitions:eventhandler-50>EventHandler</a> <a href=#handler-onscroll id=idl-definitions:handler-onscroll>onscroll</a>;
  44506. attribute <a href=#eventhandler id=idl-definitions:eventhandler-51>EventHandler</a> <a href=#handler-onseeked id=idl-definitions:handler-onseeked>onseeked</a>;
  44507. attribute <a href=#eventhandler id=idl-definitions:eventhandler-52>EventHandler</a> <a href=#handler-onseeking id=idl-definitions:handler-onseeking>onseeking</a>;
  44508. attribute <a href=#eventhandler id=idl-definitions:eventhandler-53>EventHandler</a> <a href=#handler-onselect id=idl-definitions:handler-onselect>onselect</a>;
  44509. attribute <a href=#eventhandler id=idl-definitions:eventhandler-54>EventHandler</a> <a href=#handler-onshow id=idl-definitions:handler-onshow>onshow</a>;
  44510. attribute <a href=#eventhandler id=idl-definitions:eventhandler-55>EventHandler</a> <a href=#handler-onsort id=idl-definitions:handler-onsort>onsort</a>;
  44511. attribute <a href=#eventhandler id=idl-definitions:eventhandler-56>EventHandler</a> <a href=#handler-onstalled id=idl-definitions:handler-onstalled>onstalled</a>;
  44512. attribute <a href=#eventhandler id=idl-definitions:eventhandler-57>EventHandler</a> <a href=#handler-onsubmit id=idl-definitions:handler-onsubmit>onsubmit</a>;
  44513. attribute <a href=#eventhandler id=idl-definitions:eventhandler-58>EventHandler</a> <a href=#handler-onsuspend id=idl-definitions:handler-onsuspend>onsuspend</a>;
  44514. attribute <a href=#eventhandler id=idl-definitions:eventhandler-59>EventHandler</a> <a href=#handler-ontimeupdate id=idl-definitions:handler-ontimeupdate>ontimeupdate</a>;
  44515. attribute <a href=#eventhandler id=idl-definitions:eventhandler-60>EventHandler</a> <a href=#handler-ontoggle id=idl-definitions:handler-ontoggle>ontoggle</a>;
  44516. attribute <a href=#eventhandler id=idl-definitions:eventhandler-61>EventHandler</a> <a href=#handler-onvolumechange id=idl-definitions:handler-onvolumechange>onvolumechange</a>;
  44517. attribute <a href=#eventhandler id=idl-definitions:eventhandler-62>EventHandler</a> <a href=#handler-onwaiting id=idl-definitions:handler-onwaiting>onwaiting</a>;
  44518. };
  44519. [NoInterfaceObject]
  44520. interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
  44521. attribute <a href=#eventhandler id=idl-definitions:eventhandler-63>EventHandler</a> <a href=#handler-window-onafterprint id=idl-definitions:handler-window-onafterprint>onafterprint</a>;
  44522. attribute <a href=#eventhandler id=idl-definitions:eventhandler-64>EventHandler</a> <a href=#handler-window-onbeforeprint id=idl-definitions:handler-window-onbeforeprint>onbeforeprint</a>;
  44523. attribute <a href=#onbeforeunloadeventhandler id=idl-definitions:onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload id=idl-definitions:handler-window-onbeforeunload>onbeforeunload</a>;
  44524. attribute <a href=#eventhandler id=idl-definitions:eventhandler-65>EventHandler</a> <a href=#handler-window-onhashchange id=idl-definitions:handler-window-onhashchange>onhashchange</a>;
  44525. attribute <a href=#eventhandler id=idl-definitions:eventhandler-66>EventHandler</a> <a href=#handler-window-onlanguagechange id=idl-definitions:handler-window-onlanguagechange>onlanguagechange</a>;
  44526. attribute <a href=#eventhandler id=idl-definitions:eventhandler-67>EventHandler</a> <a href=#handler-window-onmessage id=idl-definitions:handler-window-onmessage>onmessage</a>;
  44527. attribute <a href=#eventhandler id=idl-definitions:eventhandler-68>EventHandler</a> <a href=#handler-window-onoffline id=idl-definitions:handler-window-onoffline>onoffline</a>;
  44528. attribute <a href=#eventhandler id=idl-definitions:eventhandler-69>EventHandler</a> <a href=#handler-window-ononline id=idl-definitions:handler-window-ononline>ononline</a>;
  44529. attribute <a href=#eventhandler id=idl-definitions:eventhandler-70>EventHandler</a> <a href=#handler-window-onpagehide id=idl-definitions:handler-window-onpagehide>onpagehide</a>;
  44530. attribute <a href=#eventhandler id=idl-definitions:eventhandler-71>EventHandler</a> <a href=#handler-window-onpageshow id=idl-definitions:handler-window-onpageshow>onpageshow</a>;
  44531. attribute <a href=#eventhandler id=idl-definitions:eventhandler-72>EventHandler</a> <a href=#handler-window-onpopstate id=idl-definitions:handler-window-onpopstate>onpopstate</a>;
  44532. attribute <a href=#eventhandler id=idl-definitions:eventhandler-73>EventHandler</a> <a href=#handler-window-onstorage id=idl-definitions:handler-window-onstorage>onstorage</a>;
  44533. attribute <a href=#eventhandler id=idl-definitions:eventhandler-74>EventHandler</a> <a href=#handler-window-onunload id=idl-definitions:handler-window-onunload>onunload</a>;
  44534. };</pre>
  44535. <h5 id=event-firing>8.1.5.3 Event firing</h5>
  44536. <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
  44537. 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>
  44538. <p><dfn id=fire-a-simple-event>Firing a simple event named <var>e</var></dfn>
  44539. 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
  44540. (except where otherwise stated), and which uses the <code id=event-firing:event><a href=#event>Event</a></code> interface, must be created
  44541. and <a href=#concept-event-dispatch id=event-firing:concept-event-dispatch>dispatched</a> at the given target.</p>
  44542. <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
  44543. (except where otherwise stated), is not cancelable (except where otherwise stated), and which uses
  44544. the <code id=event-firing:mouseevent><a href=#mouseevent>MouseEvent</a></code> interface, must be created and dispatched at the given target. The
  44545. event object must have its <code>screenX</code>, <code>screenY</code>, <code>clientX</code>, <code>clientY</code>, and <code>button</code>
  44546. attributes initialised to 0, its <code>ctrlKey</code>, <code>shiftKey</code>,
  44547. <code>altKey</code>, and <code>metaKey</code> attributes initialised according
  44548. to the current state of the key input device, if any (false for any keys that are not available),
  44549. 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
  44550. 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
  44551. return values appropriately describing the state of the key input device at the time the event is
  44552. created.</p>
  44553. <p><dfn id=fire-a-click-event>Firing a <code>click</code> event</dfn>
  44554. 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>
  44555. <p>The default action of these events is to do nothing except where otherwise stated.</p>
  44556. <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>
  44557. <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
  44558. 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
  44559. 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>,
  44560. 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>
  44561. <h3 id=atob>8.2 Base64 utility methods</h3>
  44562. <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
  44563. the base64 encoding.</p>
  44564. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  44565. interface <dfn id=windowbase64>WindowBase64</dfn> {
  44566. DOMString <a href=#dom-windowbase64-btoa id=atob:dom-windowbase64-btoa-2>btoa</a>(DOMString btoa);
  44567. DOMString <a href=#dom-windowbase64-atob id=atob:dom-windowbase64-atob-2>atob</a>(DOMString atob);
  44568. };
  44569. <a href=#window id=atob:window>Window</a> implements <a href=#windowbase64 id=atob:windowbase64>WindowBase64</a>;</pre>
  44570. <p class=note>In these APIs, for mnemonic purposes, the "b" can be considered to stand for
  44571. "binary", and the "a" for "ASCII". In practice, though, for primarily historical reasons, both the
  44572. input and output of these functions are Unicode strings.</p>
  44573. <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>
  44574. <p>Takes the input data, in the form of a Unicode string containing only characters in the range
  44575. U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and
  44576. converts it to its base64 representation, which it returns.</p>
  44577. <p>Throws an <code id=atob:invalidcharactererror><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string contains any
  44578. out-of-range characters.</p>
  44579. <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>
  44580. <p>Takes the input data, in the form of a Unicode string containing base64-encoded binary data,
  44581. decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each
  44582. representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary
  44583. data.</p>
  44584. <p>Throws an <code id=atob:invalidcharactererror-2><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string is not valid
  44585. base64 data.</p>
  44586. </dl>
  44587. <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
  44588. and the <code id=atob:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web workers).</p>
  44589. <p>The <dfn id=dom-windowbase64-btoa><code>btoa()</code></dfn> method must throw an
  44590. <code id=atob:invalidcharactererror-3><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the method's first argument contains any character
  44591. whose code point is greater than U+00FF. Otherwise, the user agent must convert that argument to a
  44592. sequence of octets whose <var>n</var>th octet is the eight-bit representation of the code
  44593. point of the <var>n</var>th character of the argument, and then must apply the base64
  44594. algorithm to that sequence of octets, and return the result. <a href=#refsRFC4648>[RFC4648]</a></p>
  44595. <p>The <dfn id=dom-windowbase64-atob><code>atob()</code></dfn> method must run the following
  44596. steps to parse the string passed in the method's first argument:</p>
  44597. <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
  44598. 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
  44599. <var>input</var> ends with one or two U+003D EQUALS SIGN (=) characters, remove them
  44600. from <var>input</var>.<li><p>If the length of <var>input</var> divides by 4 leaving a remainder of 1, throw an
  44601. <code id=atob:invalidcharactererror-4><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort these steps.</p>
  44602. <li>
  44603. <p>If <var>input</var> contains a character that is not in the following list of
  44604. characters and character ranges, throw an <code id=atob:invalidcharactererror-5><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort
  44605. these steps:</p>
  44606. <ul class=brief><li>U+002B PLUS SIGN (+)
  44607. <li>U+002F SOLIDUS (/)
  44608. <li><a href=#alphanumeric-ascii-characters id=atob:alphanumeric-ascii-characters>Alphanumeric ASCII characters</a>
  44609. </ul>
  44610. <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
  44611. empty.<li>
  44612. <p>While <var>position</var> does not point past the end of <var>input</var>,
  44613. run these substeps:</p>
  44614. <ol><li>
  44615. <p>Find the character pointed to by <var>position</var> in the first column of the
  44616. following table. Let <var>n</var> be the number given in the second cell of the same
  44617. row.</p>
  44618. <div id=base64-table>
  44619. <table><thead><tr><th>Character
  44620. <th>Number
  44621. <tbody><tr><td>A<td>0
  44622. <tr><td>B<td>1
  44623. <tr><td>C<td>2
  44624. <tr><td>D<td>3
  44625. <tr><td>E<td>4
  44626. <tr><td>F<td>5
  44627. <tr><td>G<td>6
  44628. <tr><td>H<td>7
  44629. <tr><td>I<td>8
  44630. <tr><td>J<td>9
  44631. <tr><td>K<td>10
  44632. <tr><td>L<td>11
  44633. <tr><td>M<td>12
  44634. <tr><td>N<td>13
  44635. <tr><td>O<td>14
  44636. <tr><td>P<td>15
  44637. <tr><td>Q<td>16
  44638. <tr><td>R<td>17
  44639. <tr><td>S<td>18
  44640. <tr><td>T<td>19
  44641. <tr><td>U<td>20
  44642. <tr><td>V<td>21
  44643. <tr><td>W<td>22
  44644. <tr><td>X<td>23
  44645. <tr><td>Y<td>24
  44646. <tr><td>Z<td>25
  44647. <tr><td>a<td>26
  44648. <tr><td>b<td>27
  44649. <tr><td>c<td>28
  44650. <tr><td>d<td>29
  44651. <tr><td>e<td>30
  44652. <tr><td>f<td>31
  44653. <tr><td>g<td>32
  44654. <tr><td>h<td>33
  44655. <tr><td>i<td>34
  44656. <tr><td>j<td>35
  44657. <tr><td>k<td>36
  44658. <tr><td>l<td>37
  44659. <tr><td>m<td>38
  44660. <tr><td>n<td>39
  44661. <tr><td>o<td>40
  44662. <tr><td>p<td>41
  44663. <tr><td>q<td>42
  44664. <tr><td>r<td>43
  44665. <tr><td>s<td>44
  44666. <tr><td>t<td>45
  44667. <tr><td>u<td>46
  44668. <tr><td>v<td>47
  44669. <tr><td>w<td>48
  44670. <tr><td>x<td>49
  44671. <tr><td>y<td>50
  44672. <tr><td>z<td>51
  44673. <tr><td>0<td>52
  44674. <tr><td>1<td>53
  44675. <tr><td>2<td>54
  44676. <tr><td>3<td>55
  44677. <tr><td>4<td>56
  44678. <tr><td>5<td>57
  44679. <tr><td>6<td>58
  44680. <tr><td>7<td>59
  44681. <tr><td>8<td>60
  44682. <tr><td>9<td>61
  44683. <tr><td>+<td>62
  44684. <tr><td>/<td>63
  44685. </table>
  44686. </div>
  44687. <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
  44688. 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>
  44689. <li>
  44690. <p>If <var>buffer</var> is not empty, it contains either 12 or 18 bits. If it contains
  44691. 12 bits, discard the last four and interpret the remaining eight as an 8-bit big-endian number.
  44692. If it contains 18 bits, discard the last two and interpret the remaining 16 as two 8-bit
  44693. big-endian numbers. Append the one or two characters with code points equal to those one or two
  44694. numbers to <var>output</var>, in the same order.</p>
  44695. <p class=note>The discarded bits mean that, for instance, <code>atob("YQ")</code> and
  44696. <code>atob("YR")</code> both return "<code>a</code>".</p>
  44697. <li><p>Return <var>output</var>.</ol>
  44698. <h3 id=dynamic-markup-insertion>8.3 <dfn>Dynamic markup insertion</dfn></h3>
  44699. <p class=note>APIs for dynamically inserting markup into the document interact with the parser,
  44700. 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>
  44701. (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
  44702. parser</a>).</p>
  44703. <h4 id=opening-the-input-stream>8.3.1 Opening the input stream</h4>
  44704. <p>The <dfn id=dom-document-open><code>open()</code></dfn> method comes in several variants
  44705. with different numbers of arguments.</p>
  44706. <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>
  44707. <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
  44708. <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>
  44709. <p>If the <var>type</var> argument is omitted or has the value
  44710. "<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
  44711. 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>
  44712. <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
  44713. <code id=opening-the-input-stream:document-4><a href=#document>Document</a></code> object are removed.</p>
  44714. <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>
  44715. <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>
  44716. <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>
  44717. <p>Works like the <code id=opening-the-input-stream:dom-open><a href=#dom-open>window.open()</a></code> method.</p>
  44718. </dl>
  44719. <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
  44720. 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>
  44721. method (directly or indirectly) while the document is <a href=#unload-a-document id=opening-the-input-stream:unload-a-document>being
  44722. unloaded</a>. Initially, the counter must be set to zero.</p>
  44723. <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>
  44724. method must act as follows:</p>
  44725. <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
  44726. 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
  44727. these steps.<li><p>Let <var>type</var> be the value of the first argument.<li>
  44728. <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
  44729. "replace", then let <var>replace</var> be true.</p>
  44730. <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
  44731. 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>
  44732. 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
  44733. 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
  44734. <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
  44735. true.</p>
  44736. <p>Otherwise, let <var>replace</var> be false.</p>
  44737. <li>
  44738. <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
  44739. level</a> is greater than zero, then the method does nothing. Abort these steps and return
  44740. the <code id=opening-the-input-stream:document-14><a href=#document>Document</a></code> object on which the method was invoked.</p>
  44741. <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
  44742. be ignored when it's called in an inline script found during parsing, while still letting it
  44743. have an effect when called asynchronously.</p>
  44744. <li>
  44745. <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
  44746. greater than zero, then the method does nothing. Abort these steps and return the
  44747. <code id=opening-the-input-stream:document-16><a href=#document>Document</a></code> object on which the method was invoked.</p>
  44748. <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
  44749. 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
  44750. handler while the <code id=opening-the-input-stream:document-17><a href=#document>Document</a></code> is being unloaded.</p>
  44751. <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
  44752. <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
  44753. 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
  44754. 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
  44755. <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
  44756. descendants.</p>
  44757. <li><p>Remove any <a href=#concept-task id=opening-the-input-stream:concept-task>tasks</a> associated with the
  44758. <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>
  44759. <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.
  44760. (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>,
  44761. <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
  44762. 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
  44763. <code id=opening-the-input-stream:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
  44764. <code id=opening-the-input-stream:selection><a href=#selection>Selection</a></code>. It also includes all the Web
  44765. IDL prototypes in the JavaScript binding, including the <code id=opening-the-input-stream:document-26><a href=#document>Document</a></code> object's
  44766. prototype.)</p>
  44767. <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
  44768. object</a>.</p>
  44769. <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
  44770. <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
  44771. <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
  44772. 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
  44773. <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
  44774. <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
  44775. 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
  44776. end-of-file token). The encoding <a href=#concept-encoding-confidence id=opening-the-input-stream:concept-encoding-confidence>confidence</a> is
  44777. <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>
  44778. <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
  44779. "<code>replace</code>", then, for historical reasons, set it to the string "<code>text/html</code>".</p>
  44780. <p>Otherwise:</p>
  44781. <p>If the <var>type</var> string contains a U+003B SEMICOLON character (;), remove the
  44782. first such character and all characters from it up to the end of the string.</p>
  44783. <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>
  44784. <li>
  44785. <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
  44786. 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
  44787. token with the tag name "pre" followed by a single U+000A LINE FEED (LF) character, then switch the
  44788. <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>
  44789. <li>
  44790. <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>
  44791. 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
  44792. session history, then no entries are removed.</p>
  44793. <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
  44794. agent's user interface.</p>
  44795. <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
  44796. 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
  44797. <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,
  44798. and associate with the new entry the text that was parsed by the previous parser associated with
  44799. 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
  44800. steps. This allows the user to step backwards in the session history to see the page before it
  44801. 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
  44802. 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
  44803. 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
  44804. <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>
  44805. <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
  44806. 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
  44807. loaded</a>.</p>
  44808. <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
  44809. 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
  44810. <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
  44811. 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
  44812. 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
  44813. the method must throw an <code id=opening-the-input-stream:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</p>
  44814. <h4 id=closing-the-input-stream>8.3.2 Closing the input stream</h4>
  44815. <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>
  44816. <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>
  44817. <p>Throws an <code id=closing-the-input-stream:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the
  44818. <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
  44819. document</a>.</p>
  44820. </dl>
  44821. <p>The <dfn id=dom-document-close><code>close()</code></dfn> method must run the following
  44822. steps:</p>
  44823. <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
  44824. document</a>, throw an <code id=closing-the-input-stream:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
  44825. 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
  44826. 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
  44827. 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
  44828. steps.<li><p>Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the
  44829. 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>
  44830. <h4 id=document.write()>8.3.3 <code id=document.write():dom-document-write><a href=#dom-document-write>document.write()</a></code></h4>
  44831. <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>
  44832. <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>
  44833. <p class=warning>This method has very idiosyncratic behavior. In some cases, this method can
  44834. 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
  44835. that does not correspond to the source of the document (e.g. if the string written is the string
  44836. "<code>&lt;plaintext></code>" or "<code>&lt;!--</code>"). In other cases,
  44837. 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
  44838. is simply ignored, or throws an exception. To make matters worse, the exact behavior of this
  44839. 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
  44840. of this method is strongly discouraged.</strong></p>
  44841. <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
  44842. documents</a>.</p>
  44843. </dl>
  44844. <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
  44845. 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
  44846. 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
  44847. away the document by implicitly calling <code id=document.write():dom-document-open-2><a href=#dom-document-open>document.open()</a></code>.
  44848. Initially, the counter must be set to zero.</p>
  44849. <p>The <dfn id=dom-document-write><code>document.write(...)</code></dfn> method must act as
  44850. follows:</p>
  44851. <ol><li>
  44852. <p>If the method was invoked on an <a href=#xml-documents id=document.write():xml-documents-2>XML document</a>, throw an
  44853. <code id=document.write():invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</p>
  44854. <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
  44855. these steps.<li>
  44856. <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
  44857. <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
  44858. <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,
  44859. abort these steps.</p>
  44860. <li>
  44861. <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>
  44862. 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
  44863. unloaded</a>, then abort these steps. Otherwise, the <a href=#insertion-point id=document.write():insertion-point-3>insertion point</a> will point
  44864. at just before the end of the (empty) <a href=#input-stream id=document.write():input-stream>input stream</a>.</p>
  44865. <li>
  44866. <p>Insert the string consisting of the concatenation of all the arguments to the method into the
  44867. <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>
  44868. <li>
  44869. <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
  44870. the string consisting of the concatenation of all the arguments to the method to the
  44871. <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>
  44872. <li>
  44873. <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
  44874. parser</a> process the characters that were inserted, one at a time, processing resulting
  44875. tokens as they are emitted, and stopping when the tokenizer reaches the insertion point or when
  44876. the processing of the tokenizer is aborted by the tree construction stage (this can happen if a
  44877. <code id=document.write():the-script-element-2><a href=#the-script-element>script</a></code> end tag token is emitted by the tokenizer).
  44878. <p class=note>If the <code id=document.write():dom-document-write-4><a href=#dom-document-write>document.write()</a></code> method was
  44879. called from script executing inline (i.e. executing because the parser parsed a set of
  44880. <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
  44881. parser</a>.</p>
  44882. <li>
  44883. <p>Finally, return from the method.</p>
  44884. </ol>
  44885. <h4 id=document.writeln()>8.3.4 <code id=document.writeln():dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code></h4>
  44886. <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>
  44887. <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
  44888. character. If necessary, calls the <code id=document.writeln():dom-document-open><a href=#dom-document-open>open()</a></code> method
  44889. implicitly first.</p>
  44890. <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
  44891. documents</a>.</p>
  44892. </dl>
  44893. <p>The <dfn id=dom-document-writeln><code>document.writeln(...)</code></dfn> method, when
  44894. invoked, must act as if the <code id=document.writeln():dom-document-write><a href=#dom-document-write>document.write()</a></code> method had
  44895. been invoked with the same argument(s), plus an extra argument consisting of a string containing a
  44896. single line feed character (U+000A).</p>
  44897. <h3 id=timers>8.4 Timers</h3>
  44898. <p>The <code id=timers:dom-windowtimers-settimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
  44899. and <code id=timers:dom-windowtimers-setinterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code>
  44900. methods allow authors to schedule timer-based callbacks.</p>
  44901. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  44902. interface <dfn id=windowtimers>WindowTimers</dfn> {
  44903. 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);
  44904. long <a href=#dom-windowtimers-settimeout id=timers:dom-windowtimers-settimeout-3>setTimeout</a>(DOMString handler, optional long timeout = 0, any... arguments);
  44905. void <a href=#dom-windowtimers-cleartimeout id=timers:dom-windowtimers-cleartimeout>clearTimeout</a>(optional long handle = 0);
  44906. 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);
  44907. long <a href=#dom-windowtimers-setinterval id=timers:dom-windowtimers-setinterval-3>setInterval</a>(DOMString handler, optional long timeout = 0, any... arguments);
  44908. void <a href=#dom-windowtimers-clearinterval id=timers:dom-windowtimers-clearinterval>clearInterval</a>(optional long handle = 0);
  44909. };
  44910. <a href=#window id=timers:window>Window</a> implements <a href=#windowtimers id=timers:windowtimers>WindowTimers</a>;</pre>
  44911. <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>
  44912. <p>Schedules a timeout to run <var>handler</var> after <var>timeout</var>
  44913. milliseconds. Any <var>arguments</var> are passed straight through to the <var>handler</var>.</p>
  44914. <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>
  44915. <p>Schedules a timeout to compile and run <var>code</var> after <var>timeout</var> milliseconds.</p>
  44916. <dt><var>window</var> . <code id=timers:dom-windowtimers-cleartimeout-2><a href=#dom-windowtimers-cleartimeout>clearTimeout</a></code>( <var>handle</var> )<dd>
  44917. <p>Cancels the timeout set with <code id=timers:dom-windowtimers-settimeout-6><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
  44918. identified by <var>handle</var>.</p>
  44919. <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>
  44920. <p>Schedules a timeout to run <var>handler</var> every <var>timeout</var>
  44921. milliseconds. Any <var>arguments</var> are passed straight through to the <var>handler</var>.</p>
  44922. <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>
  44923. <p>Schedules a timeout to compile and run <var>code</var> every <var>timeout</var> milliseconds.</p>
  44924. <dt><var>window</var> . <code id=timers:dom-windowtimers-clearinterval-2><a href=#dom-windowtimers-clearinterval>clearInterval</a></code>( <var>handle</var> )<dd>
  44925. <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>
  44926. </dl>
  44927. <p class=note>Timers can be nested; after five such nested timers, however, the interval is
  44928. forced to be at least four milliseconds.</p>
  44929. <p class=note>This API does not guarantee that timers will run exactly on schedule. Delays due
  44930. to CPU load, other tasks, etc, are to be expected.</p>
  44931. <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
  44932. and the <code id=timers:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web workers).</p>
  44933. <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
  44934. timers</dfn>. Each entry in this lists is identified by a number, which must be unique within the
  44935. list for the lifetime of the object that implements the <code id=timers:windowtimers-4><a href=#windowtimers>WindowTimers</a></code> interface.</p>
  44936. <hr>
  44937. <p>The <dfn id=dom-windowtimers-settimeout><code>setTimeout()</code></dfn> method must return
  44938. the value returned by the <a href=#timer-initialization-steps id=timers:timer-initialization-steps>timer initialization steps</a>, passing them the method's
  44939. arguments, the object on which the method for which the algorithm is running is implemented (a
  44940. <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
  44941. context</var>, and the <var>repeat</var> flag set to false.</p>
  44942. <p>The <dfn id=dom-windowtimers-setinterval><code>setInterval()</code></dfn> method must
  44943. return the value returned by the <a href=#timer-initialization-steps id=timers:timer-initialization-steps-2>timer initialization steps</a>, passing them the
  44944. method's arguments, the object on which the method for which the algorithm is running is
  44945. 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>
  44946. <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
  44947. 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
  44948. <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
  44949. 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>
  44950. object on which the method was invoked, the method does nothing.)</p>
  44951. <hr>
  44952. <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
  44953. optionally (and only if the <var>repeat</var> flag is true) a <var>previous
  44954. handle</var>, are as follows:</p>
  44955. <ol><li><p>Let <var>method context proxy</var> be <var>method context</var> if that
  44956. 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
  44957. to <var>method context</var>.<li><p>If <var>previous handle</var> was provided, let <var>handle</var> be
  44958. <var>previous handle</var>; otherwise, let <var>handle</var> be a
  44959. user-agent-defined integer that is greater than zero that will identify the timeout to be set by
  44960. 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
  44961. active timers</a> for <var>handle</var>.<li>
  44962. <p>Let <var>task</var> be a <a href=#concept-task id=timers:concept-task>task</a> that runs the
  44963. following substeps:</p>
  44964. <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>
  44965. has been cleared, then abort this <a href=#concept-task id=timers:concept-task-2>task</a>'s substeps.<li>
  44966. <p>Run the appropriate set of steps from the following list:</p>
  44967. <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>
  44968. <p>Call the <code id=timers:idl-function-4><a href=#idl-function>Function</a></code>. Use the third and subsequent method
  44969. 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
  44970. <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>
  44971. <dt>Otherwise<dd>
  44972. <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
  44973. 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,
  44974. the <a href=#url id=timers:url>URL</a> where <var>script source</var> can be found, <var>scripting
  44975. language</var> as the scripting language, and <var>settings object</var> as the
  44976. <a href=#script-settings-object id=timers:script-settings-object-2>script settings object</a>.</ol>
  44977. </dl>
  44978. <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
  44979. steps</a> again, passing them the same method arguments, the same <var>method
  44980. 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>
  44981. <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
  44982. 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
  44983. 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
  44984. level</var>.<li><p>Return <var>handle</var>, and then continue running this algorithm
  44985. asynchronously.<li>
  44986. <p>If <var>method context</var> is a <code id=timers:window-5><a href=#window>Window</a></code> object, wait until the
  44987. <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
  44988. active</a> for a further <var>timeout</var> milliseconds (not necessarily
  44989. consecutively).</p>
  44990. <p>Otherwise, <var>method context</var> is a <code id=timers:workerglobalscope-5><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
  44991. wait until <var>timeout</var> milliseconds have passed with the worker not suspended
  44992. (not necessarily consecutively).</p>
  44993. <li>
  44994. <p>Wait until any invocations of this algorithm that had the same <var>method
  44995. context</var>, that started before this one, and whose <var>timeout</var> is equal to
  44996. or less than this one's, have completed.</p>
  44997. <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
  44998. algorithms defined in Web IDL, before this algorithm is invoked.</p>
  44999. <div class=example>
  45000. <p>So for example, the following rather silly code will result in the log containing "<code>ONE TWO </code>":</p>
  45001. <pre>var log = '';
  45002. function logger(s) { log += s + ' '; }
  45003. setTimeout({ toString: function () {
  45004. setTimeout("logger('ONE')", 100);
  45005. return "logger('TWO')";
  45006. } }, 100);</pre>
  45007. </div>
  45008. <li>
  45009. <p>Optionally, wait a further user-agent defined length of time.</p>
  45010. <p class=note>This is intended to allow user agents to pad timeouts as needed to optimise the
  45011. power usage of the device. For example, some processors have a low-power mode where the
  45012. granularity of timers is reduced; on such platforms, user agents can slow timers down to fit
  45013. this schedule instead of requiring the processor to use the more accurate mode with its
  45014. associated higher power usage.</p>
  45015. <li>
  45016. <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>
  45017. <p class=note>Once the task has been processed, if the <var>repeat</var> flag is
  45018. 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
  45019. active timers</a> (there is no way for the entry's existence to be detected past this point,
  45020. so it does not technically matter one way or the other).</p>
  45021. </ol>
  45022. <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
  45023. <dfn id=timer-task-source>timer task source</dfn>.</p>
  45024. <div class=example>
  45025. <p>To run tasks of several milliseconds back to back without any delay, while still yielding back
  45026. to the browser to avoid starving the user interface (and to avoid the browser killing the script
  45027. for hogging the CPU), simply queue the next timer before performing work:</p>
  45028. <pre>function doExpensiveWork() {
  45029. var done = false;
  45030. // ...
  45031. // this part of the function takes up to five milliseconds
  45032. // set done to true if we're done
  45033. // ...
  45034. return done;
  45035. }
  45036. function rescheduleWork() {
  45037. var handle = setTimeout(rescheduleWork, 0); // preschedule next iteration
  45038. if (doExpensiveWork())
  45039. clearTimeout(handle); // clear the timeout if we don't need it
  45040. }
  45041. function scheduleWork() {
  45042. setTimeout(rescheduleWork, 0);
  45043. }
  45044. scheduleWork(); // queues a task to do lots of work</pre>
  45045. </div>
  45046. <h3 id=user-prompts>8.5 User prompts</h3>
  45047. <h4 id=simple-dialogs>8.5.1 Simple dialogs</h4>
  45048. <dl class=domintro><dt><var>window</var> . <code id=simple-dialogs:dom-alert><a href=#dom-alert>alert</a></code>(<var>message</var>)<dd>
  45049. <p>Displays a modal alert with the given message, and waits for the user to dismiss it.</p>
  45050. <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
  45051. implied when this method is invoked.</p>
  45052. <dt><var>result</var> = <var>window</var> . <code id=simple-dialogs:dom-confirm><a href=#dom-confirm>confirm</a></code>(<var>message</var>)<dd>
  45053. <p>Displays a modal OK/Cancel prompt with the given message, waits for the user to dismiss it,
  45054. and returns true if the user clicks OK and false if the user clicks Cancel.</p>
  45055. <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates-2><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
  45056. implied when this method is invoked.</p>
  45057. <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>
  45058. <p>Displays a modal text field prompt with the given message, waits for the user to dismiss it,
  45059. and returns the value that the user entered. If the user cancels the prompt, then returns null
  45060. instead. If the second argument is present, then the given value is used as a default.</p>
  45061. <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates-3><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
  45062. implied when this method is invoked.</p>
  45063. </dl>
  45064. <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>
  45065. loading their <a href=#media-data id=simple-dialogs:media-data>media data</a>, are stalled when these methods are invoked.</p>
  45066. <p>The <dfn id=dom-alert><code>alert(<var>message</var>)</code></dfn> method, when
  45067. invoked, must run the following steps:</p>
  45068. <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,
  45069. 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
  45070. to ignore all alerts, and would thus abort at this step whenever the method was
  45071. invoked.)<li><p>If the method was invoked with no arguments, then let <var>message</var> be the
  45072. empty string; otherwise, let <var>message</var> be the method's first
  45073. 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
  45074. message.</ol>
  45075. <p>The <dfn id=dom-confirm><code>confirm(<var>message</var>)</code></dfn> method,
  45076. when invoked, must run the following steps:</p>
  45077. <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,
  45078. 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
  45079. the user the option to ignore all prompts, and would thus abort at this step whenever the method
  45080. was invoked.)<li><p>Show the given <var>message</var> to the user, and ask the user to respond with a
  45081. 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:
  45082. return false.</ol>
  45083. <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>
  45084. <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,
  45085. 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
  45086. user the option to ignore all prompts, and would thus abort at this step whenever the method was
  45087. invoked.)<li><p>Show the given <var>message</var> to the user, and ask the user to either respond
  45088. with a string value or abort. The response must be defaulted to the value given by
  45089. <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
  45090. with.</ol>
  45091. <h4 id=printing>8.5.2 Printing</h4>
  45092. <dl class=domintro><dt><var>window</var> . <code id=printing:dom-print><a href=#dom-print>print</a></code>()<dd>
  45093. <p>Prompts the user to print the page.</p>
  45094. <p>A call to the <code id=printing:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
  45095. implied when this method is invoked.</p>
  45096. </dl>
  45097. <p>When the <dfn id=dom-print><code>print()</code></dfn> method is invoked, if the
  45098. <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
  45099. synchronously run the <a href=#printing-steps id=printing:printing-steps>printing steps</a>. Otherwise, the user agent must only set the
  45100. <dfn id=print-when-loaded>print when loaded</dfn> flag on the <code id=printing:document-2><a href=#document>Document</a></code>.</p>
  45101. <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
  45102. 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
  45103. physical form (e.g. PDF copy), of a document.</p>
  45104. <p>The <dfn id=printing-steps>printing steps</dfn> are as follows:</p>
  45105. <ol><li>
  45106. <p>The user agent may display a message to the user or abort these steps (or both).</p>
  45107. <p class=example>For instance, a kiosk browser could silently ignore any invocations of the
  45108. <code id=printing:dom-print-2><a href=#dom-print>print()</a></code> method.</p>
  45109. <p class=example>For instance, a browser on a mobile device could detect that there are no
  45110. printers in the vicinity and display a message saying so before continuing to offer a "save to
  45111. PDF" option.</p>
  45112. <li>
  45113. <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
  45114. <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>
  45115. <p class=example>The <code id=printing:event-beforeprint-2><a href=#event-beforeprint>beforeprint</a></code> event can be used to
  45116. annotate the printed copy, for instance adding the time at which the document was printed.</p>
  45117. <li>
  45118. <p>The user agent must release the <a href=#storage-mutex id=printing:storage-mutex>storage mutex</a>.</p>
  45119. <li>
  45120. <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>
  45121. (or the representation of a physical form) of the document. The user agent may wait for the user
  45122. to either accept or decline before returning; if so, the user agent must <a href=#pause id=printing:pause>pause</a>
  45123. while the method is waiting. Even if the user agent doesn't wait at this point, the user agent
  45124. must use the state of the relevant documents as they are at this point in the algorithm if and
  45125. when it eventually creates the alternate form.</p>
  45126. <li>
  45127. <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
  45128. <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>
  45129. <p class=example>The <code id=printing:event-afterprint-2><a href=#event-afterprint>afterprint</a></code> event can be used to
  45130. revert annotations added in the earlier event, as well as showing post-printing UI. For
  45131. instance, if a page is walking the user through the steps of applying for a home loan, the
  45132. script could automatically advance to the next step after having printed a form or other.</p>
  45133. </ol>
  45134. <h4 id=dialogs-implemented-using-separate-documents>8.5.3 Dialogs implemented using separate documents</h4>
  45135. <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>
  45136. <p>Prompts the user with the given page, waits for that page to close, and returns the return
  45137. value.</p>
  45138. <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
  45139. is implied when this method is invoked.</p>
  45140. </dl>
  45141. <p>The <dfn id=dom-showmodaldialog><code>showModalDialog(<var>url</var>, <var>argument</var>)</code></dfn> method, when invoked,
  45142. must cause the user agent to run the following steps:</p>
  45143. <ol><li>
  45144. <p><a href=#resolve-a-url id=dialogs-implemented-using-separate-documents:resolve-a-url>Resolve</a> <var>url</var> relative to the
  45145. <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>
  45146. <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>
  45147. <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,
  45148. optionally abort these steps, returning the empty string.<li>
  45149. <p>Release the <a href=#storage-mutex id=dialogs-implemented-using-separate-documents:storage-mutex>storage mutex</a>.</p>
  45150. <li>
  45151. <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
  45152. string and abort these steps.</p>
  45153. <p class=note>User agents are expected to disable this method in certain cases to avoid user
  45154. annoyance (e.g. as part of their popup blocker feature). For instance, a user agent could
  45155. require that a site be white-listed before enabling this method, or the user agent could be
  45156. configured to only allow one modal dialog at a time.</p>
  45157. <li>
  45158. <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
  45159. <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
  45160. 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,
  45161. then return the empty string and abort these steps.</p>
  45162. <li>
  45163. <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>
  45164. 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>
  45165. <li>
  45166. <p>Let <var>the list of background browsing contexts</var> be a list of all the
  45167. browsing contexts that:</p>
  45168. <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
  45169. 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>
  45170. <p>...as well as any browsing contexts that are nested inside any of the browsing contexts
  45171. matching those conditions.</p>
  45172. <li>
  45173. <p>Disable the user interface for all the browsing contexts in <var>the list of
  45174. background browsing contexts</var>. This should prevent the user from navigating those browsing
  45175. contexts, causing events to be sent to those browsing context, or editing any content in those
  45176. browsing contexts. However, it does not prevent those browsing contexts from receiving events
  45177. from sources other than the user, from running scripts, from running animations, and so
  45178. forth.</p>
  45179. <li>
  45180. <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
  45181. 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
  45182. browsing context has no name.</p>
  45183. <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>
  45184. objects all implement the <code id=dialogs-implemented-using-separate-documents:windowmodal><a href=#windowmodal>WindowModal</a></code> interface.</p>
  45185. <li>
  45186. <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
  45187. 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
  45188. 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
  45189. 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
  45190. 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
  45191. navigator</a>.</p>
  45192. <li>
  45193. <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>
  45194. <li>
  45195. <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>
  45196. <li>
  45197. <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>
  45198. <li>
  45199. <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>
  45200. <li>
  45201. <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
  45202. 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>
  45203. <var>url</var> earlier, with <a href=#replacement-enabled id=dialogs-implemented-using-separate-documents:replacement-enabled>replacement enabled</a>, and with the
  45204. <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
  45205. object</a> as the <a href=#source-browsing-context id=dialogs-implemented-using-separate-documents:source-browsing-context>source browsing context</a>.</p>
  45206. <li>
  45207. <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
  45208. that the <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context-4>browsing context</a> is to be closed.</p>
  45209. <li>
  45210. <p>Reenable the user interface for all the browsing contexts in <var>the list of
  45211. background browsing contexts</var>.</p>
  45212. <li>
  45213. <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
  45214. 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
  45215. 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>
  45216. <p>Otherwise, let <var>return value</var> be undefined.</p>
  45217. <li>
  45218. <p>Return <var>return value</var>.</p>
  45219. </ol>
  45220. <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
  45221. <code id=dialogs-implemented-using-separate-documents:windowmodal-2><a href=#windowmodal>WindowModal</a></code> interface.</p>
  45222. <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
  45223. 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.
  45224. 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>
  45225. method).</p>
  45226. <pre class=idl>[NoInterfaceObject]
  45227. interface <dfn id=windowmodal>WindowModal</dfn> {
  45228. readonly attribute any <a href=#dom-windowmodal-dialogarguments id=dialogs-implemented-using-separate-documents:dom-windowmodal-dialogarguments>dialogArguments</a>;
  45229. attribute any <a href=#dom-windowmodal-returnvalue id=dialogs-implemented-using-separate-documents:dom-windowmodal-returnvalue>returnValue</a>;
  45230. };</pre>
  45231. <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>
  45232. <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>
  45233. <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>
  45234. <p>Returns the current return value for the window.</p>
  45235. <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>
  45236. </dl>
  45237. <p>Such browsing contexts have associated <dfn id=dialog-arguments>dialog arguments</dfn>, which are stored along with
  45238. 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
  45239. browsing context is created, based on the arguments provided to the method.</p>
  45240. <p>The <dfn id=dom-windowmodal-dialogarguments><code>dialogArguments</code></dfn> IDL
  45241. 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
  45242. <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'
  45243. 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
  45244. returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>.</p>
  45245. <p>These browsing contexts also have an associated <dfn id=return-value>return value</dfn> and <dfn id=return-value-origin>return value
  45246. 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
  45247. browsing context is created.</p>
  45248. <p>The <dfn id=dom-windowmodal-returnvalue><code>returnValue</code></dfn> IDL attribute, on
  45249. 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
  45250. 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
  45251. 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
  45252. returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>. On setting, the
  45253. 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
  45254. 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
  45255. script origin</a>.</p>
  45256. <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
  45257. close the browsing context.</p>
  45258. <h3 id=system-state-and-capabilities>8.6 System state and capabilities</h3>
  45259. <h4 id=the-navigator-object>8.6.1 The <code id=the-navigator-object:navigator><a href=#navigator>Navigator</a></code> object</h4>
  45260. <p>The <dfn id=dom-navigator><code>navigator</code></dfn> attribute of the
  45261. <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,
  45262. which represents the identity and state of the user agent (the client), and allows Web pages to
  45263. register themselves as potential protocol and content handlers:</p>
  45264. <pre class=idl>interface <dfn id=navigator>Navigator</dfn> {
  45265. // objects implementing this interface also implement the interfaces given below
  45266. };
  45267. <a href=#navigator id=the-navigator-object:navigator-3>Navigator</a> implements <a href=#navigatorid id=the-navigator-object:navigatorid>NavigatorID</a>;
  45268. <a href=#navigator id=the-navigator-object:navigator-4>Navigator</a> implements <a href=#navigatorlanguage id=the-navigator-object:navigatorlanguage>NavigatorLanguage</a>;
  45269. <a href=#navigator id=the-navigator-object:navigator-5>Navigator</a> implements <a href=#navigatoronline id=the-navigator-object:navigatoronline>NavigatorOnLine</a>;
  45270. <a href=#navigator id=the-navigator-object:navigator-6>Navigator</a> implements <a href=#navigatorcontentutils id=the-navigator-object:navigatorcontentutils>NavigatorContentUtils</a>;
  45271. <a href=#navigator id=the-navigator-object:navigator-7>Navigator</a> implements <a href=#navigatorstorageutils id=the-navigator-object:navigatorstorageutils>NavigatorStorageUtils</a>;
  45272. <a href=#navigator id=the-navigator-object:navigator-8>Navigator</a> implements <a href=#navigatorplugins id=the-navigator-object:navigatorplugins>NavigatorPlugins</a>;</pre>
  45273. <p>These interfaces are defined separately so that other specifications can re-use parts of the
  45274. <code id=the-navigator-object:navigator-9><a href=#navigator>Navigator</a></code> interface.</p>
  45275. <h5 id=client-identification>8.6.1.1 Client identification</h5>
  45276. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  45277. interface <dfn id=navigatorid>NavigatorID</dfn> {
  45278. readonly attribute DOMString <a href=#dom-navigator-appcodename id=client-identification:dom-navigator-appcodename>appCodeName</a>; // constant "Mozilla"
  45279. readonly attribute DOMString <a href=#dom-navigator-appname id=client-identification:dom-navigator-appname>appName</a>;
  45280. readonly attribute DOMString <a href=#dom-navigator-appversion id=client-identification:dom-navigator-appversion>appVersion</a>;
  45281. readonly attribute DOMString <a href=#dom-navigator-platform id=client-identification:dom-navigator-platform>platform</a>;
  45282. readonly attribute DOMString <a href=#dom-navigator-product id=client-identification:dom-navigator-product>product</a>; // constant "Gecko"
  45283. boolean <a href=#dom-navigator-taintenabled id=client-identification:dom-navigator-taintenabled>taintEnabled</a>(); // constant false
  45284. readonly attribute DOMString <a href=#dom-navigator-useragent id=client-identification:dom-navigator-useragent>userAgent</a>;
  45285. };</pre>
  45286. <p>In certain cases, despite the best efforts of the entire industry, Web browsers have bugs and
  45287. limitations that Web authors are forced to work around.</p>
  45288. <p>This section defines a collection of attributes that can be used to determine, from script, the
  45289. kind of user agent in use, in order to work around these issues.</p>
  45290. <p>Client detection should always be limited to detecting known current versions; future versions
  45291. and unknown versions should always be assumed to be fully compliant.</p>
  45292. <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>
  45293. <p>Returns the string "<code>Mozilla</code>".</p>
  45294. <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>
  45295. <p>Returns the name of the browser.</p>
  45296. <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>
  45297. <p>Returns the version of the browser.</p>
  45298. <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>
  45299. <p>Returns the name of the platform.</p>
  45300. <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>
  45301. <p>Returns the string "<code>Gecko</code>".</p>
  45302. <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>
  45303. <p>Returns false.</p>
  45304. <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>
  45305. <p>Returns the complete User-Agent header.</p>
  45306. </dl>
  45307. <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
  45308. 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
  45309. version of the browser in detail, e.g. "<code>1.0 (VMS; en-US)
  45310. 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
  45311. browser is executing, e.g. "<code>MacIntel</code>", "<code>Win32</code>",
  45312. "<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
  45313. in HTTP requests, or the empty string if no such header is ever sent.</dl>
  45314. <p class=warning>Any information in this API that varies from user to user can be used to
  45315. profile the user. In fact, if enough such information is available, a user can actually be
  45316. uniquely identified. For this reason, user agent implementors are strongly urged to include as
  45317. little information in this API as possible.
  45318. <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>
  45319. </p>
  45320. <h5 id=language-preferences>8.6.1.2 Language preferences</h5>
  45321. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  45322. interface <dfn id=navigatorlanguage>NavigatorLanguage</dfn> {
  45323. readonly attribute DOMString? <a href=#dom-navigator-language id=language-preferences:dom-navigator-language>language</a>;
  45324. readonly attribute DOMString[] <a href=#dom-navigator-languages id=language-preferences:dom-navigator-languages>languages</a>;
  45325. };</pre>
  45326. <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>
  45327. <p>Returns a language tag representing the user's preferred language.</p>
  45328. <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>
  45329. <p>Returns an array of language tags representing the user's preferred languages, with the most preferred language first.</p>
  45330. <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>
  45331. </dl>
  45332. <p class=note>A <code id=language-preferences:event-languagechange><a href=#event-languagechange>languagechange</a></code> event is fired at the
  45333. <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
  45334. of what the user's preferred languages are changes.</p>
  45335. <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
  45336. 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>
  45337. <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
  45338. language tags representing either one or more <a href=#a-plausible-language id=language-preferences:a-plausible-language-2>plausible
  45339. languages</a>, or the user's preferred languages, ordered by preference with the most
  45340. preferred language first. The same object must be returned until the user agent needs to return
  45341. different values, or values in a different order. <a href=#refsBCP47>[BCP47]</a></p>
  45342. <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>
  45343. 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
  45344. <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
  45345. <code id=language-preferences:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object and wait until that task begins to be executed before
  45346. actually returning a new value.</p>
  45347. <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
  45348. <a href=#dom-manipulation-task-source id=language-preferences:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  45349. </dl>
  45350. <p>To determine <dfn id=a-plausible-language>a plausible language</dfn>, the user agent should bear in mind the following:</p>
  45351. <ul><li>Any information in this API that varies from user to user can be used to profile or identify
  45352. the user.
  45353. <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>
  45354. <li>If the user is not using a service that obfuscates the user's point of origin (e.g. the Tor
  45355. anonymity network), then the value that is least likely to distinguish the user from other users
  45356. with similar origins (e.g. from the same IP address block) is the language used by the majority
  45357. 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
  45358. suggested; if all users of the service use that same value, that reduces the possibility of
  45359. distinguishing the users from each other.</ul>
  45360. <p>To avoid introducing any more fingerprinting vectors, user agents should use the same list for
  45361. 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.
  45362. <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>
  45363. </p>
  45364. <h5 id=custom-handlers>8.6.1.3 Custom scheme and content handlers</h5>
  45365. <pre class=idl>[NoInterfaceObject]
  45366. interface <dfn id=navigatorcontentutils>NavigatorContentUtils</dfn> {
  45367. // content handler registration
  45368. void <a href=#dom-navigator-registerprotocolhandler id=custom-handlers:dom-navigator-registerprotocolhandler>registerProtocolHandler</a>(DOMString scheme, DOMString url, DOMString title);
  45369. void <a href=#dom-navigator-registercontenthandler id=custom-handlers:dom-navigator-registercontenthandler>registerContentHandler</a>(DOMString mimeType, DOMString url, DOMString title);
  45370. DOMString <a href=#dom-navigator-isprotocolhandlerregistered id=custom-handlers:dom-navigator-isprotocolhandlerregistered>isProtocolHandlerRegistered</a>(DOMString scheme, DOMString url);
  45371. DOMString <a href=#dom-navigator-iscontenthandlerregistered id=custom-handlers:dom-navigator-iscontenthandlerregistered>isContentHandlerRegistered</a>(DOMString mimeType, DOMString url);
  45372. void <a href=#dom-navigator-unregisterprotocolhandler id=custom-handlers:dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler</a>(DOMString scheme, DOMString url);
  45373. void <a href=#dom-navigator-unregistercontenthandler id=custom-handlers:dom-navigator-unregistercontenthandler>unregisterContentHandler</a>(DOMString mimeType, DOMString url);
  45374. };</pre>
  45375. <p>The <dfn id=dom-navigator-registerprotocolhandler><code>registerProtocolHandler()</code></dfn> method
  45376. allows Web sites to register themselves as possible handlers for particular schemes. For example,
  45377. 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
  45378. opportunity to use that Web site. Analogously, the <dfn id=dom-navigator-registercontenthandler><code>registerContentHandler()</code></dfn> method allows
  45379. Web sites to register themselves as possible handlers for content in a particular <a href=#mime-type id=custom-handlers:mime-type>MIME
  45380. type</a>. For example, the same online telephone messaging service could register itself as a
  45381. 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
  45382. of handling vCards, his Web browser can instead suggest he use that site to view contact
  45383. information stored on vCards that he opens. <a href=#refsSMS>[SMS]</a> <a href=#refsRFC6350>[RFC6350]</a></p>
  45384. <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>
  45385. <p>Registers a handler for the given scheme or content type, at the given URL, with the given
  45386. title.</p>
  45387. <p>The string "<code>%s</code>" in the URL is used as a placeholder for where to put
  45388. the URL of the content to be handled.</p>
  45389. <p>Throws a <code id=custom-handlers:securityerror><a href=#securityerror>SecurityError</a></code> exception if the user agent blocks the registration (this
  45390. might happen if trying to register as a handler for "http", for instance).</p>
  45391. <p>Throws a <code id=custom-handlers:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception if the "<code>%s</code>" string is
  45392. missing in the URL.</p>
  45393. </dl>
  45394. <p>User agents may, within the constraints described in this section, do whatever they like when
  45395. the methods are called. A UA could, for instance, prompt the user and offer the user the
  45396. opportunity to add the site to a shortlist of handlers, or make the handlers his default, or
  45397. cancel the request. UAs could provide such a UI through modal UI or through a non-modal transient
  45398. notification interface. UAs could also simply silently collect the information, providing it only
  45399. when relevant to the user.</p>
  45400. <p>User agents should keep track of which sites have registered handlers (even if the user has
  45401. declined such registrations) so that the user is not repeatedly prompted with the same
  45402. request.</p>
  45403. <p>The arguments to the methods have the following meanings and corresponding implementation
  45404. requirements. The requirements that involve throwing exceptions must be processed in the order
  45405. given below, stopping at the first exception thrown. (So the exceptions for the first argument
  45406. take precedence over the exceptions for the second argument.)</p>
  45407. <dl><dt><var>scheme</var> (<code id=custom-handlers:dom-navigator-registerprotocolhandler-3><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> only)<dd>
  45408. <p>A scheme, such as "<code>mailto</code>" or "<code>web+auth</code>". The
  45409. 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
  45410. purposes of comparing with the scheme part of URLs that they consider against the list of
  45411. registered handlers.</p>
  45412. <p>The <var>scheme</var> value, if it contains a colon (as in "<code>mailto:</code>"),
  45413. will never match anything, since schemes don't contain colons.</p>
  45414. <p>If the <code id=custom-handlers:dom-navigator-registerprotocolhandler-4><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code>
  45415. 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
  45416. whose value starts with the substring "<code>web+</code>" and otherwise contains only
  45417. <a href=#lowercase-ascii-letters id=custom-handlers:lowercase-ascii-letters>lowercase ASCII letters</a>, and whose length is at least five characters (including
  45418. the "<code>web+</code>" prefix), the user agent must throw a <code id=custom-handlers:securityerror-2><a href=#securityerror>SecurityError</a></code>
  45419. exception.</p>
  45420. <p>The following schemes are the <dfn id=whitelisted-scheme>whitelisted schemes</dfn>:</p>
  45421. <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>
  45422. <p class=note>This list can be changed. If there are schemes that should be added, please send
  45423. feedback.</p>
  45424. <p class=note>This list excludes any schemes that could reasonably be expected to be supported
  45425. 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
  45426. theoretically) <code>gopher</code>. If those were supported, they could potentially be
  45427. used in man-in-the-middle attacks, by replacing pages that have frames with such content with
  45428. content under the control of the protocol handler. If the user agent has native support for the
  45429. schemes, this could further be used for cookie-theft attacks.</p>
  45430. <dt><var>mimeType</var> (<code id=custom-handlers:dom-navigator-registercontenthandler-3><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> only)<dd>
  45431. <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
  45432. 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
  45433. comparing with MIME types of documents that they consider against the list of registered
  45434. handlers.</p>
  45435. <p>User agents must compare the given values only to the MIME type/subtype parts of content
  45436. types, not to the complete type including parameters. Thus, if <var>mimeType</var>
  45437. values passed to this method include characters such as commas or whitespace, or include MIME
  45438. parameters, then the handler being registered will never be used.</p>
  45439. <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
  45440. <em>after</em> the sniffing algorithms have been applied.</p>
  45441. <p>If the <code id=custom-handlers:dom-navigator-registercontenthandler-4><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
  45442. 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
  45443. that the user agent has deemed a privileged type, the user agent must throw a
  45444. <code id=custom-handlers:securityerror-3><a href=#securityerror>SecurityError</a></code> exception.</p>
  45445. <p>The following <a href=#mime-type id=custom-handlers:mime-type-6>MIME types</a> are in the <dfn id=type-blacklist>type
  45446. blacklist</dfn>:</p>
  45447. <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>
  45448. <p class=note>This list can be changed. If there are MIME types that should be added, please
  45449. send feedback.</p>
  45450. <dt><var>url</var><dd>
  45451. <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>
  45452. <p>User agents must throw a <code id=custom-handlers:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception if the <var>url</var>
  45453. argument passed to one of these methods does not contain the exact literal string
  45454. "<code>%s</code>".</p>
  45455. <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
  45456. URL</a> specified by the <a href=#entry-settings-object id=custom-handlers:entry-settings-object>entry settings object</a> is not successful.</p>
  45457. <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
  45458. URL</a> as it would include the string "<code>%s</code>" which is not a valid
  45459. component in a URL.</p>
  45460. <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
  45461. 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
  45462. <a href=#entry-settings-object id=custom-handlers:entry-settings-object-2>entry settings object</a>.</p>
  45463. <p class=note>This is forcibly the case if the <code>%s</code> placeholder is in the
  45464. scheme, host, or port parts of the URL.</p>
  45465. <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
  45466. handler for the purposes of the methods described below.</p>
  45467. <p>When the user agent uses this handler, it must replace the first occurrence of the exact
  45468. literal string "<code>%s</code>" in the <var>url</var> argument with an
  45469. 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),
  45470. 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
  45471. 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
  45472. 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
  45473. 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>
  45474. <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
  45475. 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
  45476. 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>
  45477. <div class=example>
  45478. <p>If the user had visited a site at <code>http://example.com/</code> that made the
  45479. following call:</p>
  45480. <pre>navigator.registerContentHandler('application/x-soup', 'soup?url=%s', 'SoupWeb™')</pre>
  45481. <p>...and then, much later, while visiting <code>http://www.example.net/</code>,
  45482. clicked on a link such as:</p>
  45483. <pre>&lt;a href="chickenkïwi.soup">Download our Chicken Kïwi soup!&lt;/a></pre>
  45484. <p>...then, assuming this <code>chickenkïwi.soup</code> file was served with the
  45485. <a href=#mime-type id=custom-handlers:mime-type-7>MIME type</a> <code>application/x-soup</code>, the UA might navigate to the
  45486. following URL:</p>
  45487. <pre>http://example.com/soup?url=http://www.example.net/chickenk%C3%AFwi.soup</pre>
  45488. <p>This site could then fetch the <code>chickenkïwi.soup</code> file and do
  45489. whatever it is that it does with soup (synthesise it and ship it to the user, or whatever).</p>
  45490. </div>
  45491. <dt><var>title</var><dd>
  45492. <p>A descriptive title of the handler, which the UA might use to remind the user what the site
  45493. in question is.</p>
  45494. </dl>
  45495. <p>This section does not define how the pages registered by these methods are used, beyond the
  45496. requirements on how to process the <var>url</var> value (see above). To some extent, the
  45497. <a href=#navigate id=custom-handlers:navigate-3>processing model for navigating across documents</a> defines some cases
  45498. where these methods are relevant, but in general UAs may use this information wherever they would
  45499. otherwise consider handing content to native plugins or helper applications.</p>
  45500. <p>UAs must not use registered content handlers to handle content that was returned as part of a
  45501. non-GET transaction (or rather, as part of any non-idempotent transaction), as the remote site
  45502. would not be able to fetch the same data.</p>
  45503. <hr>
  45504. <p>In addition to the registration methods, there are also methods for determining if particular
  45505. handlers have been registered, and for unregistering handlers.</p>
  45506. <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>
  45507. <p>Returns one of the following strings describing the state of the handler given by the
  45508. arguments:</p>
  45509. <dl><dt><code>new</code>
  45510. <dd>Indicates that no attempt has been made to register the given handler (or that the handler
  45511. has been unregistered). It would be appropriate to promote the availability of the handler or
  45512. to just automatically register the handler.
  45513. <dt><code>registered</code>
  45514. <dd>Indicates that the given handler has been registered or that the site is blocked from
  45515. registering the handler. Trying to register the handler again would have no effect.
  45516. <dt><code>declined</code>
  45517. <dd>Indicates that the given handler has been offered but was rejected. Trying to register the
  45518. handler again may prompt the user again.
  45519. </dl>
  45520. <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>
  45521. <p>Unregisters the handler given by the arguments.</p>
  45522. </dl>
  45523. <p>The <dfn id=dom-navigator-isprotocolhandlerregistered><code>isProtocolHandlerRegistered()</code></dfn>
  45524. 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
  45525. state of the handler described by the two arguments to the method, where the first argument gives
  45526. 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
  45527. will handle the requests.
  45528. <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>
  45529. </p>
  45530. <p>The first argument must be compared to the schemes for which custom protocol handlers are
  45531. 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>
  45532. <p>The second argument must be preprocessed as described below, and if that is successful, must
  45533. then be matched against the <a href=#proto-url id=custom-handlers:proto-url>proto-URLs</a> of the relevant handlers to
  45534. find the described handler.</p>
  45535. <hr>
  45536. <p>The <dfn id=dom-navigator-iscontenthandlerregistered><code>isContentHandlerRegistered()</code></dfn>
  45537. 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
  45538. state of the handler described by the two arguments to the method, where the first argument gives
  45539. 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
  45540. the page that will handle the requests.
  45541. <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>
  45542. </p>
  45543. <p>The first argument must be compared to the <a href=#mime-type id=custom-handlers:mime-type-9>MIME types</a> for which
  45544. 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
  45545. the relevant handlers.</p>
  45546. <p>The second argument must be preprocessed as described below, and if that is successful, must
  45547. then be matched against the <a href=#proto-url id=custom-handlers:proto-url-2>proto-URLs</a> of the relevant handlers to
  45548. find the described handler.</p>
  45549. <hr>
  45550. <p>The <dfn id=handler-state-string>handler state strings</dfn> are the following strings.
  45551. Each string describes several situations, as given by the following list.</p>
  45552. <dl><dt><code>new</code>
  45553. <dd>The described handler has never been registered for the given scheme or type.
  45554. <dd>The described handler was once registered for the given scheme or type, but the site has
  45555. since unregistered it. If the handler were to be reregistered, the user would be notified
  45556. accordingly.
  45557. <dd>The described handler was once registered for the given scheme or type, but the site has
  45558. since unregistered it, but the user has indicated that the site is to be blocked from registering
  45559. the type again, so the user agent would ignore further registration attempts.
  45560. <dt><code>registered</code>
  45561. <dd>An attempt was made to register the described handler for the given scheme or type, but the
  45562. user has not yet been notified, and the user agent would ignore further registration attempts.
  45563. (Maybe the user agent batches registration requests to display them when the user requests to be
  45564. notified about them, and the user has not yet requested that the user agent notify it of the
  45565. previous registration attempt.)
  45566. <dd>The described handler is registered for the given scheme or type (maybe, or maybe not, as the
  45567. default handler).
  45568. <dd>The described handler is permanently blocked from being (re)registered. (Maybe the user
  45569. marked the registration attempt as spam, or blocked the site for other reasons.)
  45570. <dt><code>declined</code>
  45571. <dd>An attempt was made to register the described handler for the given scheme or type, but the
  45572. user has not yet been notified; however, the user might be notified if another registration
  45573. attempt were to be made. (Maybe the last registration attempt was made while the page was in the
  45574. background and the user closed the page without looking at it, and the user agent requires
  45575. confirmation for this registration attempt.)
  45576. <dd>An attempt was made to register the described handler for the given scheme or type, but the
  45577. user has not yet responded.
  45578. <dd>An attempt was made to register the described handler for the given scheme or type, but the
  45579. user declined the offer. The user has not indicated that the handler is to be permanently
  45580. blocked, however, so another attempt to register the described handler might result in the user
  45581. being prompted again.
  45582. <dd>The described handler was once registered for the given scheme or type, but the user has
  45583. since removed it. The user has not indicated that the handler is to be permanently blocked,
  45584. however, so another attempt to register the described handler might result in the user being
  45585. prompted again.
  45586. </dl>
  45587. <hr>
  45588. <p>The <dfn id=dom-navigator-unregisterprotocolhandler><code>unregisterProtocolHandler()</code></dfn>
  45589. method must unregister the handler described by the two arguments to the method, where the first
  45590. 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
  45591. the page that will handle the requests.</p>
  45592. <p>The first argument must be compared to the schemes for which custom protocol handlers are
  45593. 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>
  45594. <p>The second argument must be preprocessed as described below, and if that is successful, must
  45595. then be matched against the <a href=#proto-url id=custom-handlers:proto-url-3>proto-URLs</a> of the relevant handlers to
  45596. find the described handler.</p>
  45597. <hr>
  45598. <p>The <dfn id=dom-navigator-unregistercontenthandler><code>unregisterContentHandler()</code></dfn>
  45599. method must unregister the handler described by the two arguments to the method, where the first
  45600. 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
  45601. <a href=#url id=custom-handlers:url-5>URL</a> of the page that will handle the requests.</p>
  45602. <p>The first argument must be compared to the <a href=#mime-type id=custom-handlers:mime-type-11>MIME types</a> for which
  45603. 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
  45604. the relevant handlers.</p>
  45605. <p>The second argument must be preprocessed as described below, and if that is successful, must
  45606. then be matched against the <a href=#proto-url id=custom-handlers:proto-url-4>proto-URLs</a> of the relevant handlers to
  45607. find the described handler.</p>
  45608. <hr>
  45609. <p>The second argument of the four methods described above must be preprocessed as follows:</p>
  45610. <ol><li><p>If the string does not contain the substring "<code>%s</code>", abort these
  45611. 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
  45612. 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
  45613. 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
  45614. 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>,
  45615. 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
  45616. argument.</ol>
  45617. <h6 id=security-and-privacy>8.6.1.3.1 Security and privacy</h6>
  45618. <p>These mechanisms can introduce a number of concerns, in particular privacy concerns.</p>
  45619. <p><strong>Hijacking all Web usage.</strong> User agents should not allow schemes that are key to
  45620. its normal operation, such as <code>http</code> or <code>https</code>, to be
  45621. rerouted through third-party sites. This would allow a user's activities to be trivially tracked,
  45622. and would allow user information, even in secure connections, to be collected.</p>
  45623. <p><strong>Hijacking defaults.</strong> User agents are strongly urged to not automatically change
  45624. any defaults, as this could lead the user to send data to remote hosts that the user is not
  45625. expecting. New handlers registering themselves should never automatically cause those sites to be
  45626. used.</p>
  45627. <p><strong>Registration spamming.</strong> User agents should consider the possibility that a site
  45628. will attempt to register a large number of handlers, possibly from multiple domains (e.g. by
  45629. redirecting through a series of pages each on a different domain, and each registering a handler
  45630. for <code id=security-and-privacy:video/mpeg><a href=#video/mpeg>video/mpeg</a></code> — analogous practices abusing other Web browser features have
  45631. been used by pornography Web sites for many years). User agents should gracefully handle such
  45632. hostile attempts, protecting the user.</p>
  45633. <p><strong>Misleading titles.</strong> User agents should not rely wholly on the <var>title</var>
  45634. argument to the methods when presenting the registered handlers to the user, since sites could
  45635. easily lie. For example, a site <code>hostile.example.net</code> could claim that it was
  45636. registering the "Cuddly Bear Happy Content Handler". User agents should therefore use the
  45637. handler's domain in any UI along with any title.</p>
  45638. <p><strong>Hostile handler metadata.</strong> User agents should protect against typical attacks
  45639. against strings embedded in their interface, for example ensuring that markup or escape characters
  45640. in such strings are not executed, that null bytes are properly handled, that over-long strings do
  45641. not cause crashes or buffer overruns, and so forth.</p>
  45642. <p><strong>Leaking Intranet URLs.</strong> The mechanism described in this section can result in
  45643. secret Intranet URLs being leaked, in the following manner:</p>
  45644. <ol><li>The user registers a third-party content handler as the default handler for a content
  45645. type.<li>The user then browses his corporate Intranet site and accesses a document that uses that
  45646. content type.<li>The user agent contacts the third party and hands the third party the URL to the Intranet
  45647. content.</ol>
  45648. <p>No actual confidential file data is leaked in this manner, but the URLs themselves could
  45649. contain confidential information. For example, the URL could be <code>http://www.corp.example.com/upcoming-aquisitions/the-sample-company.egf</code>, which
  45650. might tell the third party that Example Corporation is intending to merge with The Sample Company.
  45651. Implementors might wish to consider allowing administrators to disable this feature for certain
  45652. subdomains, content types, or schemes.</p>
  45653. <p><strong>Leaking secure URLs.</strong> User agents should not send HTTPS URLs to third-party
  45654. sites registered as content handlers without the user's informed consent, for the same reason that
  45655. user agents sometimes avoid sending <code id=security-and-privacy:http-referer><a href=#http-referer>Referer</a></code> (sic) HTTP headers
  45656. from secure sites to third-party sites.</p>
  45657. <p><strong>Leaking credentials.</strong> User agents must never send username or password
  45658. information in the URLs that are escaped and included sent to the handler sites. User agents may
  45659. even avoid attempting to pass to Web-based handlers the URLs of resources that are known to
  45660. require authentication to access, as such sites would be unable to access the resources in
  45661. question without prompting the user for credentials themselves (a practice that would require the
  45662. user to know whether to trust the third-party handler, a decision many users are unable to make or
  45663. even understand).</p>
  45664. <p><strong>Interface interference.</strong> User agents should be prepared to handle intentionally
  45665. long arguments to the methods. For example, if the user interface exposed consists of an "accept"
  45666. button and a "deny" button, with the "accept" binding containing the name of the handler, it's
  45667. important that a long name not cause the "deny" button to be pushed off the screen.</p>
  45668. <p><strong>Fingerprinting users.</strong> Since a site can detect if it has attempted to register
  45669. a particular handler or not, whether or not the user responds, the mechanism can be used to store
  45670. data. User agents are therefore strongly urged to treat registrations in the same manner as
  45671. cookies: clearing cookies for a site should also clear all registrations for that site, and
  45672. disabling cookies for a site should also disable registrations.</p>
  45673. <h6 id=sample-handler-impl>8.6.1.3.2 Sample user interface</h6>
  45674. <p><i>This section is non-normative.</i></p>
  45675. <p>A simple implementation of this feature for a desktop Web browser might work as follows.</p>
  45676. <p>The <code id=sample-handler-impl:dom-navigator-registercontenthandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> method
  45677. could display a modal dialog box:</p>
  45678. <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 &quot;kittens.example.org&quot; domain?' with two buttons, 'Trust kittens.example.org' and 'Cancel'." height=374></p>
  45679. <p>In this dialog box, "Kittens at work" is the title of the page that invoked the method,
  45680. "http://kittens.example.org/" is the URL of that page, "application/x-meowmeow" is the string that
  45681. 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
  45682. argument (<var>mimeType</var>), "http://kittens.example.org/?show=%s" was the second
  45683. argument (<var>url</var>), and "Kittens-at-work displayer" was the third argument (<var>title</var>).</p>
  45684. <p>If the user clicks the Cancel button, then nothing further happens. If the user clicks the
  45685. "Trust" button, then the handler is remembered.</p>
  45686. <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
  45687. type</a>, then it might display a dialog as follows:</p>
  45688. <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 &quot;Kittens-at-work displayer&quot; application at &quot;kittens.example.org&quot;', with a checkbox labeled 'Always do this for resources using the &quot;application/x-meowmeow&quot; type in future.', and with two buttons, 'Ok' and 'Cancel'." height=428></p>
  45689. <p>In this dialog, the third option is the one that was primed by the site registering itself
  45690. earlier.</p>
  45691. <p>If the user does select that option, then the browser, in accordance with the requirements
  45692. described in the previous two sections, will redirect the user to
  45693. "http://kittens.example.org/?show=data%3Aapplication/x-meowmeow;base64,S2l0dGVucyBhcmUgdGhlIGN1dGVzdCE%253D".</p>
  45694. <p>The <code id=sample-handler-impl:dom-navigator-registerprotocolhandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> method
  45695. would work equivalently, but for schemes instead of unknown content types.</p>
  45696. <h5 id=manually-releasing-the-storage-mutex>8.6.1.4 Manually releasing the storage mutex</h5>
  45697. <pre class=idl>[NoInterfaceObject]
  45698. interface <dfn id=navigatorstorageutils>NavigatorStorageUtils</dfn> {
  45699. readonly attribute boolean <a href=#dom-navigator-cookieenabled id=manually-releasing-the-storage-mutex:dom-navigator-cookieenabled>cookieEnabled</a>;
  45700. void <a href=#dom-navigator-yieldforstorageupdates id=manually-releasing-the-storage-mutex:dom-navigator-yieldforstorageupdates>yieldForStorageUpdates</a>();
  45701. };</pre>
  45702. <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>
  45703. <p>Returns false if setting a cookie will be ignored, and true otherwise.</p>
  45704. <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>
  45705. <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
  45706. <code id=manually-releasing-the-storage-mutex:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> API, the browser will block other scripts
  45707. from accessing cookies or storage until the first script finishes.</p>
  45708. <p>Calling the <code id=manually-releasing-the-storage-mutex:dom-navigator-yieldforstorageupdates-3><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method
  45709. tells the user agent to unblock any other scripts that may be blocked, even though the script
  45710. hasn't returned.</p>
  45711. <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,
  45712. whence its name.</p>
  45713. </dl>
  45714. <p>The <dfn id=dom-navigator-cookieenabled><code>cookieEnabled</code></dfn> attribute must
  45715. return true if the user agent attempts to handle cookies according to the cookie specification,
  45716. and false if it ignores cookie change requests. <a href=#refsCOOKIES>[COOKIES]</a></p>
  45717. <p>The <dfn id=dom-navigator-yieldforstorageupdates><code>yieldForStorageUpdates()</code></dfn> method,
  45718. 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
  45719. the <a href=#concept-task id=manually-releasing-the-storage-mutex:concept-task>task</a> that resulted in the method being called, release the
  45720. <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>
  45721. <h5 id=plugins-2>8.6.1.5 Plugins</h5>
  45722. <pre class=idl>[NoInterfaceObject]
  45723. interface <dfn id=navigatorplugins>NavigatorPlugins</dfn> {
  45724. readonly attribute <a href=#pluginarray id=plugins-2:pluginarray>PluginArray</a> <a href=#dom-navigator-plugins id=plugins-2:dom-navigator-plugins>plugins</a>;
  45725. readonly attribute <a href=#mimetypearray id=plugins-2:mimetypearray>MimeTypeArray</a> <a href=#dom-navigator-mimetypes id=plugins-2:dom-navigator-mimetypes>mimeTypes</a>;
  45726. readonly attribute boolean <a href=#dom-navigator-javaenabled id=plugins-2:dom-navigator-javaenabled>javaEnabled</a>;
  45727. };
  45728. interface <dfn id=pluginarray>PluginArray</dfn> {
  45729. void <a href=#dom-pluginarray-refresh id=plugins-2:dom-pluginarray-refresh>refresh</a>(optional boolean reload = false);
  45730. readonly attribute unsigned long <a href=#dom-pluginarray-length id=plugins-2:dom-pluginarray-length>length</a>;
  45731. 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);
  45732. 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);
  45733. };
  45734. interface <dfn id=mimetypearray>MimeTypeArray</dfn> {
  45735. readonly attribute unsigned long <a href=#dom-mimetypearray-length id=plugins-2:dom-mimetypearray-length>length</a>;
  45736. 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);
  45737. 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);
  45738. };
  45739. interface <dfn id=dom-plugin>Plugin</dfn> {
  45740. readonly attribute DOMString <a href=#dom-plugin-name id=plugins-2:dom-plugin-name>name</a>;
  45741. readonly attribute DOMString <a href=#dom-plugin-description id=plugins-2:dom-plugin-description>description</a>;
  45742. readonly attribute DOMString <a href=#dom-plugin-filename id=plugins-2:dom-plugin-filename>filename</a>;
  45743. readonly attribute unsigned long <a href=#dom-plugin-length id=plugins-2:dom-plugin-length>length</a>;
  45744. 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);
  45745. 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);
  45746. };
  45747. interface <dfn id=mimetype>MimeType</dfn> {
  45748. readonly attribute DOMString <a href=#dom-mimetype-type id=plugins-2:dom-mimetype-type>type</a>;
  45749. readonly attribute DOMString <a href=#dom-mimetype-description id=plugins-2:dom-mimetype-description>description</a>;
  45750. readonly attribute DOMString <a href=#dom-mimetype-suffixes id=plugins-2:dom-mimetype-suffixes>suffixes</a>; // comma-separated
  45751. 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>;
  45752. };</pre>
  45753. <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>
  45754. <p>Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed.</p>
  45755. <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>
  45756. <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>
  45757. <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>
  45758. <p>Returns the specified <code id=plugins-2:dom-plugin-5><a href=#dom-plugin>Plugin</a></code> object.</p>
  45759. <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>
  45760. <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>
  45761. <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>
  45762. <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>
  45763. <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>
  45764. <p>Returns the specified <code id=plugins-2:mimetype-6><a href=#mimetype>MimeType</a></code> object.</p>
  45765. <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>
  45766. <p>Returns the <code id=plugins-2:mimetype-7><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
  45767. <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-name-2><a href=#dom-plugin-name>name</a></code>
  45768. <dd>
  45769. <p>Returns the plugin's name.</p>
  45770. <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-description-2><a href=#dom-plugin-description>description</a></code>
  45771. <dd>
  45772. <p>Returns the plugin's description.</p>
  45773. <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-filename-2><a href=#dom-plugin-filename>filename</a></code>
  45774. <dd>
  45775. <p>Returns the plugin library's filename, if applicable on the current platform.</p>
  45776. <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-length-2><a href=#dom-plugin-length>length</a></code><dd>
  45777. <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>
  45778. <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>
  45779. <p>Returns the specified <code id=plugins-2:mimetype-9><a href=#mimetype>MimeType</a></code> object.</p>
  45780. <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>
  45781. <p>Returns the <code id=plugins-2:mimetype-10><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
  45782. <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-type-2><a href=#dom-mimetype-type>type</a></code>
  45783. <dd>
  45784. <p>Returns the MIME type.</p>
  45785. <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-description-2><a href=#dom-mimetype-description>description</a></code>
  45786. <dd>
  45787. <p>Returns the MIME type's description.</p>
  45788. <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-suffixes-2><a href=#dom-mimetype-suffixes>suffixes</a></code>
  45789. <dd>
  45790. <p>Returns the MIME type's typical file extensions, in a comma-separated list.</p>
  45791. <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-enabledplugin-2><a href=#dom-mimetype-enabledplugin>enabledPlugin</a></code>
  45792. <dd>
  45793. <p>Returns the <code id=plugins-2:dom-plugin-7><a href=#dom-plugin>Plugin</a></code> object that implements this MIME type.</p>
  45794. <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>
  45795. <p>Returns true if there's a plugin that supports the MIME type "<code>application/x-java-vm</code>".</p>
  45796. </dl>
  45797. <p>The <dfn id=dom-navigator-plugins><code>navigator.plugins</code></dfn> attribute must
  45798. return a <code id=plugins-2:pluginarray-2><a href=#pluginarray>PluginArray</a></code> object. The same object must be returned each time.</p>
  45799. <p>The <dfn id=dom-navigator-mimetypes><code>navigator.mimeTypes</code></dfn> attribute must
  45800. return a <code id=plugins-2:mimetypearray-2><a href=#mimetypearray>MimeTypeArray</a></code> object. The same object must be returned each time.</p>
  45801. <hr>
  45802. <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>
  45803. 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
  45804. be enumerated, but can still be inspected by using its name.</p>
  45805. <p class=note>The fewer <a href=#plugin id=plugins-2:plugin-2>plugins</a> are represented by the
  45806. <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
  45807. increases the number of bits that can be derived for fingerprinting. Hiding a plugin helps, but
  45808. unless it is an extremely rare plugin, it is likely that a site attempting to derive the list of
  45809. plugins can still determine whether the plugin is supported or not by probing for it by name (the
  45810. names of popular plugins are widely known). Therefore not exposing a plugin at all is preferred.
  45811. Unfortunately, many legacy sites use this feature to determine, for example, which plugin to use
  45812. to play video. Not exposing any plugins at all might therefore not be entirely plausible.</p>
  45813. <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
  45814. set of plugins represented by the objects must not change once an object is created, except when
  45815. it is updated by the <code id=plugins-2:dom-pluginarray-refresh-3><a href=#dom-pluginarray-refresh>refresh()</a></code> method.</p>
  45816. <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
  45817. <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
  45818. pick one or more of these <a href=#mime-type id=plugins-2:mime-type-2>MIME types</a> to be those that are
  45819. <dfn id=explicitly-supported>explicitly supported</dfn>.</p>
  45820. <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
  45821. 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
  45822. 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
  45823. actual types supported... at least, within the constraints imposed by compatibility with legacy
  45824. content.</p>
  45825. <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
  45826. 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.
  45827. <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>
  45828. </p>
  45829. <p>The <dfn id=dom-pluginarray-length><code>length</code></dfn> attribute must return the
  45830. 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>
  45831. represented by the object.
  45832. <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>
  45833. </p>
  45834. <p>The <dfn id=dom-pluginarray-item><code>item()</code></dfn> method of a
  45835. <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
  45836. <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
  45837. following steps, using the method's argument as <var>index</var>:</p>
  45838. <ol><li><p>Let <var>list</var> be the <code id=plugins-2:dom-plugin-11><a href=#dom-plugin>Plugin</a></code> objects
  45839. 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>
  45840. <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-3 class=no-backref>for
  45841. privacy</a> that the order of plugins not leak additional information, e.g. the order in which
  45842. plugins were installed.</p>
  45843. <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
  45844. 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
  45845. properties exposed in this way must be <a href=#unenumerable id=plugins-2:unenumerable>unenumerable</a>.
  45846. <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>
  45847. </p>
  45848. <p>The <dfn id=dom-pluginarray-nameditem><code>namedItem()</code></dfn> method of a
  45849. <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
  45850. <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>
  45851. 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>
  45852. <p>The <dfn id=dom-pluginarray-refresh><code>refresh()</code></dfn> method of the
  45853. <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
  45854. see if any <a href=#plugin id=plugins-2:plugin-11>plugins</a> have been installed or reconfigured since the user
  45855. 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
  45856. the user agent must act as if the <code id=plugins-2:dom-location-reload><a href=#dom-location-reload>location.reload()</a></code>
  45857. method was called instead. Otherwise, the user agent must update the <code id=plugins-2:pluginarray-16><a href=#pluginarray>PluginArray</a></code>
  45858. 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>
  45859. 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
  45860. 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
  45861. 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
  45862. 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>
  45863. 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
  45864. the update, though naturally now the data is stale and may appear inconsistent (for example, an
  45865. 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>
  45866. 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>
  45867. <hr>
  45868. <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>
  45869. <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
  45870. agent, each of which is represented by a <code id=plugins-2:mimetype-17><a href=#mimetype>MimeType</a></code> object.</p>
  45871. <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>.
  45872. The set of MIME types represented by the objects must not change once an object is created, except
  45873. 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>
  45874. <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
  45875. 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
  45876. 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
  45877. any.
  45878. <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>
  45879. </p>
  45880. <p>The <dfn id=dom-mimetypearray-length><code>length</code></dfn> attribute must return the
  45881. 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
  45882. corresponding <code id=plugins-2:pluginarray-20><a href=#pluginarray>PluginArray</a></code> object, if any.
  45883. <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>
  45884. </p>
  45885. <p>The <dfn id=dom-mimetypearray-item><code>item()</code></dfn> method of a
  45886. <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
  45887. <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
  45888. following steps, using the method's argument as <var>index</var>:</p>
  45889. <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
  45890. <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>
  45891. <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-7 class=no-backref>for
  45892. privacy</a> that the order of MIME types not leak additional information, e.g. the order in
  45893. which plugins were installed.</p>
  45894. <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
  45895. 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>
  45896. objects represented by the <code id=plugins-2:mimetypearray-11><a href=#mimetypearray>MimeTypeArray</a></code> object. The properties exposed in this way
  45897. must be <a href=#unenumerable id=plugins-2:unenumerable-2>unenumerable</a>.
  45898. <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>
  45899. </p>
  45900. <p>The <dfn id=dom-mimetypearray-nameditem><code>namedItem()</code></dfn> method of a
  45901. <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
  45902. <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
  45903. 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>
  45904. <hr>
  45905. <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
  45906. several attributes to provide details about the plugin, and can be enumerated to obtain the list
  45907. 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
  45908. supports</a>.</p>
  45909. <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
  45910. <a href=#live id=plugins-2:live-3>live</a>. The set of MIME types represented by the objects, and the values of the
  45911. objects' attributes, must not change once an object is created, except when updated by the
  45912. <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>
  45913. method.</p>
  45914. <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
  45915. <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
  45916. <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
  45917. recently.</p>
  45918. <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
  45919. are the numbers from zero to the number of <a href=#reported-mime-types id=plugins-2:reported-mime-types>reported MIME types</a>.
  45920. <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>
  45921. </p>
  45922. <p>The <dfn id=dom-plugin-length><code>length</code></dfn> attribute must return the number
  45923. of <a href=#reported-mime-types id=plugins-2:reported-mime-types-2>reported MIME types</a>.
  45924. <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>
  45925. </p>
  45926. <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
  45927. 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
  45928. the following steps, using the method's argument as <var>index</var>:</p>
  45929. <ol><li><p>Let <var>list</var> be the <code id=plugins-2:mimetype-22><a href=#mimetype>MimeType</a></code> objects representing the
  45930. <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>
  45931. <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-11 class=no-backref>for
  45932. privacy</a> that the order of MIME types not leak additional information, e.g. the order in
  45933. which plugins were installed.</p>
  45934. <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
  45935. are the values of the <code id=plugins-2:dom-mimetype-type-8><a href=#dom-mimetype-type>type</a></code> attributes of the
  45936. <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
  45937. exposed in this way must be <a href=#unenumerable id=plugins-2:unenumerable-3>unenumerable</a>.
  45938. <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>
  45939. </p>
  45940. <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
  45941. object's <a href=#supported-property-names id=plugins-2:supported-property-names-6>supported property names</a>, and otherwise must return the
  45942. <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
  45943. method's argument.</p>
  45944. <p>The <dfn id=dom-plugin-name><code>name</code></dfn> attribute must return the
  45945. <a href=#plugin id=plugins-2:plugin-18>plugin</a>'s name.</p>
  45946. <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
  45947. (or, in all likelihood, <a href=#plugin id=plugins-2:plugin-19>plugin</a>-defined) strings. In each case, the same string must
  45948. 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>
  45949. <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
  45950. <a href=#plugin id=plugins-2:plugin-20>plugin</a>, they can be used both as a fingerprinting vector and, even more importantly,
  45951. as a trivial way to determine what security vulnerabilities a <a href=#plugin id=plugins-2:plugin-21>plugin</a> (and thus a
  45952. 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
  45953. <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.
  45954. <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>
  45955. </p>
  45956. <hr>
  45957. <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,
  45958. <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>
  45959. <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
  45960. values of the objects' attributes must not change once an object is created, except when updated
  45961. 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>
  45962. method.</p>
  45963. <p>The <dfn id=dom-mimetype-type><code>type</code></dfn> attribute must return the
  45964. <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>
  45965. <p>The <dfn id=dom-mimetype-description><code>description</code></dfn> and <dfn id=dom-mimetype-suffixes><code>suffixes</code></dfn> attributes must return
  45966. user-agent-defined (or, in all likelihood, <a href=#plugin id=plugins-2:plugin-23>plugin</a>-defined) strings. In each case, the
  45967. 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>
  45968. <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
  45969. <a href=#plugin id=plugins-2:plugin-24>plugin</a>, they can be used both as a fingerprinting vector and, even more importantly,
  45970. as a trivial way to determine what security vulnerabilities a <a href=#plugin id=plugins-2:plugin-25>plugin</a> (and thus a
  45971. 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
  45972. <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.
  45973. <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>
  45974. </p>
  45975. <p class=note>Commas in the <code id=plugins-2:dom-mimetype-suffixes-5><a href=#dom-mimetype-suffixes>suffixes</a></code> attribute are
  45976. interpreted as separating subsequent filename extensions, as in "<code>htm,html</code>".</p>
  45977. <p>The <dfn id=dom-mimetype-enabledplugin><code>enabledPlugin</code></dfn> attribute must
  45978. 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>
  45979. 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>
  45980. 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
  45981. recently.</p>
  45982. <hr>
  45983. <p>The <dfn id=dom-navigator-javaenabled><code>navigator.javaEnabled</code></dfn> attribute
  45984. 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
  45985. type</a> "<code>application/x-java-vm</code>"; otherwise it must return false.
  45986. <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>
  45987. </p>
  45988. <h4 id=the-external-interface>8.6.2 The <code id=the-external-interface:external><a href=#external>External</a></code> interface</h4>
  45989. <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>
  45990. 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
  45991. returned each time.</p>
  45992. <pre class=idl>interface <dfn id=external>External</dfn> {
  45993. void <a href=#dom-external-addsearchprovider id=the-external-interface:dom-external-addsearchprovider>AddSearchProvider</a>(DOMString engineURL);
  45994. unsigned long <a href=#dom-external-issearchproviderinstalled id=the-external-interface:dom-external-issearchproviderinstalled>IsSearchProviderInstalled</a>(DOMString engineURL);
  45995. };</pre>
  45996. <p class=note>For historical reasons, members on this interface are capitalized.</p>
  45997. <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>
  45998. <p>Adds the search engine described by the OpenSearch description document at <var>url</var>. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>
  45999. <p>The OpenSearch description document has to be on the same server as the script that calls
  46000. this method.</p>
  46001. <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>
  46002. <p>Returns a value based on comparing <var>url</var> to the URLs of the results pages
  46003. of the installed search engines.</p>
  46004. <dl><dt>0 <dd>None of the installed search engines match <var>url</var>.
  46005. <dt>1 <dd>One or more installed search engines match <var>url</var>, but none are the user's default search engine.
  46006. <dt>2 <dd>The user's default search engine matches <var>url</var>.
  46007. </dl>
  46008. <p>The <var>url</var> is compared to the URLs of the results pages of the installed
  46009. search engines using a prefix match. Only results pages on the same domain as the script that
  46010. calls this method are checked.</p>
  46011. </dl>
  46012. <p class=note>Another way of exposing search engines using OpenSearch description documents is
  46013. 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>
  46014. <p>The <dfn id=dom-external-addsearchprovider><code>AddSearchProvider()</code></dfn> method,
  46015. when invoked, must run the following steps:</p>
  46016. <ol><li><p>Optionally, abort these steps. User agents may implement the method as a stub method that
  46017. never does anything, or may arbitrarily ignore invocations with particular arguments for
  46018. 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
  46019. 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
  46020. 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
  46021. description document. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></ol>
  46022. <p>The <dfn id=dom-external-issearchproviderinstalled><code>IsSearchProviderInstalled()</code></dfn>
  46023. method, when invoked, must run the following steps:
  46024. <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>
  46025. </p>
  46026. <ol><li><p>Optionally, return 0 and abort these steps. User agents may implement the method as a
  46027. stub method that never returns a non-zero value, or may arbitrarily ignore invocations with
  46028. 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
  46029. 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
  46030. 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
  46031. 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
  46032. 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
  46033. of the resulting <a href=#parsed-url id=the-external-interface:parsed-url>parsed URL</a>.<li>
  46034. <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
  46035. matches the end of <var>host2</var>, then return 0 and abort these steps. <a href=#refsPSL>[PSL]</a></p>
  46036. <p>If the next domain component of <var>host1</var> and <var>host2</var>
  46037. after their common suffix are not the same, then return 0 and abort these steps.</p>
  46038. <li><p>Let <var>search engines</var> be the list of search engines known by the user
  46039. 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
  46040. 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
  46041. search engines registered using OpenSearch description documents, the <a href=#url id=the-external-interface:url-3>URL</a> of the
  46042. 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
  46043. search engines in <var>search engines</var>, then return 2 and abort these
  46044. steps.<li><p>Return 1.</ol>
  46045. <h3 id=images>8.7 Images</h3>
  46046. <pre class=idl>[Exposed=(Window,Worker)]
  46047. interface <dfn id=imagebitmap>ImageBitmap</dfn> {
  46048. readonly attribute unsigned long <a href=#dom-imagebitmap-width id=images:dom-imagebitmap-width>width</a>;
  46049. readonly attribute unsigned long <a href=#dom-imagebitmap-height id=images:dom-imagebitmap-height>height</a>;
  46050. };
  46051. typedef (<a href=#htmlimageelement id=images:htmlimageelement>HTMLImageElement</a> or
  46052. <a href=#htmlvideoelement id=images:htmlvideoelement>HTMLVideoElement</a> or
  46053. <a href=#htmlcanvaselement id=images:htmlcanvaselement>HTMLCanvasElement</a> or
  46054. <a href=#blob id=images:blob>Blob</a> or
  46055. <a href=#imagedata id=images:imagedata>ImageData</a> or
  46056. <a href=#canvasrenderingcontext2d id=images:canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
  46057. <a href=#imagebitmap id=images:imagebitmap>ImageBitmap</a>) <dfn id=imagebitmapsource>ImageBitmapSource</dfn>;
  46058. [NoInterfaceObject, Exposed=(Window,Worker)]
  46059. interface <dfn id=imagebitmapfactories>ImageBitmapFactories</dfn> {
  46060. <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);
  46061. };
  46062. <a href=#window id=images:window>Window</a> implements <a href=#imagebitmapfactories id=images:imagebitmapfactories>ImageBitmapFactories</a>;
  46063. <a href=#workerglobalscope id=images:workerglobalscope>WorkerGlobalScope</a> implements <a href=#imagebitmapfactories id=images:imagebitmapfactories-2>ImageBitmapFactories</a>;</pre>
  46064. <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
  46065. without undue latency.</p>
  46066. <p class=note>The exact judgement of what is undue latency of this is left up to the
  46067. implementer, but in general if making use of the bitmap requires network I/O, or even local disk
  46068. I/O, then the latency is probably undue; whereas if it only requires a blocking read from a GPU or
  46069. system RAM, the latency is probably acceptable.</p>
  46070. <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>
  46071. <p>Takes <var>image</var>, which can be an <code id=images:the-img-element><a href=#the-img-element>img</a></code> element,
  46072. <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
  46073. <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
  46074. <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
  46075. new <code id=images:imagebitmap-4><a href=#imagebitmap>ImageBitmap</a></code> is created.</p>
  46076. <p>If no <code id=images:imagebitmap-5><a href=#imagebitmap>ImageBitmap</a></code> object can be constructed, for example because the provided
  46077. <var>image</var> data is not actually an image, then the promise is rejected instead.</p>
  46078. <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
  46079. any pixels missing in the original replaced by transparent black. These coordinates are in the
  46080. source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>
  46081. <p>Throws an <code id=images:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the source image is not in a valid
  46082. 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
  46083. <code id=images:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose bitmap data has zero length along one or both
  46084. 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>
  46085. exception if the script is not allowed to access the image data of the source image (e.g. a
  46086. <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
  46087. on by a script in a worker from another <a href=#origin-2 id=images:origin-2>origin</a>).</p>
  46088. <dt><var>imageBitmap</var> . <code id=images:dom-imagebitmap-width-2><a href=#dom-imagebitmap-width>width</a></code><dd>
  46089. <p>Returns the intrinsic width of the image, in CSS pixels.</p>
  46090. <dt><var>imageBitmap</var> . <code id=images:dom-imagebitmap-height-2><a href=#dom-imagebitmap-height>height</a></code><dd>
  46091. <p>Returns the intrinsic height of the image, in CSS pixels.</p>
  46092. </dl>
  46093. <p>An <code id=images:imagebitmap-6><a href=#imagebitmap>ImageBitmap</a></code> object always has associated bitmap data, with a width and a
  46094. height. However, it is possible for this data to be corrupted. If an <code id=images:imagebitmap-7><a href=#imagebitmap>ImageBitmap</a></code>
  46095. object's media data can be decoded without errors, it is said to be <dfn id=concept-imagebitmap-good>fully decodable</dfn>.</p>
  46096. <p>An <code id=images:imagebitmap-8><a href=#imagebitmap>ImageBitmap</a></code> object can be obtained from a variety of different objects, using
  46097. the <dfn id=dom-createimagebitmap><code>createImageBitmap()</code></dfn> method. When invoked, the
  46098. method must act as follows:</p>
  46099. <dl><dt>If <var>image</var> is an <code id=images:the-img-element-3><a href=#the-img-element>img</a></code> element
  46100. <dd>
  46101. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46102. 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
  46103. available</a>, then throw an <code id=images:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
  46104. 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
  46105. 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>,
  46106. 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
  46107. graphic), then throw an <code id=images:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
  46108. 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>
  46109. 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
  46110. image, the <code id=images:imagebitmap-11><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
  46111. image of the animation (the one that the format defines is to be used when animation is not
  46112. supported or is disabled), or, if there is no such image, the first frame of the
  46113. animation.<li><p>Return a new <code id=images:promise-3><a href=#promise>Promise</a></code>, but continue running these steps
  46114. 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
  46115. associated <a href=#concept-resolver id=images:concept-resolver>resolver</a>, with the new
  46116. <code id=images:imagebitmap-12><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46117. <dt>If <var>image</var> is a <code id=images:the-video-element-3><a href=#the-video-element>video</a></code> element
  46118. <dd>
  46119. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46120. 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
  46121. <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
  46122. 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>,
  46123. 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
  46124. <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
  46125. <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
  46126. 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>
  46127. <li><p>Return a new <code id=images:promise-5><a href=#promise>Promise</a></code>, but continue running these steps
  46128. 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
  46129. associated <a href=#concept-resolver id=images:concept-resolver-2>resolver</a>, with the new
  46130. <code id=images:imagebitmap-15><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46131. <dt>If <var>image</var> is a <code id=images:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element
  46132. <dd>
  46133. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46134. 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
  46135. <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
  46136. vertical dimension equal to zero, then throw an <code id=images:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception and
  46137. 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
  46138. <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
  46139. 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
  46140. associated <a href=#concept-resolver id=images:concept-resolver-3>resolver</a>, with the new
  46141. <code id=images:imagebitmap-18><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46142. <dt>If <var>image</var> is a <code id=images:blob-3><a href=#blob>Blob</a></code> object
  46143. <dd>
  46144. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46145. 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>
  46146. 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
  46147. 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
  46148. 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
  46149. 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
  46150. 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
  46151. official type.<li><p>If the image data is not in a supported file format (e.g. it's not actually an image at
  46152. all), or if the image data is corrupted in some fatal way such that the image dimensions cannot
  46153. be obtained, then <a href=#concept-resolver-reject id=images:concept-resolver-reject-2>reject</a> the
  46154. <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
  46155. 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
  46156. <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
  46157. image, the <code id=images:imagebitmap-21><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
  46158. image of the animation (the one that the format defines is to be used when animation is not
  46159. supported or is disabled), or, if there is no such image, the first frame of the
  46160. 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
  46161. associated <a href=#concept-resolver id=images:concept-resolver-6>resolver</a>, with the new
  46162. <code id=images:imagebitmap-22><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46163. <dt>If <var>image</var> is an <code id=images:imagedata-4><a href=#imagedata>ImageData</a></code> object
  46164. <dd>
  46165. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46166. 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>
  46167. attribute has been <a href=#concept-transferable-neutered id=images:concept-transferable-neutered-2>neutered</a>, throw an
  46168. <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
  46169. <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
  46170. associated <a href=#concept-resolver id=images:concept-resolver-7>resolver</a>, with the new
  46171. <code id=images:imagebitmap-25><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46172. <dt>If <var>image</var> is a <code id=images:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
  46173. <dd>
  46174. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46175. 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
  46176. not have its <a href=#concept-canvas-origin-clean id=images:concept-canvas-origin-clean-2>origin-clean</a> flag set, then throw
  46177. 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
  46178. either a horizontal dimension or a vertical dimension equal to zero, then throw an
  46179. <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
  46180. <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
  46181. 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
  46182. 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
  46183. associated <a href=#concept-resolver id=images:concept-resolver-8>resolver</a>, with the new
  46184. <code id=images:imagebitmap-28><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46185. <dt>If <var>image</var> is an <code id=images:imagebitmap-29><a href=#imagebitmap>ImageBitmap</a></code> object
  46186. <dd>
  46187. <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
  46188. 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
  46189. rectangle</a>.<li><p>Return a new <code id=images:promise-17><a href=#promise>Promise</a></code>, but continue running these steps
  46190. 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
  46191. associated <a href=#concept-resolver id=images:concept-resolver-9>resolver</a>, with the new
  46192. <code id=images:imagebitmap-32><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
  46193. </dl>
  46194. <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
  46195. steps:</p>
  46196. <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
  46197. 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
  46198. increasing down, and with each pixel in the <var>input</var> image data occupying a cell
  46199. on the plane's grid.<li>
  46200. <p>Let <var>output</var> be the rectangle on the plane denoted by the rectangle whose
  46201. 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>
  46202. <p class=note>If either <var>sw</var> or <var>sh</var> are negative, then
  46203. the top-left corner of this rectangle will be to the left or above the (<var>sx</var>,
  46204. <var>sy</var>) point. If any of the pixels on this rectangle are outside the area where
  46205. the <var>input</var> bitmap was placed, then they will be transparent black in <var>output</var>.</p>
  46206. <li><p>Return <var>output</var>.</ol>
  46207. <p>The <dfn id=dom-imagebitmap-width><code>width</code></dfn> attribute must return the
  46208. <code id=images:imagebitmap-33><a href=#imagebitmap>ImageBitmap</a></code> object's width, in CSS pixels.</p>
  46209. <p>The <dfn id=dom-imagebitmap-height><code>height</code></dfn> attribute must return the
  46210. <code id=images:imagebitmap-34><a href=#imagebitmap>ImageBitmap</a></code> object's height, in CSS pixels.</p>
  46211. <div class=example>
  46212. <p>Using this API, a sprite sheet can be precut and prepared:</p>
  46213. <pre>var sprites = {};
  46214. function loadMySprites() {
  46215. var image = new Image();
  46216. image.src = 'mysprites.png';
  46217. var resolver;
  46218. var promise = new Promise(function (arg) { resolver = arg });
  46219. image.onload = function () {
  46220. resolver.resolve(Promise.every(
  46221. createImageBitmap(image, 0, 0, 40, 40).then(function (image) { sprites.woman = image }),
  46222. createImageBitmap(image, 40, 0, 40, 40).then(function (image) { sprites.man = image }),
  46223. createImageBitmap(image, 80, 0, 40, 40).then(function (image) { sprites.tree = image }),
  46224. createImageBitmap(image, 0, 40, 40, 40).then(function (image) { sprites.hut = image }),
  46225. createImageBitmap(image, 40, 40, 40, 40).then(function (image) { sprites.apple = image }),
  46226. createImageBitmap(image, 80, 40, 40, 40).then(function (image) { sprites.snake = image }),
  46227. ));
  46228. };
  46229. return promise;
  46230. }
  46231. function runDemo() {
  46232. var canvas = document.querySelector('canvas#demo');
  46233. var context = canvas.getContext('2d');
  46234. context.drawImage(sprites.tree, 30, 10);
  46235. context.drawImage(sprites.snake, 70, 10);
  46236. }
  46237. loadMySprites().then(runDemo);</pre>
  46238. </div>
  46239. <h2 id=comms>9 Communication</h2>
  46240. <h3 id=the-messageevent-interfaces>9.1 The <code id=the-messageevent-interfaces:messageevent><a href=#messageevent>MessageEvent</a></code> interfaces</h3>
  46241. <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
  46242. 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
  46243. <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>
  46244. events:</p>
  46245. <pre class=idl>[Constructor(DOMString type, optional <a href=#messageeventinit id=the-messageevent-interfaces:messageeventinit>MessageEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  46246. interface <dfn id=messageevent>MessageEvent</dfn> : <a href=#event id=the-messageevent-interfaces:event>Event</a> {
  46247. readonly attribute any <a href=#dom-messageevent-data id=the-messageevent-interfaces:dom-messageevent-data>data</a>;
  46248. readonly attribute DOMString <a href=#dom-messageevent-origin id=the-messageevent-interfaces:dom-messageevent-origin>origin</a>;
  46249. readonly attribute DOMString <a href=#dom-messageevent-lasteventid id=the-messageevent-interfaces:dom-messageevent-lasteventid>lastEventId</a>;
  46250. 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>;
  46251. 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>;
  46252. 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);
  46253. };
  46254. dictionary <dfn id=messageeventinit>MessageEventInit</dfn> : <a href=#eventinit id=the-messageevent-interfaces:eventinit>EventInit</a> {
  46255. any data;
  46256. DOMString origin;
  46257. DOMString lastEventId;
  46258. (<a href=#windowproxy id=the-messageevent-interfaces:windowproxy-3>WindowProxy</a> or <a href=#messageport id=the-messageevent-interfaces:messageport-5>MessagePort</a>)? source;
  46259. sequence&lt;<a href=#messageport id=the-messageevent-interfaces:messageport-6>MessagePort</a>> ports;
  46260. };</pre>
  46261. <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>
  46262. <p>Returns the data of the message.</p>
  46263. <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-origin-2><a href=#dom-messageevent-origin>origin</a></code><dd>
  46264. <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
  46265. <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-2>cross-document messaging</a>.</p>
  46266. <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-lasteventid-2><a href=#dom-messageevent-lasteventid>lastEventId</a></code><dd>
  46267. <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
  46268. <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events-3>server-sent events</a>.</p>
  46269. <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-source-2><a href=#dom-messageevent-source>source</a></code><dd>
  46270. <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
  46271. 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
  46272. <code id=the-messageevent-interfaces:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects.</p>
  46273. <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-ports-2><a href=#dom-messageevent-ports>ports</a></code><dd>
  46274. <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
  46275. messaging</a> and <a href=#channel-messaging id=the-messageevent-interfaces:channel-messaging-2>channel messaging</a>.</p>
  46276. </dl>
  46277. <p>The <dfn id=dom-messageevent-data><code>data</code></dfn> attribute must return the value
  46278. it was initialised to. When the object is created, this attribute must be initialised to null. It
  46279. represents the message being sent.</p>
  46280. <p>The <dfn id=dom-messageevent-origin><code>origin</code></dfn> attribute must return the
  46281. value it was initialised to. When the object is created, this attribute must be initialised to the
  46282. 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
  46283. messaging</a>, the <a href=#origin-2 id=the-messageevent-interfaces:origin-2>origin</a> of the document that sent the message (typically the
  46284. scheme, hostname, and port of the document, but not its path or fragment identifier).</p>
  46285. <p>The <dfn id=dom-messageevent-lasteventid><code>lastEventId</code></dfn> attribute must
  46286. return the value it was initialised to. When the object is created, this attribute must be
  46287. 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>
  46288. <p>The <dfn id=dom-messageevent-source><code>source</code></dfn> attribute must return the
  46289. value it was initialised to. When the object is created, this attribute must be initialised to
  46290. 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
  46291. <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
  46292. 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
  46293. <code id=the-messageevent-interfaces:messageport-9><a href=#messageport>MessagePort</a></code>.</p>
  46294. <p>The <dfn id=dom-messageevent-ports><code>ports</code></dfn> attribute must return the
  46295. value it was initialised to. When the object is created, this attribute must be initialised to
  46296. null. It represents, in
  46297. <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
  46298. <code id=the-messageevent-interfaces:messageport-10><a href=#messageport>MessagePort</a></code> array being sent, if any.</p>
  46299. <p>The <dfn id=dom-messageevent-initmessageevent><code>initMessageEvent()</code></dfn>
  46300. 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>
  46301. <h3 id=server-sent-events>9.2 <dfn>Server-sent events</dfn></h3>
  46302. <h4 id=server-sent-events-intro>9.2.1 Introduction</h4>
  46303. <p><i>This section is non-normative.</i></p>
  46304. <p>To enable servers to push data to Web pages over HTTP or using dedicated server-push protocols,
  46305. this specification introduces the <code id=server-sent-events-intro:eventsource><a href=#eventsource>EventSource</a></code> interface.</p>
  46306. <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
  46307. listener.</p>
  46308. <pre>var source = new EventSource('updates.cgi');
  46309. source.onmessage = function (event) {
  46310. alert(event.data);
  46311. };</pre>
  46312. <p>On the server-side, the script ("<code>updates.cgi</code>" in this case) sends
  46313. 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>
  46314. <pre>data: This is the first message.
  46315. data: This is the second message, it
  46316. data: has two lines.
  46317. data: This is the third message.</pre>
  46318. <hr>
  46319. <p>Authors can separate events by using different event types. Here is a stream that has two event
  46320. types, "add" and "remove":</p>
  46321. <pre>event: add
  46322. data: 73857293
  46323. event: remove
  46324. data: 2153
  46325. event: add
  46326. data: 113411</pre>
  46327. <p>The script to handle such a stream would look like this (where <code>addHandler</code>
  46328. and <code>removeHandler</code> are functions that take one argument, the event):</p>
  46329. <pre>var source = new EventSource('updates.cgi');
  46330. source.addEventListener('add', addHandler, false);
  46331. source.addEventListener('remove', removeHandler, false);</pre>
  46332. <p>The default event type is "message".</p>
  46333. <p>Event streams are always decoded as UTF-8. There is no way to specify another character
  46334. encoding.</p>
  46335. <hr>
  46336. <p>Event stream requests can be redirected using HTTP 301 and 307 redirects as with normal HTTP
  46337. requests. Clients will reconnect if the connection is closed; a client can be told to stop
  46338. reconnecting using the HTTP 204 No Content response code.</p>
  46339. <p>Using this API rather than emulating it using <code id=server-sent-events-intro:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code> or an
  46340. <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
  46341. the user agent implementor and the network operator are able to coordinate in advance. Amongst
  46342. other benefits, this can result in significant savings in battery life on portable devices. This
  46343. is discussed further in the section below on <a href=#eventsource-push>connectionless
  46344. push</a>.</p>
  46345. <h4 id=the-eventsource-interface>9.2.2 The <code id=the-eventsource-interface:eventsource><a href=#eventsource>EventSource</a></code> interface</h4>
  46346. <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)]
  46347. interface <dfn id=eventsource>EventSource</dfn> : <a href=#eventtarget id=the-eventsource-interface:eventtarget>EventTarget</a> {
  46348. readonly attribute DOMString <a href=#dom-eventsource-url id=the-eventsource-interface:dom-eventsource-url>url</a>;
  46349. readonly attribute boolean <a href=#dom-eventsource-withcredentials id=the-eventsource-interface:dom-eventsource-withcredentials>withCredentials</a>;
  46350. // ready state
  46351. const unsigned short <a href=#dom-eventsource-connecting id=the-eventsource-interface:dom-eventsource-connecting>CONNECTING</a> = 0;
  46352. const unsigned short <a href=#dom-eventsource-open id=the-eventsource-interface:dom-eventsource-open>OPEN</a> = 1;
  46353. const unsigned short <a href=#dom-eventsource-closed id=the-eventsource-interface:dom-eventsource-closed>CLOSED</a> = 2;
  46354. readonly attribute unsigned short <a href=#dom-eventsource-readystate id=the-eventsource-interface:dom-eventsource-readystate>readyState</a>;
  46355. // networking
  46356. 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>;
  46357. 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>;
  46358. 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>;
  46359. void <a href=#dom-eventsource-close id=the-eventsource-interface:dom-eventsource-close>close</a>();
  46360. };
  46361. dictionary <dfn id=eventsourceinit>EventSourceInit</dfn> {
  46362. boolean <dfn id=dom-eventsourceinit-withcredentials>withCredentials</dfn> = false;
  46363. };</pre>
  46364. <p>The <dfn id=dom-eventsource><code>EventSource()</code></dfn> constructor takes one or two
  46365. arguments. The first specifies the <a href=#url id=the-eventsource-interface:url>URL</a> to which to connect. The second specifies the
  46366. 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
  46367. steps:</p>
  46368. <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
  46369. 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
  46370. 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
  46371. 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
  46372. 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
  46373. <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
  46374. asynchronously.<li>
  46375. <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
  46376. 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
  46377. 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
  46378. object</a>, and process the resource obtained in
  46379. this fashion, if any, as described below.</p>
  46380. <p class=note>The definition of the <a href=#fetch id=the-eventsource-interface:fetch>fetching</a> algorithm (which is
  46381. used by CORS) is such that if the browser is already fetching the resource identified by the
  46382. 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
  46383. being established. All messages received up to this point are dispatched immediately, in this
  46384. case.</p>
  46385. </ol>
  46386. <hr>
  46387. <p>The <dfn id=dom-eventsource-url><code>url</code></dfn> attribute must return the
  46388. <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
  46389. value that was passed to the constructor.</p>
  46390. <p>The <dfn id=dom-eventsource-withcredentials><code>withCredentials</code></dfn> attribute
  46391. must return the value to which it was last initialized. When the object is created, it must be
  46392. initialised to false.</p>
  46393. <p>The <dfn id=dom-eventsource-readystate><code>readyState</code></dfn> attribute represents
  46394. the state of the connection. It can have the following values:</p>
  46395. <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
  46396. 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
  46397. 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>
  46398. <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
  46399. 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
  46400. for handling the connection define when the value changes.</p>
  46401. <p>The <dfn id=dom-eventsource-close><code>close()</code></dfn> method must abort any
  46402. 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,
  46403. 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>
  46404. <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
  46405. handler IDL attributes</a>, by all objects implementing the <code id=the-eventsource-interface:eventsource-6><a href=#eventsource>EventSource</a></code>
  46406. interface:</p>
  46407. <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>
  46408. <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>
  46409. <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>
  46410. <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>
  46411. </table>
  46412. <hr>
  46413. <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
  46414. with it:</p>
  46415. <ul><li>A <dfn id=concept-event-stream-reconnection-time>reconnection time</dfn>, in
  46416. milliseconds. This must initially be a user-agent-defined value, probably in the region of a few
  46417. seconds.<li>A <dfn id=concept-event-stream-last-event-id>last event ID string</dfn>. This must
  46418. initially be the empty string.</ul>
  46419. <p>These values are not currently exposed on the interface.</p>
  46420. <h4 id=processing-model-10>9.2.3 Processing model</h4>
  46421. <p>The resource indicated in the argument to the <code id=processing-model-10:dom-eventsource><a href=#dom-eventsource>EventSource</a></code>
  46422. constructor is <a href=#fetch id=processing-model-10:fetch>fetched</a> when the constructor is run.</p>
  46423. <p>For HTTP connections, the <code id=processing-model-10:http-accept><a href=#http-accept>Accept</a></code> header may be included; if
  46424. included, it must contain only formats of event framing that are supported by the user agent (one
  46425. 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>
  46426. <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
  46427. 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,
  46428. 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>
  46429. <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>
  46430. 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
  46431. 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
  46432. headers in the response, never caching event sources.</p>
  46433. <hr>
  46434. <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
  46435. task source</a> to handle the data must act as follows.</p>
  46436. <p>HTTP 200 OK responses with a <a href=#content-type id=processing-model-10:content-type>Content-Type</a> header specifying the type
  46437. <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
  46438. line by line <a href=#event-stream-interpretation>as described below</a>.</p>
  46439. <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
  46440. 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
  46441. connection</a>.</p>
  46442. <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
  46443. 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
  46444. 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
  46445. asynchronously <a href=#reestablish-the-connection id=processing-model-10:reestablish-the-connection>reestablish the connection</a>. This applies whether the connection is
  46446. closed gracefully or unexpectedly (but does not apply when the <a href=#fetch id=processing-model-10:fetch-3>fetch</a> algorithm is
  46447. 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>,
  46448. since in those cases the final <a href=#concept-task id=processing-model-10:concept-task-3>task</a> is actually discarded).
  46449. It doesn't apply for the error conditions listed below except
  46450. where explicitly specified.</p>
  46451. <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
  46452. 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
  46453. connection</a>.</p>
  46454. <p>HTTP 305 Use Proxy, 401 Unauthorized, and 407 Proxy Authentication Required should be treated
  46455. transparently as for any other subresource.</p>
  46456. <p>HTTP 301 Moved Permanently, 302 Found, 303 See Other, and 307 Temporary Redirect responses are
  46457. handled by the <a href=#fetch id=processing-model-10:fetch-4>fetching</a> and CORS algorithms. In the case of 301
  46458. redirects, the user agent must also remember the new URL so that subsequent requests for this
  46459. 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
  46460. for requests for this object.</p>
  46461. <p id=event-source-network-errors-reconnect>Network errors that prevents the connection from
  46462. being established in the first place (e.g. DNS errors), must cause the user agent to
  46463. asynchronously <a href=#reestablish-the-connection id=processing-model-10:reestablish-the-connection-2>reestablish the connection</a>.</p>
  46464. <p id=event-source-fail-reasons>Any other HTTP response code not listed here, as well as the
  46465. 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
  46466. 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>
  46467. <p>For non-HTTP protocols, UAs should act in equivalent ways.</p>
  46468. <hr>
  46469. <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
  46470. task</a> which, if the <code id=processing-model-10:dom-eventsource-readystate><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
  46471. 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
  46472. 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>
  46473. object.</p>
  46474. <p>When a user agent is to <dfn id=reestablish-the-connection>reestablish the connection</dfn>, the user agent must run the
  46475. 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
  46476. and not asynchronously.)</p>
  46477. <ol><li>
  46478. <p><a href=#queue-a-task id=processing-model-10:queue-a-task-2>Queue a task</a> to run the following steps:</p>
  46479. <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
  46480. <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
  46481. <code id=processing-model-10:eventsource-3><a href=#eventsource>EventSource</a></code> object.</ol>
  46482. <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
  46483. agents might introduce an exponential backoff delay to avoid overloading a potentially already
  46484. overloaded server. Alternatively, if the operating system has reported that there is no network
  46485. connectivity, user agents might wait for the operating system to announce that the network
  46486. connection has returned before retrying.<li><p>Wait until the aforementioned task has run, if it has not yet run.<li>
  46487. <p><a href=#queue-a-task id=processing-model-10:queue-a-task-3>Queue a task</a> to run the following steps:</p>
  46488. <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
  46489. 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
  46490. URL</a> of the event source resource, using the same <i>referrer source</i>, and with the
  46491. same <i>mode</i> and <i>origin</i>, as those
  46492. 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
  46493. this fashion, if any, as described earlier in this section.</ol>
  46494. </ol>
  46495. <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
  46496. task</a> which, if the <code id=processing-model-10:dom-eventsource-readystate-6><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
  46497. 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
  46498. 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.
  46499. <strong>Once the user agent has <a href=#fail-the-connection id=processing-model-10:fail-the-connection-3>failed the connection</a>, it
  46500. does <em>not</em> attempt to reconnect!</strong></p>
  46501. <hr>
  46502. <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
  46503. task source</dfn>.</p>
  46504. <h4 id=parsing-an-event-stream>9.2.4 Parsing an event stream</h4>
  46505. <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>
  46506. <p>The event stream format is as described by the <code>stream</code> production of the
  46507. following ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
  46508. <pre>stream = [ bom ] *event
  46509. event = *( comment / field ) end-of-line
  46510. comment = colon *any-char end-of-line
  46511. field = 1*name-char [ colon [ space ] *any-char ] end-of-line
  46512. end-of-line = ( cr lf / cr / lf )
  46513. ; characters
  46514. lf = %x000A ; U+000A LINE FEED (LF)
  46515. cr = %x000D ; U+000D CARRIAGE RETURN (CR)
  46516. space = %x0020 ; U+0020 SPACE
  46517. colon = %x003A ; U+003A COLON (:)
  46518. bom = %xFEFF ; U+FEFF BYTE ORDER MARK
  46519. name-char = %x0000-0009 / %x000B-000C / %x000E-0039 / %x003B-10FFFF
  46520. ; 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 (:)
  46521. any-char = %x0000-0009 / %x000B-000C / %x000E-10FFFF
  46522. ; 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>
  46523. <p>Event streams in this format must always be encoded as UTF-8. <a href=#refsENCODING>[ENCODING]</a></p>
  46524. <p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character
  46525. pair, a single U+000A LINE FEED (LF) character, or a single U+000D CARRIAGE RETURN (CR)
  46526. character.</p>
  46527. <p>Since connections established to remote servers for such resources are expected to be
  46528. long-lived, UAs should ensure that appropriate buffering is used. In particular, while line
  46529. buffering with lines are defined to end with a single U+000A LINE FEED (LF) character is safe,
  46530. block buffering or line buffering with different expected line endings can cause delays in event
  46531. dispatch.</p>
  46532. <h4 id=event-stream-interpretation>9.2.5 Interpreting an event stream</h4>
  46533. <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>
  46534. <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
  46535. (BOM), if any.</p>
  46536. <p>The stream must then be parsed by reading everything line by line, with a U+000D CARRIAGE
  46537. RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character not
  46538. preceded by a U+000D CARRIAGE RETURN (CR) character, and a single U+000D CARRIAGE RETURN (CR)
  46539. character not followed by a U+000A LINE FEED (LF) character being the ways in which a line can
  46540. end.</p>
  46541. <p>When a stream is parsed, a <var>data</var> buffer, an <var>event type</var>
  46542. buffer, and a <var>last event ID</var> buffer must be associated with it. They must be
  46543. initialised to the empty string</p>
  46544. <p>Lines must be processed, in the order they are received, as follows:</p>
  46545. <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>
  46546. <p>Collect the characters on the line before the first U+003A COLON character (:), and let <var>field</var> be that string.</p>
  46547. <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
  46548. character, remove it from <var>value</var>.</p>
  46549. <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>
  46550. <dt>Otherwise, the string is not empty but does not contain a U+003A COLON character (:)<dd>
  46551. <p><a href=#processField>Process the field</a> using the steps described below, using the
  46552. whole line as the field name, and the empty string as the field value.</p>
  46553. </dl>
  46554. <p>Once the end of the file is reached, any pending data must be discarded. (If the file ends in
  46555. the middle of an event, before the final empty line, the incomplete event is not dispatched.)</p>
  46556. <hr>
  46557. <p id=processField>The steps to <dfn>process the field</dfn> given a field name and a
  46558. field value depend on the field name, as given in the following list. Field names must be compared
  46559. literally, with no case folding performed.</p>
  46560. <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
  46561. 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
  46562. 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.
  46563. Otherwise, ignore the field.<dt>Otherwise<dd><p>The field is ignored.</dl>
  46564. <p>When the user agent is required to <dfn id=dispatchMessage>dispatch the
  46565. 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
  46566. appropriate for the user agent.</p>
  46567. <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>
  46568. <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
  46569. the event source to the value of the <var>last event ID</var> buffer. The buffer does
  46570. 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
  46571. string</a> of the event source remains set to this value until the next time it is set by the
  46572. 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
  46573. abort these steps.<li><p>If the <var>data</var> buffer's last character is a U+000A LINE FEED (LF)
  46574. 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
  46575. <code id=event-stream-interpretation:event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
  46576. default action. The <code id=event-stream-interpretation:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
  46577. 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
  46578. <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
  46579. <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
  46580. 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
  46581. <a href=#concept-event-type id=event-stream-interpretation:concept-event-type>type</a> of the newly created event to equal the value of
  46582. the <var>event type</var> buffer.<li><p>Set the <var>data</var> buffer and the <var>event type</var> buffer to
  46583. 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
  46584. <code id=event-stream-interpretation:eventsource><a href=#eventsource>EventSource</a></code> object.</ol>
  46585. <p class=note>If an event doesn't have an "id" field, but an earlier event did set the event
  46586. 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
  46587. 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
  46588. value of whatever the last seen "id" field was.</p>
  46589. <p>For other user agents, the appropriate steps to <a href=#dispatchMessage id=event-stream-interpretation:dispatchMessage-3>dispatch the event</a> are
  46590. 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>
  46591. <div class=example>
  46592. <p>The following event stream, once followed by a blank line:</p>
  46593. <pre>data: YHOO
  46594. data: +2
  46595. data: 10</pre>
  46596. <p>...would cause an event <code id=event-stream-interpretation:event-message-2><a href=#event-message>message</a></code> with the interface
  46597. <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
  46598. <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>
  46599. <p>This could be used as follows:
  46600. <pre>var stocks = new EventSource("http://stocks.example.com/ticker.php");
  46601. stocks.onmessage = function (event) {
  46602. var data = event.data.split('\n');
  46603. updateStocks(data[0], data[1], data[2]);
  46604. };</pre>
  46605. <p>...where <code>updateStocks()</code> is a function defined as:</p>
  46606. <pre>function updateStocks(symbol, delta, value) { ... }</pre>
  46607. <p>...or some such.</p>
  46608. </div>
  46609. <div class=example>
  46610. <p>The following stream contains four blocks. The first block has just a comment, and will fire
  46611. nothing. The second block has two fields with names "data" and "id" respectively; an event will
  46612. be fired for this block, with the data "first event", and will then set the last event ID to "1"
  46613. 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
  46614. an event with data "second event", and also has an "id" field, this time with no value, which
  46615. 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
  46616. reconnection being attempted). Finally, the last block just fires an event with the data
  46617. " third event" (with a single leading space character). Note that the last still has to
  46618. end with a blank line, the end of the stream is not enough to trigger the dispatch of the last
  46619. event.</p>
  46620. <pre>: test stream
  46621. data: first event
  46622. id: 1
  46623. data:second event
  46624. id
  46625. data:  third event
  46626. </pre>
  46627. </div>
  46628. <div class=example>
  46629. <p>The following stream fires two events:</p>
  46630. <pre>data
  46631. data
  46632. data
  46633. data:</pre>
  46634. <p>The first block fires events with the data set to the empty string, as would the last block if
  46635. it was followed by a blank line. The middle block fires an event with the data set to a single
  46636. newline character. The last block is discarded because it is not followed by a blank line.</p>
  46637. </div>
  46638. <div class=example>
  46639. <p>The following stream fires two identical events:</p>
  46640. <pre>data:test
  46641. data: test
  46642. </pre>
  46643. <p>This is because the space after the colon is ignored if present.</p>
  46644. </div>
  46645. <h4 id=authoring-notes>9.2.6 Authoring notes</h4>
  46646. <p>Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short
  46647. timeout. To protect against such proxy servers, authors can include a comment line (one starting
  46648. with a ':' character) every 15 seconds or so.</p>
  46649. <p>Authors wishing to relate event source connections to each other or to specific documents
  46650. previously served might find that relying on IP addresses doesn't work, as individual clients can
  46651. have multiple IP addresses (due to having multiple proxy servers) and individual IP addresses can
  46652. have multiple clients (due to sharing a proxy server). It is better to include a unique identifier
  46653. in the document when it is served and then pass that identifier as part of the URL when the
  46654. connection is established.</p>
  46655. <p>Authors are also cautioned that HTTP chunking can have unexpected negative effects on the
  46656. reliability of this protocol. Where possible, chunking should be disabled for serving event
  46657. streams unless the rate of messages is high enough for this not to matter.</p>
  46658. <p>Clients that support HTTP's per-server connection limitation might run into trouble when
  46659. 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
  46660. domain. Authors can avoid this using the relatively complex mechanism of using unique domain names
  46661. per connection, or by allowing the user to enable or disable the <code id=authoring-notes:eventsource-2><a href=#eventsource>EventSource</a></code>
  46662. 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
  46663. <a href=#sharedworkerglobalscope id=authoring-notes:sharedworkerglobalscope>shared worker</a>.</p>
  46664. <h4 id=eventsource-push>9.2.7 Connectionless push and other features</h4>
  46665. <p>User agents running in controlled environments, e.g. browsers on mobile handsets tied to
  46666. specific carriers, may offload the management of the connection to a proxy on the network. In such
  46667. a situation, the user agent for the purposes of conformance is considered to include both the
  46668. handset software and the network proxy.</p>
  46669. <div class=example>
  46670. <p>For example, a browser on a mobile device, after having established a connection, might detect
  46671. that it is on a supporting network and request that a proxy server on the network take over the
  46672. management of the connection. The timeline for such a situation might be as follows:</p>
  46673. <ol><li>Browser connects to a remote HTTP server and requests the resource specified by the author
  46674. 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
  46675. involved in keeping the TCP connection alive, and decides to switch to sleep mode to save
  46676. power.<li>The browser disconnects from the server.<li>The browser contacts a service on the network, and requests that that service, a "push
  46677. proxy", maintain the connection instead.<li>The "push proxy" service contacts the remote HTTP server and requests the resource specified
  46678. by the author in the <code id=eventsource-push:dom-eventsource-2><a href=#dom-eventsource>EventSource</a></code> constructor (possibly
  46679. 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
  46680. mobile device, which wakes only enough to process the event and then returns to sleep.</ol>
  46681. </div>
  46682. <p>This can reduce the total data usage, and can therefore result in considerable power
  46683. savings.</p>
  46684. <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
  46685. defined by this specification and in more distributed ways as described above, formats of event
  46686. framing defined by <a href=#other-applicable-specifications id=eventsource-push:other-applicable-specifications>other applicable specifications</a> may be supported. This
  46687. specification does not define how they are to be parsed or processed.</p>
  46688. <h4 id=garbage-collection-2>9.2.8 Garbage collection</h4>
  46689. <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
  46690. 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
  46691. 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
  46692. 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>
  46693. object itself.</p>
  46694. <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
  46695. 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
  46696. <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>
  46697. object's constructor was invoked from to the <code id=garbage-collection-2:eventsource-6><a href=#eventsource>EventSource</a></code> object itself.</p>
  46698. <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
  46699. 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
  46700. <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
  46701. invoked from to that <code id=garbage-collection-2:eventsource-9><a href=#eventsource>EventSource</a></code> object.</p>
  46702. <p>If a user agent is to <dfn id=concept-eventsource-forcibly-close>forcibly close</dfn> an
  46703. <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
  46704. permanently), the user agent must abort any instances of the <a href=#fetch id=garbage-collection-2:fetch>fetch</a> algorithm started
  46705. 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>
  46706. <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,
  46707. the user agent must abort any instance of the <a href=#fetch id=garbage-collection-2:fetch-2>fetch</a> algorithm opened by
  46708. this <code id=garbage-collection-2:eventsource-13><a href=#eventsource>EventSource</a></code>.</p>
  46709. <p class=note>It's possible for one active network connection to be shared by multiple
  46710. <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
  46711. is phrased in terms of aborting the <a href=#fetch id=garbage-collection-2:fetch-4>fetch</a> algorithm and not the actual underlying
  46712. download.</p>
  46713. <h4 id=implementation-advice>9.2.9 Implementation advice</h4>
  46714. <p><i>This section is non-normative.</i></p>
  46715. <p>User agents are strongly urged to provide detailed diagnostic information about
  46716. <code id=implementation-advice:eventsource><a href=#eventsource>EventSource</a></code> objects and their related network connections in their development
  46717. consoles, to aid authors in debugging code using this API.</p>
  46718. <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>
  46719. objects a page has created, each listing the constructor's arguments, whether there was a network
  46720. error, what the CORS status of the connection is and what headers were sent by the client and
  46721. received from the server to lead to that status, the messages that were received and how they were
  46722. parsed, and so forth.</p>
  46723. <p>Implementations are especially encouraged to report detailed information to their development
  46724. consoles whenever an <code id=implementation-advice:event-error><a href=#event-error>error</a></code> event is fired, since little to no
  46725. information can be made available in the events themselves.</p>
  46726. <h4 id=iana-considerations>9.2.10 IANA considerations</h4>
  46727. <h5 id=text/event-stream>9.2.10.1 <dfn><code>text/event-stream</code></dfn></h5>
  46728. <p>This registration is for community review and will be submitted to the IESG for review,
  46729. approval, and registration with IANA.</p>
  46730. <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>event-stream<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
  46731. <dl><dt><code>charset</code><dd>
  46732. <p>The <code>charset</code> parameter may be provided. The parameter's value must be
  46733. "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
  46734. compatibility with legacy servers.</p>
  46735. </dl>
  46736. <dt>Encoding considerations:<dd>8bit (always UTF-8)<dt>Security considerations:<dd>
  46737. <p>An event stream from an origin distinct from the origin of the content consuming the event
  46738. stream can result in information leakage. To avoid this, user agents are required to apply CORS
  46739. semantics. <a href=#refsFETCH>[FETCH]</a></p>
  46740. <p>Event streams can overwhelm a user agent; a user agent is expected to apply suitable
  46741. restrictions to avoid depleting local resources because of an overabundance of information from
  46742. an event stream.</p>
  46743. <p>Servers can be overwhelmed if a situation develops in which the server is causing clients to
  46744. reconnect rapidly. Servers should use a 5xx status code to indicate capacity problems, as this
  46745. will prevent conforming clients from reconnecting automatically.</p>
  46746. <dt>Interoperability considerations:<dd>
  46747. Rules for processing both conforming and non-conforming content are defined in this
  46748. specification.
  46749. <dt>Published specification:<dd>
  46750. This document is the relevant specification.
  46751. <dt>Applications that use this media type:<dd>
  46752. Web browsers and tools using Web services.
  46753. <dt>Additional information:<dd>
  46754. <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>
  46755. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;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
  46756. similar protocol. Finite resources are not expected to be labeled with this type.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  46757. <p>Fragment identifiers have no meaning with
  46758. <code id=text/event-stream:text/event-stream><a href=#text/event-stream>text/event-stream</a></code> resources.</p>
  46759. <h5 id=last-event-id>9.2.10.2 <dfn><code>Last-Event-ID</code></dfn></h5>
  46760. <p>This section describes a header for registration in the Permanent Message Header Field
  46761. Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
  46762. <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>
  46763. This document is the relevant specification.
  46764. <dt>Related information:<dd>None.</dl>
  46765. <h3 id=network>9.3 <dfn>Web sockets</dfn></h3>
  46766. <h4 id=network-intro>9.3.1 Introduction</h4>
  46767. <p><i>This section is non-normative.</i></p>
  46768. <p>To enable Web applications to maintain bidirectional communications with server-side processes,
  46769. this specification introduces the <code id=network-intro:websocket><a href=#websocket>WebSocket</a></code> interface.</p>
  46770. <p class=note>This interface does not allow for raw access to the underlying network. For
  46771. example, this interface could not be used to implement an IRC client without proxying messages
  46772. through a custom server.</p>
  46773. <h4 id=the-websocket-interface>9.3.2 The <code id=the-websocket-interface:websocket><a href=#websocket>WebSocket</a></code> interface</h4>
  46774. <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>" };
  46775. [<a href=#dom-websocket id=the-websocket-interface:dom-websocket>Constructor</a>(DOMString url, optional (DOMString or DOMString[]) protocols), Exposed=(Window,Worker)]
  46776. interface <dfn id=websocket>WebSocket</dfn> : <a href=#eventtarget id=the-websocket-interface:eventtarget>EventTarget</a> {
  46777. readonly attribute DOMString <a href=#dom-websocket-url id=the-websocket-interface:dom-websocket-url>url</a>;
  46778. // ready state
  46779. const unsigned short <a href=#dom-websocket-connecting id=the-websocket-interface:dom-websocket-connecting>CONNECTING</a> = 0;
  46780. const unsigned short <a href=#dom-websocket-open id=the-websocket-interface:dom-websocket-open>OPEN</a> = 1;
  46781. const unsigned short <a href=#dom-websocket-closing id=the-websocket-interface:dom-websocket-closing>CLOSING</a> = 2;
  46782. const unsigned short <a href=#dom-websocket-closed id=the-websocket-interface:dom-websocket-closed>CLOSED</a> = 3;
  46783. readonly attribute unsigned short <a href=#dom-websocket-readystate id=the-websocket-interface:dom-websocket-readystate>readyState</a>;
  46784. readonly attribute unsigned long <a href=#dom-websocket-bufferedamount id=the-websocket-interface:dom-websocket-bufferedamount>bufferedAmount</a>;
  46785. // networking
  46786. 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>;
  46787. 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>;
  46788. 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>;
  46789. readonly attribute DOMString <a href=#dom-websocket-extensions id=the-websocket-interface:dom-websocket-extensions>extensions</a>;
  46790. readonly attribute DOMString <a href=#dom-websocket-protocol id=the-websocket-interface:dom-websocket-protocol>protocol</a>;
  46791. void <a href=#dom-websocket-close id=the-websocket-interface:dom-websocket-close>close</a>([Clamp] optional unsigned short code, optional DOMString reason);
  46792. // messaging
  46793. 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>;
  46794. 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>;
  46795. void <a href=#dom-websocket-send id=the-websocket-interface:dom-websocket-send>send</a>(DOMString data);
  46796. 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);
  46797. 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);
  46798. 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);
  46799. };</pre>
  46800. <p>The <dfn id=dom-websocket><code>WebSocket(<var>url</var>,
  46801. <var>protocols</var>)</code></dfn> constructor takes one or two arguments. The first argument,
  46802. <var>url</var>, specifies the <a href=#url id=the-websocket-interface:url>URL</a> to which to connect. The second,
  46803. <var>protocols</var>, if present, is either a string or an array of strings. If it is a string, it
  46804. is equivalent to an array consisting of just that string; if it is omitted, it is equivalent to
  46805. the empty array. Each string in the array is a subprotocol name. The connection will only be
  46806. established if the server reports that it has selected one of these subprotocols. The subprotocol
  46807. names must all be strings that match the requirements for elements that comprise the value of
  46808. <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
  46809. WebSocket protocol specification. <a href=#refsWSP>[WSP]</a></p>
  46810. <p>When the <code id=the-websocket-interface:dom-websocket-2><a href=#dom-websocket>WebSocket()</a></code> constructor is invoked, the UA must
  46811. run these steps:</p>
  46812. <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
  46813. the <var>url</var> argument, to obtain <var>host</var>, <var>port</var>, <var>resource
  46814. 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
  46815. 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
  46816. settings object</a> has a scheme component that is itself a secure protocol, e.g. HTTPS, then
  46817. throw a <code id=the-websocket-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li>
  46818. <p>If <var>port</var> is a port to which the user agent is configured to block access, then
  46819. throw a <code id=the-websocket-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps. (User agents typically block
  46820. access to well-known ports like SMTP.)</p>
  46821. <p>Access to ports 80 and 443 should not be blocked, including the unlikely cases when
  46822. <var>secure</var> is false but <var>port</var> is 443 or <var>secure</var> is true but
  46823. <var>port</var> is 80.</p>
  46824. <li>
  46825. <p>If <var>protocols</var> is absent, let <var>protocols</var> be an empty array.</p>
  46826. <p>Otherwise, if <var>protocols</var> is present and a string, let <var>protocols</var> instead
  46827. be an array consisting of just that string.</p>
  46828. <li><p>If any of the values in <var>protocols</var> occur more than once or otherwise fail to
  46829. 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
  46830. WebSocket protocol specification, then throw a <code id=the-websocket-interface:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
  46831. 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
  46832. 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
  46833. 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
  46834. asynchronously.<li><p>Let the new object's <dfn id=client-specified-protocols>client-specified protocols</dfn> be the values (if any) given in
  46835. <var>protocols</var>.<li>
  46836. <p><i id=the-websocket-interface:concept-websocket-establish><a href=#concept-websocket-establish>Establish a WebSocket connection</a></i> given the set
  46837. (<var>host</var>, <var>port</var>, <var>resource name</var>, <var>secure</var>), along with the
  46838. <var>protocols</var> list, an empty list for the extensions, and <var>origin</var>. The
  46839. <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>
  46840. 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
  46841. the URL <var>url</var>; for these purposes this is <em>not</em> a "non-HTTP" API. <a href=#refsWSP>[WSP]</a>
  46842. <a href=#refsCOOKIES>[COOKIES]</a></p>
  46843. <p>When the user agent <i id=the-websocket-interface:concept-websocket-validate><a href=#concept-websocket-validate>validates the server's
  46844. response</a></i> during the "<i id=the-websocket-interface:concept-websocket-establish-2><a href=#concept-websocket-establish>establish a WebSocket
  46845. connection</a></i>" algorithm, if the status code received from the server is not 101 (e.g. it is a
  46846. redirect), the user agent must <i id=the-websocket-interface:concept-websocket-fail><a href=#concept-websocket-fail>fail the WebSocket
  46847. connection</a></i>.</p>
  46848. <p class=warning>Following HTTP procedures here could introduce serious security problems in a
  46849. Web browser context. For example, consider a host with a WebSocket server at one path and an
  46850. open HTTP redirector at another. Suddenly, any script that can be given a particular WebSocket
  46851. URL can be tricked into communicating to (and potentially sharing secrets with) any host on the
  46852. Internet, even if the script checks that the URL has the right hostname.</p>
  46853. <p class=note>If the <i id=the-websocket-interface:concept-websocket-establish-3><a href=#concept-websocket-establish>establish a WebSocket
  46854. connection</a></i> algorithm fails, it triggers the <i id=the-websocket-interface:concept-websocket-fail-2><a href=#concept-websocket-fail>fail the
  46855. 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
  46856. establishes that <i id=the-websocket-interface:concept-websocket-closed><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
  46857. which fires the <code id=the-websocket-interface:event-close><a href=#event-close>close</a></code> event <a href=#closeWebSocket>as
  46858. described below</a>.</p>
  46859. </ol>
  46860. <hr>
  46861. <p>The <dfn id=dom-websocket-url><code>url</code></dfn> attribute must return the result of
  46862. <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
  46863. constructor, with the URL character encoding set to UTF-8. (It doesn't matter what it is resolved
  46864. relative to, since we already know it is an <a href=#absolute-url id=the-websocket-interface:absolute-url>absolute URL</a>.)</p>
  46865. <p>The <dfn id=dom-websocket-readystate><code>readyState</code></dfn> attribute represents
  46866. the state of the connection. It can have the following values:</p>
  46867. <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
  46868. 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>
  46869. <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
  46870. set to <code id=the-websocket-interface:dom-websocket-connecting-2><a href=#dom-websocket-connecting>CONNECTING</a></code> (0).</p>
  46871. <p>The <dfn id=dom-websocket-extensions><code>extensions</code></dfn> attribute must
  46872. initially return the empty string. After <i id=the-websocket-interface:concept-websocket-established-2><a href=#concept-websocket-established>the WebSocket
  46873. connection is established</a></i>, its value might change, as defined below.</p>
  46874. <p class=note>The <code id=the-websocket-interface:dom-websocket-extensions-2><a href=#dom-websocket-extensions>extensions</a></code> attribute returns
  46875. the extensions selected by the server, if any. (Currently this will only ever be the empty
  46876. string.)</p>
  46877. <p>The <dfn id=dom-websocket-protocol><code>protocol</code></dfn> attribute must initially
  46878. return the empty string. After <i>the WebSocket connection is established</i>, its value might
  46879. change, as defined below.</p>
  46880. <p class=note>The <code id=the-websocket-interface:dom-websocket-protocol-2><a href=#dom-websocket-protocol>protocol</a></code> attribute returns the
  46881. subprotocol selected by the server, if any. It can be used in conjunction with the array form of
  46882. the constructor's second argument to perform subprotocol negotiation.</p>
  46883. <p>The <dfn id=dom-websocket-close><code>close()</code></dfn> method must run the following
  46884. steps:</p>
  46885. <ol><li><p>If the method's first argument is present but is neither an integer equal to 1000 nor an
  46886. integer in the range 3000 to 4999, throw an <code id=the-websocket-interface:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort
  46887. these steps.<li>
  46888. <p>If the method's second argument is present, then run these substeps:</p>
  46889. <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
  46890. Unicode characters</a>.<li><p>Let <var>reason</var> be the result of encoding <var>Unicode
  46891. reason</var> as UTF-8.<li><p>If <var>reason</var> is longer than 123 bytes, then throw a
  46892. <code id=the-websocket-interface:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. <a href=#refsENCODING>[ENCODING]</a></ol>
  46893. <li><p>Run the first matching steps from the following list:</p>
  46894. <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>
  46895. <p>Do nothing.</p>
  46896. <p class=note>The connection is already closing or is already closed. If it has not already,
  46897. 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>
  46898. <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>
  46899. <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>
  46900. <p class=note>The <i id=the-websocket-interface:concept-websocket-fail-4><a href=#concept-websocket-fail>fail the WebSocket connection</a></i>
  46901. algorithm invokes the <i id=the-websocket-interface:concept-websocket-close-2><a href=#concept-websocket-close>close the WebSocket connection</a></i>
  46902. algorithm, which then establishes that <i id=the-websocket-interface:concept-websocket-closed-2><a href=#concept-websocket-closed>the WebSocket
  46903. 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>
  46904. <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>
  46905. <p><i id=the-websocket-interface:concept-websocket-start-closing-handshake><a href=#concept-websocket-start-closing-handshake>Start the WebSocket closing
  46906. handshake</a></i> and set the <code id=the-websocket-interface:dom-websocket-readystate-5><a href=#dom-websocket-readystate>readyState</a></code>
  46907. 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>
  46908. <p>If the first argument is present, then the status code to use in the
  46909. WebSocket Close message must be the integer given by the first argument. <a href=#refsWSP>[WSP]</a></p>
  46910. <p>If the second argument is also present, then <var>reason</var> must be provided in the
  46911. Close message after the status code. <a href=#refsENCODING>[ENCODING]</a> <a href=#refsWSP>[WSP]</a></p>
  46912. <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
  46913. 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
  46914. establishes that <i id=the-websocket-interface:concept-websocket-closed-3><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
  46915. which fires the <code id=the-websocket-interface:event-close-4><a href=#event-close>close</a></code> event <a href=#closeWebSocket>as
  46916. described below</a>.</p>
  46917. <dt>Otherwise<dd>
  46918. <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>
  46919. <p class=note><i id=the-websocket-interface:concept-websocket-closing-handshake-2><a href=#concept-websocket-closing-handshake>The WebSocket closing
  46920. 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
  46921. establish that <i id=the-websocket-interface:concept-websocket-closed-4><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
  46922. 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>
  46923. </dl>
  46924. </ol>
  46925. <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
  46926. previously sent messages before starting the WebSocket closing handshake — even if, in
  46927. practice, the user agent is still busy sending those messages, the handshake will only start after
  46928. the messages are sent.</p>
  46929. <hr>
  46930. <p>The <dfn id=dom-websocket-bufferedamount><code>bufferedAmount</code></dfn> attribute must
  46931. return the number of bytes of application data (UTF-8 text and binary data) that have been queued
  46932. 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
  46933. <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
  46934. includes any text sent during the execution of the current task, regardless of whether the user
  46935. agent is able to transmit text asynchronously with script execution.) This does not include
  46936. framing overhead incurred by the protocol, or buffering done by the operating system or network
  46937. hardware. If the connection is closed, this attribute's value will only increase with each call to
  46938. 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
  46939. the connection closes).</p>
  46940. <div class=example>
  46941. <p>In this simple example, the <code id=the-websocket-interface:dom-websocket-bufferedamount-2><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code>
  46942. attribute is used to ensure that updates are sent either at the rate of one update every 50ms, if
  46943. the network can handle that rate, or at whatever rate the network <em>can</em> handle, if that is
  46944. too fast.</p>
  46945. <pre>var socket = new WebSocket('ws://game.example.com:12010/updates');
  46946. socket.onopen = function () {
  46947. setInterval(function() {
  46948. if (socket.bufferedAmount == 0)
  46949. socket.send(getUpdateData());
  46950. }, 50);
  46951. };</pre>
  46952. <p>The <code id=the-websocket-interface:dom-websocket-bufferedamount-3><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute can also be
  46953. used to saturate the network without sending the data at a higher rate than the network can
  46954. handle, though this requires more careful monitoring of the value of the attribute over time.</p>
  46955. </div>
  46956. <hr>
  46957. <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
  46958. "<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
  46959. set to. On setting, the user agent must set the IDL attribute to the new value.</p>
  46960. <p class=note>This attribute allows authors to control how binary data is exposed to scripts. By
  46961. setting the attribute to "<dfn id=dom-binarytype-blob><code>blob</code></dfn>", binary data
  46962. 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
  46963. <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
  46964. 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
  46965. 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
  46966. data in memory. Naturally, user agents are encouraged to use more subtle heuristics to decide
  46967. whether to keep incoming data in memory or not, e.g. based on how big the data is or how common it
  46968. is for a script to change the attribute at the last minute. This latter aspect is important in
  46969. particular because it is quite possible for the attribute to be changed after the user agent has
  46970. received the data but before the user agent has fired the event for it.</p>
  46971. <p>The <dfn id=dom-websocket-send><code>send(<var>data</var>)</code></dfn> method transmits
  46972. data using the connection. If the <code id=the-websocket-interface:dom-websocket-readystate-7><a href=#dom-websocket-readystate>readyState</a></code>
  46973. attribute is <code id=the-websocket-interface:dom-websocket-connecting-3><a href=#dom-websocket-connecting>CONNECTING</a></code>, it must throw an
  46974. <code id=the-websocket-interface:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, the user agent must run the appropriate set
  46975. of steps from the following list:</p>
  46976. <dl><dt>If the argument is a string<dd>
  46977. <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
  46978. characters</a>. If <i id=the-websocket-interface:concept-websocket-established-4><a href=#concept-websocket-established>the WebSocket connection is
  46979. established</a></i> and <i id=the-websocket-interface:concept-websocket-closing-handshake-3><a href=#concept-websocket-closing-handshake>the WebSocket closing
  46980. 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
  46981. a text frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but
  46982. the buffer is full, the user agent must <a href=#concept-websocket-close-fail id=the-websocket-interface:concept-websocket-close-fail>flag the
  46983. WebSocket as full</a> and then <i id=the-websocket-interface:concept-websocket-close-5><a href=#concept-websocket-close>close the WebSocket
  46984. connection</a></i>. Any invocation of this method with a string argument that does not throw an
  46985. exception must increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-4><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code>
  46986. attribute by the number of bytes needed to express the argument as UTF-8. <a href=#refsUNICODE>[UNICODE]</a>
  46987. <a href=#refsENCODING>[ENCODING]</a> <a href=#refsWSP>[WSP]</a></p>
  46988. <dt>If the argument is a <code id=the-websocket-interface:blob-3><a href=#blob>Blob</a></code> object<dd>
  46989. <p>If <i id=the-websocket-interface:concept-websocket-established-5><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
  46990. <i id=the-websocket-interface:concept-websocket-closing-handshake-4><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
  46991. 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
  46992. Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
  46993. sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
  46994. <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
  46995. 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
  46996. <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
  46997. <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>
  46998. <dt>If the argument is an <code id=the-websocket-interface:arraybuffer-3><a href=#arraybuffer>ArrayBuffer</a></code> object<dd>
  46999. <p>If <i id=the-websocket-interface:concept-websocket-established-6><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
  47000. <i id=the-websocket-interface:concept-websocket-closing-handshake-5><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
  47001. 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
  47002. Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
  47003. sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
  47004. <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
  47005. 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
  47006. 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
  47007. increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-6><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the
  47008. 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>
  47009. <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>
  47010. <p>If <i id=the-websocket-interface:concept-websocket-established-7><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
  47011. <i id=the-websocket-interface:concept-websocket-closing-handshake-6><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
  47012. 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
  47013. Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
  47014. sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
  47015. <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
  47016. 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
  47017. <var>data</var> references. Any invocation of this method with this kind of argument that does
  47018. 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
  47019. <var>data</var>'s buffer in bytes. <a href=#refsWSP>[WSP]</a> <a href=#refsECMA262>[ECMA262]</a></p>
  47020. </dl>
  47021. <hr>
  47022. <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
  47023. handler IDL attributes</a>, by all objects implementing the <code id=the-websocket-interface:websocket-4><a href=#websocket>WebSocket</a></code>
  47024. interface:</p>
  47025. <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>
  47026. <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>
  47027. <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>
  47028. <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>
  47029. <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>
  47030. </table>
  47031. <h4 id=feedback-from-the-protocol>9.3.3 Feedback from the protocol</h4>
  47032. <p>When <i id=feedback-from-the-protocol:concept-websocket-established><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, the
  47033. 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>
  47034. <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
  47035. 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
  47036. 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
  47037. <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
  47038. 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
  47039. 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
  47040. <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
  47041. 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
  47042. 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>
  47043. <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
  47044. <code id=feedback-from-the-protocol:websocket-2><a href=#websocket>WebSocket</a></code> object.</p>
  47045. </ol>
  47046. <hr>
  47047. <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>
  47048. 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>
  47049. to follow these steps: <a href=#refsWSP>[WSP]</a></p>
  47050. <ol><li>
  47051. <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
  47052. <code id=feedback-from-the-protocol:dom-websocket-open-2><a href=#dom-websocket-open>OPEN</a></code> (1), then abort these steps.</p>
  47053. <li>
  47054. <p>Let <var>event</var> be a newly created <a href=#concept-events-trusted id=feedback-from-the-protocol:concept-events-trusted>trusted</a>
  47055. 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
  47056. default action.</p>
  47057. <li><p>Initialise <var>event</var>'s <code id=feedback-from-the-protocol:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code>
  47058. attribute to the <a href=#unicode-serialisation-of-an-origin id=feedback-from-the-protocol:unicode-serialisation-of-an-origin>Unicode serialisation</a>
  47059. 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>
  47060. object's constructor.<li>
  47061. <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>.
  47062. <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
  47063. represents <var>data</var> as its raw data. <a href=#refsFILEAPI>[FILEAPI]</a></p>
  47064. <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
  47065. <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>
  47066. object whose contents are <var>data</var>. <a href=#refsECMA262>[ECMA262]</a></p>
  47067. <li>
  47068. <p><a href=#concept-event-dispatch id=feedback-from-the-protocol:concept-event-dispatch>Dispatch</a> <var>event</var> at the
  47069. <code id=feedback-from-the-protocol:websocket-4><a href=#websocket>WebSocket</a></code> object.</p>
  47070. </ol>
  47071. <p class=note>User agents are encouraged to check if they can perform the above steps
  47072. efficiently before they run the task, picking tasks from other <a href=#task-queue id=feedback-from-the-protocol:task-queue>task
  47073. 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
  47074. the data to disk, but just before running the above <a href=#concept-task id=feedback-from-the-protocol:concept-task>task</a> for
  47075. 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
  47076. 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
  47077. stalling the main thread while it created the <code id=feedback-from-the-protocol:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> object.</p>
  47078. <div class=example>
  47079. <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>
  47080. <pre>mysocket.onmessage = function (event) {
  47081. if (event.data == 'on') {
  47082. turnLampOn();
  47083. } else if (event.data == 'off') {
  47084. turnLampOff();
  47085. }
  47086. };</pre>
  47087. <p>The protocol here is a trivial one, with the server just sending "on" or "off" messages.</p>
  47088. </div>
  47089. <hr>
  47090. <p>When <i id=feedback-from-the-protocol:concept-websocket-closing-handshake><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake is
  47091. 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>
  47092. <hr>
  47093. <p id=closeWebSocket>When <i id=feedback-from-the-protocol:concept-websocket-closed><a href=#concept-websocket-closed>the WebSocket connection is
  47094. 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
  47095. following substeps:</p>
  47096. <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
  47097. <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
  47098. 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
  47099. closed</a></i> after being <dfn id=concept-websocket-close-fail>flagged as full</dfn>,
  47100. <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>
  47101. 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
  47102. <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>,
  47103. 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
  47104. 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
  47105. 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
  47106. connection close reason</a></i>, and <a href=#concept-event-dispatch id=feedback-from-the-protocol:concept-event-dispatch-2>dispatch</a> the event
  47107. at the <code id=feedback-from-the-protocol:websocket-6><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></ol>
  47108. <div class=warning>
  47109. <p>User agents must not convey any failure information to scripts in a way that would allow a
  47110. script to distinguish the following situations:</p>
  47111. <ul><li>A server whose host name could not be resolved.
  47112. <li>A server to which packets could not successfully be routed.
  47113. <li>A server that refused the connection on the specified port.
  47114. <li>A server that failed to correctly perform a TLS handshake (e.g., the server certificate
  47115. can't be verified).
  47116. <li>A server that did not complete the opening handshake (e.g. because it was not a WebSocket
  47117. server).
  47118. <li>A WebSocket server that sent a correct opening handshake, but that specified options that
  47119. caused the client to drop the connection (e.g. the server specified a subprotocol that the
  47120. client did not offer).
  47121. <li>A WebSocket server that abruptly closed the connection after successfully completing the
  47122. opening handshake.
  47123. </ul>
  47124. <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
  47125. required by the WebSocket Protocol specification. <a href=#refsWSP>[WSP]</a></p>
  47126. <p>Allowing a script to distinguish these cases would allow a script to probe the user's local
  47127. network in preparation for an attack.</p>
  47128. <p class=note>In particular, this means the code 1015 is not used by the user agent (unless the
  47129. server erroneously uses it in its close frame, of course).</p>
  47130. </div>
  47131. <hr>
  47132. <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>
  47133. <h4 id=ping-and-pong-frames>9.3.4 Ping and Pong frames</h4>
  47134. <p>The WebSocket protocol specification defines Ping and Pong frames that can be used for
  47135. keep-alive, heart-beats, network status probing, latency instrumentation, and so forth. These are
  47136. not currently exposed in the API.</p>
  47137. <p>User agents may send ping and unsolicited pong frames as desired, for example in an attempt to
  47138. maintain local network NAT mappings, to detect failed connections, or to display latency metrics
  47139. to the user. User agents must not use pings or unsolicited pongs to aid the server; it is assumed
  47140. that servers will solicit pongs whenever appropriate for the server's needs.</p>
  47141. <h4 id=parsing-websocket-urls>9.3.5 Parsing WebSocket URLs</h4>
  47142. <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
  47143. follows. These steps return either a <var>host</var>, a <var>port</var>, a <var>resource
  47144. name</var>, and a <var>secure</var> flag, or they fail.</p>
  47145. <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
  47146. algorithm.<li>
  47147. <p><a href=#resolve-a-url id=parsing-websocket-urls:resolve-a-url>Resolve</a> the <var>url</var> string, with the URL character
  47148. encoding set to UTF-8. <a href=#refsENCODING>[ENCODING]</a></p>
  47149. <p class=note>It doesn't matter what it is resolved relative to, since we already know it is
  47150. an <a href=#absolute-url id=parsing-websocket-urls:absolute-url-2>absolute URL</a> at this point.</p>
  47151. <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
  47152. <a href=#parsed-url id=parsing-websocket-urls:parsed-url-3>parsed URL</a> is "<code>ws</code>", set <var>secure</var> to false;
  47153. 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>
  47154. component that is not the empty string, then let <var>port</var> be that component's value;
  47155. 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
  47156. <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
  47157. 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
  47158. 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
  47159. <var>secure</var>.</ol>
  47160. <h4 id=the-closeevent-interfaces>9.3.6 The <code id=the-closeevent-interfaces:closeevent><a href=#closeevent>CloseEvent</a></code> interfaces</h4>
  47161. <pre class=idl>[Constructor(DOMString type, optional <a href=#closeeventinit id=the-closeevent-interfaces:closeeventinit>CloseEventInit</a> eventInitDict), Exposed=(Window,Worker)]
  47162. interface <dfn id=closeevent>CloseEvent</dfn> : <a href=#event id=the-closeevent-interfaces:event>Event</a> {
  47163. readonly attribute boolean <a href=#dom-closeevent-wasclean id=the-closeevent-interfaces:dom-closeevent-wasclean>wasClean</a>;
  47164. readonly attribute unsigned short <a href=#dom-closeevent-code id=the-closeevent-interfaces:dom-closeevent-code>code</a>;
  47165. readonly attribute DOMString <a href=#dom-closeevent-reason id=the-closeevent-interfaces:dom-closeevent-reason>reason</a>;
  47166. };
  47167. dictionary <dfn id=closeeventinit>CloseEventInit</dfn> : <a href=#eventinit id=the-closeevent-interfaces:eventinit>EventInit</a> {
  47168. boolean wasClean;
  47169. unsigned short code;
  47170. DOMString reason;
  47171. };</pre>
  47172. <p>The <dfn id=dom-closeevent-wasclean><code>wasClean</code></dfn> attribute must return the
  47173. value it was initialised to. When the object is created, this attribute must be initialised to
  47174. false. It represents whether the connection closed cleanly or not.</p>
  47175. <p>The <dfn id=dom-closeevent-code><code>code</code></dfn> attribute must return the value it
  47176. was initialised to. When the object is created, this attribute must be initialised to zero. It
  47177. represents the WebSocket connection close code provided by the server.</p>
  47178. <p>The <dfn id=dom-closeevent-reason><code>reason</code></dfn> attribute must return the
  47179. value it was initialised to. When the object is created, this attribute must be initialised to
  47180. empty string. It represents the WebSocket connection close reason provided by the server.</p>
  47181. <h4 id=garbage-collection-3>9.3.7 Garbage collection</h4>
  47182. <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>
  47183. 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
  47184. 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
  47185. 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
  47186. <code id=garbage-collection-3:event-close><a href=#event-close>close</a></code> events.</p>
  47187. <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>
  47188. 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
  47189. 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
  47190. 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>
  47191. <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>
  47192. 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
  47193. 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
  47194. 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>
  47195. <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
  47196. established connection</a></i> that has data queued to be transmitted to the network must not be
  47197. garbage collected. <a href=#refsWSP>[WSP]</a></p>
  47198. <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
  47199. user agent must <i id=garbage-collection-3:concept-websocket-start-closing-handshake><a href=#concept-websocket-start-closing-handshake>start the WebSocket closing
  47200. handshake</a></i>, with no status code for the Close message. <a href=#refsWSP>[WSP]</a></p>
  47201. <hr>
  47202. <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
  47203. 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
  47204. set of steps from the following list:</p>
  47205. <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>
  47206. <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>
  47207. <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>
  47208. <p><i id=garbage-collection-3:concept-websocket-start-closing-handshake-2><a href=#concept-websocket-start-closing-handshake>Start the WebSocket closing
  47209. handshake</a></i>, with the status code to use in the WebSocket Close message being
  47210. 1001. <a href=#refsWSP>[WSP]</a></p>
  47211. <dt>Otherwise<dd>
  47212. <p>Do nothing.</p>
  47213. </dl>
  47214. <h3 id=web-messaging>9.4 <dfn id=crossDocumentMessages>Cross-document messaging</dfn></h3>
  47215. <p>Web browsers, for security and privacy reasons, prevent documents in different domains from
  47216. affecting each other; that is, cross-site scripting is disallowed.</p>
  47217. <p>While this is an important security feature, it prevents pages from different domains from
  47218. communicating even when those pages are not hostile. This section introduces a messaging system
  47219. that allows documents to communicate with each other regardless of their source domain, in a way
  47220. designed to not enable cross-site scripting attacks.</p>
  47221. <p class=note>This API <a href=fingerprint-postMessage>has some privacy implications</a> that
  47222. may not be immediately obvious.</p>
  47223. <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
  47224. <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>
  47225. <h4 id=introduction-13>9.4.1 Introduction</h4>
  47226. <p><i>This section is non-normative.</i></p>
  47227. <div class=example>
  47228. <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,
  47229. and script in document A calls <code id=introduction-13:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
  47230. <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,
  47231. 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
  47232. look like:</p>
  47233. <pre>var o = document.getElementsByTagName('iframe')[0];
  47234. o.contentWindow.postMessage('Hello world', 'http://b.example.org/');</pre>
  47235. <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
  47236. might look like:</p>
  47237. <pre>window.addEventListener('message', receiver, false);
  47238. function receiver(e) {
  47239. if (e.origin == 'http://example.com') {
  47240. if (e.data == 'Hello world') {
  47241. e.source.postMessage('Hello', e.origin);
  47242. } else {
  47243. alert(e.data);
  47244. }
  47245. }
  47246. }</pre>
  47247. <p>This script first checks the domain is the expected domain, and then looks at the message,
  47248. which it either displays to the user, or responds to by sending a message back to the document
  47249. which sent the message in the first place.</p>
  47250. </div>
  47251. <h4 id=security-postmsg>9.4.2 Security</h4>
  47252. <h5 id=authors>9.4.2.1 Authors</h5>
  47253. <p id=security-4 class=warning>Use of this API requires extra care to protect users from
  47254. hostile entities abusing a site for their own purposes.</p>
  47255. <p>Authors should check the <code id=authors:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute to
  47256. ensure that messages are only accepted from domains that they expect to receive messages from.
  47257. Otherwise, bugs in the author's message handling code could be exploited by hostile sites.</p>
  47258. <p>Furthermore, even after checking the <code id=authors:dom-messageevent-origin-2><a href=#dom-messageevent-origin>origin</a></code>
  47259. attribute, authors should also check that the data in question is of the expected format.
  47260. Otherwise, if the source of the event has been attacked using a cross-site scripting flaw, further
  47261. 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
  47262. propagated into the receiver.</p>
  47263. <p>Authors should not use the wildcard keyword (*) in the <var>targetOrigin</var>
  47264. argument in messages that contain any confidential information, as otherwise there is no way to
  47265. guarantee that the message is only delivered to the recipient to which it was intended.</p>
  47266. <hr>
  47267. <p>Authors who accept messages from any origin are encouraged to consider the risks of a
  47268. denial-of-service attack. An attacker could send a high volume of messages; if the receiving page
  47269. performs expensive computation or causes network traffic to be sent for each such message, the
  47270. attacker's message could be multplied into a denial-of-service attack. Authors are encouraged to
  47271. employ rate limiting (only accepting a certain number of messages per minute) to make such attacks
  47272. impractical.</p>
  47273. <h5 id=user-agents>9.4.2.2 User agents</h5>
  47274. <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
  47275. post arbitrary events (using <code>dispatchEvent()</code> or otherwise) to objects in
  47276. other origins (those that are not the <a href=#same-origin id=user-agents:same-origin>same</a>).</p>
  47277. <p class=note>Implementors are urged to take extra care in the implementation of this feature.
  47278. It allows authors to transmit information from one domain to another domain, which is normally
  47279. disallowed for security reasons. It also requires that UAs be careful to allow access to certain
  47280. properties but not others.</p>
  47281. <hr>
  47282. <p>User agents are also encouraged to consider rate-limiting message traffic between different
  47283. <a href=#origin-2 id=user-agents:origin-2-2>origins</a>, to protect naïve sites from denial-of-service
  47284. attacks.</p>
  47285. <h4 id=posting-messages>9.4.3 Posting messages</h4>
  47286. <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>
  47287. <p>Posts a message to the given window. Messages can be structured objects, e.g. nested objects
  47288. and arrays, can contain JavaScript values (strings, numbers, <code id=posting-messages:idl-date><a href=#idl-date>Date</a></code>
  47289. 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>,
  47290. <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>
  47291. <p>Objects listed in <var>transfer</var> are transferred, not just cloned, meaning that
  47292. they are no longer usable on the sending side.</p>
  47293. <p>If the origin of the target window doesn't match the given origin, the message is discarded,
  47294. to avoid information leakage. To send the message to the target regardless of origin, set the
  47295. target origin to "<code>*</code>". To restrict the message to same-origin targets only,
  47296. without needing to explicitly state the origin, set the target origin to "<code>/</code>".</p>
  47297. <p>Throws a <code id=posting-messages:datacloneerror><a href=#datacloneerror>DataCloneError</a></code> exception if <var>transfer</var> array contains
  47298. duplicate objects or if <var>message</var> could not be cloned.</p>
  47299. </dl>
  47300. <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>
  47301. 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
  47302. receiving its intended recipient: the scripts in the target <a href=#browsing-context id=posting-messages:browsing-context-2>browsing context</a> have to
  47303. have had time to set up listeners for the messages. Thus, for instance, in situations where a
  47304. 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>,
  47305. 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
  47306. announcing their readiness to receive messages, and for the parent to wait for this message before
  47307. beginning posting messages.</p>
  47308. <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
  47309. <code id=posting-messages:window-3><a href=#window>Window</a></code> object, the user agent must follow these steps:</p>
  47310. <ol><li><p>If the value of the <var>targetOrigin</var> argument is neither a single U+002A
  47311. ASTERISK character (*), a single U+002F SOLIDUS character (/), nor an <a href=#absolute-url id=posting-messages:absolute-url>absolute URL</a>,
  47312. 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
  47313. <code id=posting-messages:transferable><a href=#transferable>Transferable</a></code> objects to placeholder objects.<li>
  47314. <p>If the method was invoked with a third argument <var>transfer</var>, run these
  47315. substeps:</p>
  47316. <ol><li><p>If any object is listed in <var>transfer</var> more than once, or any of the
  47317. <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
  47318. <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
  47319. 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
  47320. <code id=posting-messages:messageport><a href=#messageport>MessagePort</a></code> object, also append the placeholder object to the <var>new
  47321. ports</var> array.</ol>
  47322. <li><p>Let <var>message clone</var> be the result of obtaining a <a href=#structured-clone id=posting-messages:structured-clone>structured
  47323. clone</a> of the <var>message</var> argument, with <var>transfer map</var>
  47324. as the <i>transfer map</i>. If this throws an exception, then throw that exception and abort
  47325. these steps.<li>
  47326. <p>If the method was invoked with a third argument <var>transfer</var>, run these
  47327. substeps:</p>
  47328. <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
  47329. <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
  47330. 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
  47331. 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
  47332. (i.e. in <var>message clone</var> and in <var>new ports</var>).</ol>
  47333. <li><p>Make <var>new ports</var> into a <a href=#dfn-read-only-array id=posting-messages:dfn-read-only-array>read
  47334. 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
  47335. asynchronously continue running these steps.<li>
  47336. <p>If the <var>targetOrigin</var> argument is a single literal U+002F SOLIDUS
  47337. 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
  47338. 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
  47339. document</a> specified by the <a href=#entry-settings-object id=posting-messages:entry-settings-object>entry settings object</a>, then abort these steps
  47340. silently.</p>
  47341. <p>Otherwise, if the <var>targetOrigin</var> argument is an <a href=#absolute-url id=posting-messages:absolute-url-2>absolute URL</a>,
  47342. 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
  47343. does not have the <a href=#same-origin id=posting-messages:same-origin-2>same origin</a> as <var>targetOrigin</var>, then abort
  47344. these steps silently.</p>
  47345. <p>Otherwise, the <var>targetOrigin</var> argument is a single literal U+002A ASTERISK
  47346. character (*), and no origin check is made.</p>
  47347. <li><p>Create a <a href=#concept-events-trusted id=posting-messages:concept-events-trusted>trusted</a> event that uses the
  47348. <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
  47349. default action. The <code id=posting-messages:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
  47350. 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
  47351. <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
  47352. <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
  47353. <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
  47354. <code id=posting-messages:dom-messageevent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialised to the <var>new
  47355. 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
  47356. 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
  47357. 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
  47358. <a href=#posted-message-task-source id=posting-messages:posted-message-task-source>posted message task source</a>.</ol>
  47359. <h3 id=channel-messaging>9.5 <dfn>Channel messaging</dfn></h3>
  47360. <h4 id=introduction-14>9.5.1 Introduction</h4>
  47361. <p><i>This section is non-normative.</i></p>
  47362. <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
  47363. messaging</a>.</p>
  47364. <p>Communication channels in this mechanism are implemented as two-ways pipes, with a port at each
  47365. end. Messages sent in one port are delivered at the other port, and vice-versa. Messages are
  47366. asynchronous, and delivered as DOM events.</p>
  47367. <p>To create a connection (two "entangled" ports), the <code>MessageChannel()</code>
  47368. constructor is called:</p>
  47369. <pre>var channel = new MessageChannel();</pre>
  47370. <p>One of the ports is kept as the local port, and the other port is sent to the remote code, e.g.
  47371. using <code id=introduction-14:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>
  47372. <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
  47373. <p>To send messages, the <code id=introduction-14:dom-messageport-postmessage><a href=#dom-messageport-postmessage>postMessage()</a></code> method on
  47374. the port is used:</p>
  47375. <pre>channel.port1.postMessage('hello');</pre>
  47376. <p>To receive messages, one listens to <code id=introduction-14:event-message><a href=#event-message>message</a></code> events:</p>
  47377. <pre>channel.port1.onmessage = handleMessage;
  47378. function handleMessage(event) {
  47379. // message is in event.data
  47380. // ...
  47381. }</pre>
  47382. <p>Data sent on a port can be structured data; for example here an array of strings is passed on a
  47383. <code id=introduction-14:messageport><a href=#messageport>MessagePort</a></code>:</p>
  47384. <pre>port1.postMessage(['hello', 'world']);</pre>
  47385. <h5 id=examples-5>9.5.1.1 Examples</h5>
  47386. <p><i>This section is non-normative.</i></p>
  47387. <div class=example>
  47388. <p>In this example, two JavaScript libraries are connected to each other using
  47389. <code id=examples-5:messageport><a href=#messageport>MessagePort</a></code>s. This allows the libraries to later be hosted in different frames, or
  47390. in <code id=examples-5:worker><a href=#worker>Worker</a></code> objects, without any change to the APIs.</p>
  47391. <pre>&lt;script src="contacts.js">&lt;/script> &lt;!-- exposes a contacts object -->
  47392. &lt;script src="compose-mail.js">&lt;/script> &lt;!-- exposes a composer object -->
  47393. &lt;script>
  47394. var channel = new MessageChannel();
  47395. composer.addContactsProvider(channel.port1);
  47396. contacts.registerConsumer(channel.port2);
  47397. &lt;/script></pre>
  47398. <p>Here's what the "addContactsProvider()" function's implementation could look like:</p>
  47399. <pre>function addContactsProvider(port) {
  47400. port.onmessage = function (event) {
  47401. switch (event.data.messageType) {
  47402. 'search-result': handleSearchResult(event.data.results); break;
  47403. 'search-done': handleSearchDone(); break;
  47404. 'search-error': handleSearchError(event.data.message); break;
  47405. // ...
  47406. }
  47407. };
  47408. };</pre>
  47409. <p>Alternatively, it could be implemented as follows:</p>
  47410. <pre>function addContactsProvider(port) {
  47411. port.addEventListener('message', function (event) {
  47412. if (event.data.messageType == 'search-result')
  47413. handleSearchResult(event.data.results);
  47414. });
  47415. port.addEventListener('message', function (event) {
  47416. if (event.data.messageType == 'search-done')
  47417. handleSearchDone();
  47418. });
  47419. port.addEventListener('message', function (event) {
  47420. if (event.data.messageType == 'search-error')
  47421. handleSearchError(event.data.message);
  47422. });
  47423. // ...
  47424. port.start();
  47425. };</pre>
  47426. <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>
  47427. <p>The <code id=examples-5:dom-messageport-start-3><a href=#dom-messageport-start>start()</a></code> method, whether called explicitly or
  47428. implicitly (by setting <code id=examples-5:handler-messageport-onmessage-2><a href=#handler-messageport-onmessage>onmessage</a></code>), starts the
  47429. flow of messages: messages posted on message ports are initially paused, so that they don't get
  47430. dropped on the floor before the script has had a chance to set up its handlers.</p>
  47431. </div>
  47432. <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>
  47433. <p><i>This section is non-normative.</i></p>
  47434. <p>Ports can be viewed as a way to expose limited capabilities (in the object-capability model
  47435. sense) to other actors in the system. This can either be a weak capability system, where the ports
  47436. are merely used as a convenient model within a particular origin, or as a strong capability model,
  47437. where they are provided by one origin <var>provider</var> as the only mechanism by which
  47438. another origin <var>consumer</var> can effect change in or obtain information from <var>provider</var>.</p>
  47439. <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>
  47440. the user's e-mail contacts provider (an address book site, from a second origin), and in a second
  47441. <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
  47442. <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
  47443. only:</p>
  47444. <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
  47445. <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
  47446. <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
  47447. 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
  47448. <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>
  47449. API.</ul>
  47450. <p>The contacts provider can use these methods, most particularly the third one, to provide an API
  47451. that can be accessed by other origins to manipulate the user's address book. For example, it could
  47452. respond to a message "<code>add-contact Guillaume Tell
  47453. &lt;tell@pomme.example.net></code>" by adding the given person and e-mail address to the user's
  47454. address book.</p>
  47455. <p>To avoid any site on the Web being able to manipulate the user's contacts, the contacts
  47456. provider might only allow certain trusted sites, such as the social site, to do this.</p>
  47457. <p>Now suppose the game wanted to add a contact to the user's address book, and that the social
  47458. site was willing to allow it to do so on its behalf, essentially "sharing" the trust that the
  47459. contacts provider had with the social site. There are several ways it could do this; most simply,
  47460. it could just proxy messages between the game site and the contacts site. However, this solution
  47461. has a number of difficulties: it requires the social site to either completely trust the game site
  47462. not to abuse the privilege, or it requires that the social site verify each request to make sure
  47463. it's not a request that it doesn't want to allow (such as adding multiple contacts, reading the
  47464. contacts, or deleting them); it also requires some additional complexity if there's ever the
  47465. possibility of multiple games simultaneously trying to interact with the contacts provider.</p>
  47466. <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
  47467. go away. When the game tells the social site that it wants to add a contact, the social site can
  47468. ask the contacts provider not for it to add a contact, but for the <em>capability</em> to add a
  47469. 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
  47470. sends one of them back to the social site, who forwards it on to the game. The game and the
  47471. contacts provider then have a direct connection, and the contacts provider knows to only honor a
  47472. single "add contact" request, nothing else. In other words, the game has been granted the
  47473. capability to add a single contact.</p>
  47474. <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>
  47475. <p><i>This section is non-normative.</i></p>
  47476. <p>Continuing the example from the previous section, consider the contacts provider in particular.
  47477. 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
  47478. 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>
  47479. <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
  47480. to allow multiple simultaneous independent sessions, the service implementation can switch from
  47481. 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
  47482. 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
  47483. provider side can all be forwarded to the shared worker without it affecting the users of the API
  47484. in the slightest.</p>
  47485. <h4 id=message-channels>9.5.2 Message channels</h4>
  47486. <pre class=idl>[<a href=#dom-messagechannel id=message-channels:dom-messagechannel>Constructor</a>, Exposed=(Window,Worker)]
  47487. interface <dfn id=messagechannel>MessageChannel</dfn> {
  47488. readonly attribute <a href=#messageport id=message-channels:messageport>MessagePort</a> <a href=#dom-messagechannel-port1 id=message-channels:dom-messagechannel-port1>port1</a>;
  47489. 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>;
  47490. };</pre>
  47491. <dl class=domintro><dt><var>channel</var> = new <code id=message-channels:dom-messagechannel-2><a href=#dom-messagechannel>MessageChannel</a></code>()<dd>
  47492. <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>
  47493. <dt><var>channel</var> . <code id=message-channels:dom-messagechannel-port1-2><a href=#dom-messagechannel-port1>port1</a></code><dd>
  47494. <p>Returns the first <code id=message-channels:messageport-4><a href=#messageport>MessagePort</a></code> object.</p>
  47495. <dt><var>channel</var> . <code id=message-channels:dom-messagechannel-port2-2><a href=#dom-messagechannel-port2>port2</a></code><dd>
  47496. <p>Returns the second <code id=message-channels:messageport-5><a href=#messageport>MessagePort</a></code> object.</p>
  47497. </dl>
  47498. <p>When the <dfn id=dom-messagechannel><code>MessageChannel()</code></dfn> constructor is
  47499. called, it must run the following algorithm:</p>
  47500. <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
  47501. <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
  47502. <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
  47503. object.<li><p>Let the <code id=message-channels:dom-messagechannel-port1-3><a href=#dom-messagechannel-port1>port1</a></code> attribute of the
  47504. <var>channel</var> object be <var>port1</var>.</p>
  47505. <li><p>Let the <code id=message-channels:dom-messagechannel-port2-3><a href=#dom-messagechannel-port2>port2</a></code> attribute of the
  47506. <var>channel</var> object be <var>port2</var>.</p>
  47507. <li><p>Return <var>channel</var>.</ol>
  47508. <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
  47509. assigned when the <code id=message-channels:messagechannel-3><a href=#messagechannel>MessageChannel</a></code> object was created.</p>
  47510. <h4 id=message-ports>9.5.3 Message ports</h4>
  47511. <p>Each channel has two message ports. Data sent through one port is received by the other port,
  47512. and vice versa.</p>
  47513. <pre class=idl>[Exposed=(Window,Worker)]
  47514. interface <dfn id=messageport>MessagePort</dfn> : <a href=#eventtarget id=message-ports:eventtarget>EventTarget</a> {
  47515. void <a href=#dom-messageport-postmessage id=message-ports:dom-messageport-postmessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable id=message-ports:transferable>Transferable</a>> transfer);
  47516. void <a href=#dom-messageport-start id=message-ports:dom-messageport-start>start</a>();
  47517. void <a href=#dom-messageport-close id=message-ports:dom-messageport-close>close</a>();
  47518. // event handlers
  47519. attribute <a href=#eventhandler id=message-ports:eventhandler>EventHandler</a> <a href=#handler-messageport-onmessage id=message-ports:handler-messageport-onmessage>onmessage</a>;
  47520. };
  47521. // <a href=#messageport id=message-ports:messageport>MessagePort</a> implements <a href=#transferable id=message-ports:transferable-2>Transferable</a>;</pre>
  47522. <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>
  47523. <p>Posts a message through the channel. Objects listed in <var>transfer</var> are
  47524. transferred, not just cloned, meaning that they are no longer usable on the sending side.</p>
  47525. <p>Throws a <code id=message-ports:datacloneerror><a href=#datacloneerror>DataCloneError</a></code> exception if <var>transfer</var> array contains
  47526. duplicate objects or the source or target ports, or if <var>message</var> could not be
  47527. cloned.</p>
  47528. <dt><var>port</var> . <code id=message-ports:dom-messageport-start-2><a href=#dom-messageport-start>start</a></code>()<dd>
  47529. <p>Begins dispatching messages received on the port.</p>
  47530. <dt><var>port</var> . <code id=message-ports:dom-messageport-close-2><a href=#dom-messageport-close>close</a></code>()<dd>
  47531. <p>Disconnects the port, so that it is no longer active.</p>
  47532. </dl>
  47533. <p>Each <code id=message-ports:messageport-2><a href=#messageport>MessagePort</a></code> object can be entangled with another (a symmetric relationship).
  47534. 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
  47535. 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
  47536. disabled, and is initially disabled. Once enabled, a port can never be disabled again (though
  47537. messages in the queue can get moved to another queue or removed altogether, which has much the
  47538. 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
  47539. 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
  47540. object</a> set when the object is created, as described below.</p>
  47541. <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
  47542. 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
  47543. <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
  47544. message queue</a> must be associated with the <a href=#responsible-document id=message-ports:responsible-document>responsible document</a> specified by
  47545. the port's <a href=#concept-port-owner id=message-ports:concept-port-owner-2>owner</a>.</p>
  47546. <p class=note>If the port's <a href=#concept-port-owner id=message-ports:concept-port-owner-3>owner</a> specifies a
  47547. <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
  47548. 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
  47549. active</a>, then the messages will be lost.</p>
  47550. <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
  47551. 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
  47552. 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
  47553. <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
  47554. message queue</a> is enabled, and whose <a href=#concept-port-owner id=message-ports:concept-port-owner-4>owner</a>
  47555. 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
  47556. 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
  47557. 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>
  47558. <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
  47559. 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
  47560. <a href=#unshipped-port-message-queue id=message-ports:unshipped-port-message-queue-2>unshipped port message queue</a> is used instead.)</p>
  47561. <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
  47562. 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
  47563. 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>,
  47564. unaffected to any <a href=#unshipped-port-message-queue id=message-ports:unshipped-port-message-queue-3>unshipped port message queue</a>.</p>
  47565. <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> with a
  47566. particular <a href=#settings-object id=message-ports:settings-object-3>settings object</a> as its <var>owner</var>, it must instantiate a
  47567. 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
  47568. <var>owner</var>.</p>
  47569. <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
  47570. the following steps:</p>
  47571. <ol><li>
  47572. <p>If one of the ports is already entangled, then disentangle it and the port that it was
  47573. entangled with.</p>
  47574. <p class=note>If those two previously entangled ports were the two ports of a
  47575. <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
  47576. represents an actual channel: the two ports in that object are no longer entangled.</p>
  47577. <li>
  47578. <p>Associate the two ports to be entangled, so that they form the two parts of a new channel.
  47579. (There is no <code id=message-ports:messagechannel-3><a href=#messagechannel>MessageChannel</a></code> object that represents this channel.)</p>
  47580. <p>Two ports <var>A</var> and <var>B</var> that have gone through this step
  47581. are now said to be entangled; one is entangled to the other, and vice versa.</p>
  47582. <p class=note>While this specification describes this process as instantaneous,
  47583. implementations are more likely to implement it via message passing. As with all algorithms, the
  47584. key is "merely" that the end result be indistinguishable, in a black-box sense, from the
  47585. specification.</p>
  47586. </ol>
  47587. <p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var>original port</var>, with the
  47588. clone being owned by <var>owner</var>, it must run the following steps, which return a
  47589. new <code id=message-ports:messageport-10><a href=#messageport>MessagePort</a></code> object. These steps must be run atomically.</p>
  47590. <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
  47591. 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
  47592. 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>
  47593. 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
  47594. 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>
  47595. <p>If the <var>original port</var> is entangled with another port, then run these
  47596. substeps:</p>
  47597. <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
  47598. true.<li><p><a href=#entangle id=message-ports:entangle>Entangle</a> the <var>remote port</var> and <var>new
  47599. port</var> objects. The <var>original port</var> object will be disentangled by this
  47600. process.</ol>
  47601. <li><p>Return <var>new port</var>. It is the clone.</ol>
  47602. <p id=transferMessagePort>To <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-2>transfer</a> a
  47603. <code id=message-ports:messageport-11><a href=#messageport>MessagePort</a></code> object <var>old</var> to a new owner <var>owner</var>,
  47604. a user agent must <a href=#clone-a-port id=message-ports:clone-a-port>clone</a> the <var>old</var> object with
  47605. the clone being owned by <var>owner</var>, thus obtaining <var>new</var>, must
  47606. <a href=#concept-transferable-neutered id=message-ports:concept-transferable-neutered>neuter</a> the <var>old</var> port, and
  47607. must finally return <var>new</var>.</p>
  47608. <hr>
  47609. <p>The <dfn id=dom-messageport-postmessage><code>postMessage()</code></dfn> method, when
  47610. called on a port <var>source port</var>, must cause the user agent to run the following
  47611. steps:</p>
  47612. <ol><li><p>Let <var>target port</var> be the port with which <var>source port</var>
  47613. is entangled, if any.<li>
  47614. <p>Let <var>doomed</var> be false. It is set to true if a condition is detected that
  47615. 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>
  47616. <li>
  47617. <p>Let <var>new ports</var> be an empty array.</p>
  47618. <li>
  47619. <p>Let <var>transfer map</var> be an empty association list of
  47620. <code id=message-ports:transferable-3><a href=#transferable>Transferable</a></code> objects to placeholder objects.</p>
  47621. <li>
  47622. <p>If the method was invoked with a second argument <var>transfer</var>, run these
  47623. substeps:</p>
  47624. <ol><li>
  47625. <p>If any object is listed in <var>transfer</var> more than once, or any of the
  47626. <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
  47627. <code id=message-ports:datacloneerror-2><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
  47628. <li>
  47629. <p>If any of the objects in <var>transfer</var> are the <var>source
  47630. port</var>, then throw a <code id=message-ports:datacloneerror-3><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
  47631. <li>
  47632. <p>If any of the objects in <var>transfer</var> are the <var>target
  47633. port</var>, if any, then let <var>doomed</var> be true, and optionally report to a
  47634. developer console that the target port was posted to itself, causing the communication channel
  47635. to be lost.</p>
  47636. <li>
  47637. <p>For each object <var>x</var> in <var>transfer</var> in turn, add a
  47638. 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
  47639. <code id=message-ports:messageport-12><a href=#messageport>MessagePort</a></code> object, also append the placeholder object to the <var>new
  47640. ports</var> array.</p>
  47641. </ol>
  47642. <li>
  47643. <p>Let <var>message clone</var> be the result of obtaining a <a href=#structured-clone id=message-ports:structured-clone>structured
  47644. clone</a> of the <var>message</var> argument, with <var>transfer map</var>
  47645. as the <i>transfer map</i>. If this throws an exception, then throw that exception and abort
  47646. these steps.</p>
  47647. <li>
  47648. <p>If the method was invoked with a second argument <var>transfer</var>, run these
  47649. substeps:</p>
  47650. <ol><li>
  47651. <p>Let <var>new owner</var> be the <a href=#concept-port-owner id=message-ports:concept-port-owner-9>owner</a> of
  47652. <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
  47653. owner</var> is used when transferring objects below. If there is no <var>target
  47654. 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>
  47655. 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
  47656. are transferred to.)</p>
  47657. <li>
  47658. <p>For each object <var>x</var> in <var>transfer</var> in turn, obtain a
  47659. 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
  47660. 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
  47661. (i.e. in <var>message clone</var> and in <var>new ports</var>).</p>
  47662. </ol>
  47663. <li>
  47664. <p>Make <var>new ports</var> into a <a href=#dfn-read-only-array id=message-ports:dfn-read-only-array>read only</a>
  47665. array.</p>
  47666. <li><p>If there is no <var>target port</var> (i.e. if <var>source port</var>
  47667. 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
  47668. 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
  47669. 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
  47670. 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
  47671. port</var>.</ol>
  47672. <hr>
  47673. <p>The <dfn id=dom-messageport-start><code>start()</code></dfn> method must enable its port's
  47674. <a href=#port-message-queue id=message-ports:port-message-queue-13>port message queue</a>, if it is not already enabled.</p>
  47675. <hr>
  47676. <p>The <dfn id=dom-messageport-close><code>close()</code></dfn> method, when called on a port
  47677. <var>local port</var> that is entangled with another port, must cause the user agent to
  47678. disentangle the two ports. If the method is called on a port that is not entangled, then the
  47679. method must do nothing.</p>
  47680. <hr>
  47681. <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
  47682. handler IDL attributes</a>, by all objects implementing the <code id=message-ports:messageport-13><a href=#messageport>MessagePort</a></code>
  47683. interface:</p>
  47684. <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>
  47685. <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>
  47686. </table>
  47687. <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
  47688. 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>
  47689. method had been called.</p>
  47690. <h4 id=broadcasting-to-many-ports>9.5.4 Broadcasting to many ports</h4>
  47691. <p class=critical>The API described in this section is controversial, as, in an attempt to solve
  47692. an architectural memory leak, it instead exposes the details of Garbage Collection. This is a
  47693. lose-lose scenario. A better solution is really needed here.</p>
  47694. <p>Broadcasting to many ports is in principle relatively simple: keep an array of
  47695. <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
  47696. message. However, this has one rather unfortunate effect: it prevents the ports from being garbage
  47697. collected, even if the other side has gone away.</p>
  47698. <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
  47699. 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
  47700. they stop being relevant, while still allowing scripts to iterate over the
  47701. <code id=broadcasting-to-many-ports:messageport-3><a href=#messageport>MessagePort</a></code> objects.</p>
  47702. <pre class=idl>[<a href=#dom-portcollection id=broadcasting-to-many-ports:dom-portcollection>Constructor</a>, Exposed=(Window,Worker)]
  47703. interface <dfn id=portcollection>PortCollection</dfn> {
  47704. 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);
  47705. 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);
  47706. void <a href=#dom-portcollection-clear id=broadcasting-to-many-ports:dom-portcollection-clear>clear</a>();
  47707. 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);
  47708. };
  47709. callback <dfn id=portcollectioncallback>PortCollectionCallback</dfn> = void (<a href=#messageport id=broadcasting-to-many-ports:messageport-6>MessagePort</a> port);</pre>
  47710. <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>
  47711. <p>Returns a new empty <code id=broadcasting-to-many-ports:portcollection-2><a href=#portcollection>PortCollection</a></code> object.</p>
  47712. <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>
  47713. <p>Adds <var>port</var> to the collection, if it isn't already present.</p>
  47714. <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>
  47715. <p>Removes <var>port</var> from the collection, if it is present.</p>
  47716. <dt><var>portCollection</var> . <code id=broadcasting-to-many-ports:dom-portcollection-clear-2><a href=#dom-portcollection-clear>clear</a></code>()<dd>
  47717. <p>Removes all ports from the collection.</p>
  47718. <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>
  47719. <p>Calls <var>callback</var> for each port in the collection.</p>
  47720. </dl>
  47721. <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
  47722. a <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list>list of ports</a> is garbage collected, it must be
  47723. silently removed from that <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-2>list of ports</a>. Objects
  47724. in a <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-3>list of ports</a> are ordered chronologically by
  47725. 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>
  47726. 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
  47727. in the list.</p>
  47728. <p>The <dfn id=dom-portcollection><code>PortCollection()</code></dfn> constructor must return
  47729. 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>
  47730. <p>The <dfn id=dom-portcollection-add><code>add()</code></dfn> method must add the
  47731. <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
  47732. 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
  47733. method does nothing. (Calling this method with a port already in the list does not move the port
  47734. to the end of the list.)</p>
  47735. <p>The <dfn id=dom-portcollection-remove><code>remove()</code></dfn> method must remove the
  47736. <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
  47737. 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
  47738. method does nothing.</p>
  47739. <p>The <dfn id=dom-portcollection-clear><code>clear()</code></dfn> method must remove all
  47740. <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.
  47741. 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
  47742. does nothing.</p>
  47743. <p>The <dfn id=dom-portcollection-iterate><code>iterate()</code></dfn> method must invoke its
  47744. <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
  47745. object's <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-11>list of ports</a>, in the order defined
  47746. 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
  47747. callback's sole argument.</p>
  47748. <h4 id=ports-and-garbage-collection>9.5.5 Ports and garbage collection</h4>
  47749. <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
  47750. 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
  47751. 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>
  47752. <div class=note>
  47753. <p>Thus, a message port can be received, given an event listener, and then forgotten, and so long
  47754. as that event listener could receive a message, the channel will be maintained.</p>
  47755. <p>Of course, if this was to occur on both sides of the channel, then both ports could be garbage
  47756. collected, since they would not be reachable from live code, despite having a strong reference to
  47757. each other.</p>
  47758. </div>
  47759. <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
  47760. 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>
  47761. 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
  47762. and there exists a <code id=ports-and-garbage-collection:event-message><a href=#event-message>message</a></code> event in that queue.</p>
  47763. <p>There are no strong references from a <code id=ports-and-garbage-collection:portcollection><a href=#portcollection>PortCollection</a></code> object to its
  47764. <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>
  47765. 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
  47766. from being garbage collected.)</p>
  47767. <p class=note>Authors are strongly encouraged to explicitly close <code id=ports-and-garbage-collection:messageport-8><a href=#messageport>MessagePort</a></code>
  47768. objects to disentangle them, so that their resources can be recollected. Creating many
  47769. <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
  47770. transient memory usage since garbage collection is not necessarily performed promptly, especially
  47771. 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>
  47772. <h3 id=broadcasting-to-other-browsing-contexts>9.6 <dfn>Broadcasting to other browsing contexts</dfn></h3>
  47773. <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
  47774. different unrelated <a href=#browsing-context id=broadcasting-to-other-browsing-contexts:browsing-context>browsing contexts</a> sometimes need to
  47775. send notifications to each other, for example "hey, the user logged in over here, check your
  47776. credentials again".</p>
  47777. <p>For elaborate cases, e.g. to manage locking of shared state, to manage synchronisation of
  47778. 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>
  47779. connection with a remote host, and so forth, <a href=#sharedworker id=broadcasting-to-other-browsing-contexts:sharedworker>shared workers</a> are
  47780. the most appropriate solution.</p>
  47781. <p>For simple cases, though, where a shared worker would be an unreasonable overhead, authors can
  47782. use the simple channel-based broadcast mechanism described in this section.</p>
  47783. <pre class=idl>[<a href=#dom-broadcastchannel id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel>Constructor</a>(DOMString channel), Exposed=(Window,Worker)]
  47784. interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget id=broadcasting-to-other-browsing-contexts:eventtarget>EventTarget</a> {
  47785. readonly attribute DOMString <a href=#dom-broadcastchannel-name id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-name>name</a>;
  47786. void <a href=#dom-broadcastchannel-postmessage id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-postmessage>postMessage</a>(any message);
  47787. void <a href=#dom-broadcastchannel-close id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-close>close</a>();
  47788. 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>;
  47789. };</pre>
  47790. <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>
  47791. <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>
  47792. <dt><var>broadcastChannel</var> . <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-name-2><a href=#dom-broadcastchannel-name>name</a></code><dd>
  47793. <p>Returns the channel ID (as passed to the constructor).</p>
  47794. <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>
  47795. <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>
  47796. <dt><var>broadcastChannel</var> . <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-close-2><a href=#dom-broadcastchannel-close>close</a></code>()<dd>
  47797. <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>
  47798. </dl>
  47799. <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
  47800. <dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed>closed flag</dfn>.</p>
  47801. <p>The <dfn id=dom-broadcastchannel><code>BroadcastChannel()</code></dfn> constructor, when
  47802. 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
  47803. 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>
  47804. 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>
  47805. <p>The <dfn id=dom-broadcastchannel-name><code>name</code></dfn> attribute must return the
  47806. <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name-2>channel name</a>.</p>
  47807. <p>The <dfn id=dom-broadcastchannel-postmessage><code>postMessage()</code></dfn> method,
  47808. 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
  47809. argument <var>message</var>, must run the following steps:</p>
  47810. <ol><li><p>Let <var>source settings</var> be <var>source</var>'s
  47811. <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-2><code>BroadcastChannel</code> settings object</a>.</p>
  47812. <li><p>Let <var>source channel</var> be <var>source</var>'s
  47813. <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name-3>channel name</a>.</p>
  47814. <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
  47815. abort these steps.<li>
  47816. <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
  47817. match the following criteria:</p>
  47818. <ul><li>
  47819. <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>
  47820. <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
  47821. <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
  47822. <code id=broadcasting-to-other-browsing-contexts:dom-workerglobalscope-closing><a href=#dom-workerglobalscope-closing>closing</a></code> flag is false and whose
  47823. <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>
  47824. <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
  47825. <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
  47826. 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
  47827. false.</ul>
  47828. <li><p>Remove <var>source</var> from <var>destinations</var>.<li>
  47829. <p>Sort <var>destinations</var> such that all <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-8><a href=#broadcastchannel>BroadcastChannel</a></code> objects
  47830. whose <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-5><code>BroadcastChannel</code> settings
  47831. 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
  47832. order, oldest first. (This does not define a complete ordering. Within this constraint, user
  47833. agents may sort the list in any user-agent defined manner.)</p>
  47834. <li>
  47835. <p>For each <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-9><a href=#broadcastchannel>BroadcastChannel</a></code> object in <var>destinations</var>,
  47836. <a href=#queue-a-task id=broadcasting-to-other-browsing-contexts:queue-a-task>queue a task</a> that runs the following steps:</p>
  47837. <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
  47838. <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
  47839. 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
  47840. 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
  47841. 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
  47842. <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
  47843. <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-10><a href=#broadcastchannel>BroadcastChannel</a></code> object.</ol>
  47844. <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
  47845. document</a> specified by the target <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-11><a href=#broadcastchannel>BroadcastChannel</a></code> object's
  47846. <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
  47847. manipulation task source</a>.</p>
  47848. </ol>
  47849. <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
  47850. 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
  47851. 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
  47852. <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>
  47853. object itself.</p>
  47854. <p>The <dfn id=dom-broadcastchannel-close><code>close()</code></dfn> method must set the
  47855. <a href=#concept-broadcastchannel-closed id=broadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-4>closed flag</a> of the
  47856. <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-15><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>
  47857. <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>
  47858. objects when they are no longer needed, so that they can be garbage collected. Creating many
  47859. <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
  47860. listener and without closing them can lead to an apparent memory leak, since the objects will
  47861. continue to live for as long as they have an event listener (or until their page or worker is
  47862. closed).</p>
  47863. <hr>
  47864. <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
  47865. handler IDL attributes</a>, by all objects implementing the <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-18><a href=#broadcastchannel>BroadcastChannel</a></code>
  47866. interface:</p>
  47867. <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>
  47868. <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>
  47869. </table>
  47870. <div class=example>
  47871. <p>Suppose a page wants to know when the user logs out, even when the user does so from another
  47872. tab at the same site:</p>
  47873. <pre>var authChannel = new BroadcastChannel('auth');
  47874. authChannel.onmessage = function (event) {
  47875. if (event.data == 'logout')
  47876. showLogout();
  47877. }
  47878. function logoutRequested() {
  47879. // called when the user asks us to log them out
  47880. doLogout();
  47881. showLogout();
  47882. authChannel.postMessage('logout');
  47883. }
  47884. function doLogout() {
  47885. // actually log the user out (e.g. clearing cookies)
  47886. // ...
  47887. }
  47888. function showLogout() {
  47889. // update the UI to indicate we're logged out
  47890. // ...
  47891. }</pre>
  47892. </div>
  47893. <h2 id=workers>10 Web workers</h2>
  47894. <h3 id=introduction-15>10.1 Introduction</h3>
  47895. <h4 id=scope-2>10.1.1 Scope</h4>
  47896. <p><i>This section is non-normative.</i></p>
  47897. <p>This specification defines an API for running scripts in the background independently of any
  47898. user interface scripts.</p>
  47899. <p>This allows for long-running scripts that are not interrupted by scripts that respond to clicks
  47900. or other user interactions, and allows long tasks to be executed without yielding to keep the page
  47901. responsive.</p>
  47902. <p>Workers (as these background scripts are called herein) are relatively heavy-weight, and are
  47903. not intended to be used in large numbers. For example, it would be inappropriate to launch one
  47904. worker for each pixel of a four megapixel image. The examples below show some appropriate uses of
  47905. workers.</p>
  47906. <p>Generally, workers are expected to be long-lived, have a high start-up performance cost, and a
  47907. high per-instance memory cost.</p>
  47908. <h4 id=examples-6>10.1.2 Examples</h4>
  47909. <p><i>This section is non-normative.</i></p>
  47910. <p>There are a variety of uses that workers can be put to. The following subsections show various
  47911. examples of this use.</p>
  47912. <h5 id=a-background-number-crunching-worker>10.1.2.1 A background number-crunching worker</h5>
  47913. <p><i>This section is non-normative.</i></p>
  47914. <p>The simplest use of workers is for performing a computationally
  47915. expensive task without interrupting the user interface.</p>
  47916. <p>In this example, the main document spawns a worker to (naïvely) compute prime numbers, and
  47917. progressively displays the most recently found prime number.</p>
  47918. <p>The main page is as follows:</p>
  47919. <pre>&lt;!DOCTYPE HTML>
  47920. &lt;html>
  47921. &lt;head>
  47922. &lt;title>Worker example: One-core computation&lt;/title>
  47923. &lt;/head>
  47924. &lt;body>
  47925. &lt;p>The highest prime number discovered so far is: &lt;output id="result">&lt;/output>&lt;/p>
  47926. &lt;script>
  47927. var worker = new Worker('worker.js');
  47928. worker.onmessage = function (event) {
  47929. document.getElementById('result').textContent = event.data;
  47930. };
  47931. &lt;/script>
  47932. &lt;/body>
  47933. &lt;/html></pre>
  47934. <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
  47935. <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.
  47936. 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
  47937. code to receive messages from the worker.</p>
  47938. <p>The worker itself is as follows:</p>
  47939. <pre>var n = 1;
  47940. search: while (true) {
  47941. n += 1;
  47942. for (var i = 2; i &lt;= Math.sqrt(n); i += 1)
  47943. if (n % i == 0)
  47944. continue search;
  47945. // found a prime!
  47946. postMessage(n);
  47947. }</pre>
  47948. <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
  47949. message back to the page when a prime is found.</p>
  47950. <p><a href=//www.whatwg.org/demos/workers/primes/page.html>View this example online</a>.</p>
  47951. <h5 id=worker-used-for-background-i/o>10.1.2.2 Worker used for background I/O</h5>
  47952. <p><i>This section is non-normative.</i></p>
  47953. <p>In this example, the main document uses two workers, one for fetching stock updates at regular
  47954. intervals, and one for performing search queries that the user requests.</p>
  47955. <p>The main page is as follows:</p>
  47956. <pre>&lt;!DOCTYPE HTML>
  47957. &lt;html>
  47958. &lt;head>
  47959. &lt;title>Worker example: Stock ticker&lt;/title>
  47960. &lt;script>
  47961. // TICKER
  47962. var symbol = 'GOOG'; // default symbol to watch
  47963. var ticker = new Worker('ticker.js');
  47964. // SEARCHER
  47965. var searcher = new Worker('searcher.js');
  47966. function search(query) {
  47967. searcher.postMessage(query);
  47968. }
  47969. // SYMBOL SELECTION UI
  47970. function select(newSymbol) {
  47971. symbol = newSymbol;
  47972. ticker.postMessage(symbol);
  47973. }
  47974. &lt;/script>
  47975. &lt;meta http-equiv="Refresh" content="120; URL=../">
  47976. &lt;/head>
  47977. &lt;body onload="search('')">
  47978. &lt;p>&lt;output id="symbol">&lt;/output> &lt;output id="value">&lt;/output>&lt;/p>
  47979. &lt;script>
  47980. ticker.onmessage = function (event) {
  47981. var data = event.data.split(' ');
  47982. document.getElementById('symbol').textContent = data[0];
  47983. document.getElementById('value').textContent = data[1];
  47984. };
  47985. ticker.postMessage(symbol);
  47986. &lt;/script>
  47987. &lt;p>&lt;label>Search: &lt;input type="text" autofocus oninput="search(this.value)">&lt;/label>&lt;/p>
  47988. &lt;ul id="results">&lt;/ul>
  47989. &lt;script>
  47990. searcher.onmessage = function (event) {
  47991. var data = event.data.split(' ');
  47992. var results = document.getElementById('results');
  47993. while (results.hasChildNodes()) // clear previous results
  47994. results.removeChild(results.firstChild);
  47995. for (var i = 0; i &lt; data.length; i += 1) {
  47996. // add a list item with a button for each result
  47997. var li = document.createElement('li');
  47998. var button = document.createElement('button');
  47999. button.value = data[i];
  48000. button.type = 'button';
  48001. button.onclick = function () { select(this.value); };
  48002. button.textContent = data[i];
  48003. li.appendChild(button);
  48004. results.appendChild(li);
  48005. }
  48006. };
  48007. &lt;/script>
  48008. &lt;p>(The data in this example is not real. Try searching for "Google" or "Apple".)&lt;/p>
  48009. &lt;/body>
  48010. &lt;/html>
  48011. </pre>
  48012. <p>The two workers use a common library for performing the actual network calls. This library is
  48013. as follows:</p>
  48014. <pre>function get(url) {
  48015. try {
  48016. var xhr = new XMLHttpRequest();
  48017. xhr.open('GET', url, false);
  48018. xhr.send();
  48019. return xhr.responseText;
  48020. } catch (e) {
  48021. return ''; // turn all errors into empty results
  48022. }
  48023. }</pre>
  48024. <p>The stock updater worker is as follows:</p>
  48025. <pre>importScripts('io.js');
  48026. var timer;
  48027. var symbol;
  48028. function update() {
  48029. postMessage(symbol + ' ' + get('stock.cgi?' + symbol));
  48030. timer = setTimeout(update, 10000);
  48031. }
  48032. onmessage = function (event) {
  48033. if (timer)
  48034. clearTimeout(timer);
  48035. symbol = event.data;
  48036. update();
  48037. };</pre>
  48038. <p>The search query worker is as follows:</p>
  48039. <pre>importScripts('io.js');
  48040. onmessage = function (event) {
  48041. postMessage(get('search.cgi?' + event.data));
  48042. };</pre>
  48043. <p><a href=//www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</p>
  48044. <h5 id=shared-workers-introduction>10.1.2.3 Shared workers introduction</h5>
  48045. <p><i>This section is non-normative.</i></p>
  48046. <p>This section introduces shared workers using a Hello World example. Shared workers use slightly
  48047. different APIs, since each worker can have multiple connections.</p>
  48048. <p>This first example shows how you connect to a worker and how a worker can send a message back
  48049. to the page when it connects to it. Received messages are displayed in a log.</p>
  48050. <p>Here is the HTML page:</p>
  48051. <pre>&lt;!DOCTYPE HTML>
  48052. &lt;title>Shared workers: demo 1&lt;/title>
  48053. &lt;pre id="log">Log:&lt;/pre>
  48054. &lt;script>
  48055. var worker = new SharedWorker('test.js');
  48056. var log = document.getElementById('log');
  48057. worker.port.onmessage = function(e) { // note: not worker.onmessage!
  48058. log.textContent += '\n' + e.data;
  48059. }
  48060. &lt;/script>
  48061. </pre>
  48062. <p>Here is the JavaScript worker:</p>
  48063. <pre>onconnect = function(e) {
  48064. var port = e.ports[0];
  48065. port.postMessage('Hello World!');
  48066. }
  48067. </pre>
  48068. <p><a href=//www.whatwg.org/demos/workers/shared/001/test.html>View this example online</a>.</p>
  48069. <hr>
  48070. <p>This second example extends the first one by changing two things: first, messages are received
  48071. 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
  48072. worker, causing the worker to send another message in return. Received messages are again
  48073. displayed in a log.</p>
  48074. <p>Here is the HTML page:</p>
  48075. <pre>&lt;!DOCTYPE HTML>
  48076. &lt;title>Shared workers: demo 2&lt;/title>
  48077. &lt;pre id="log">Log:&lt;/pre>
  48078. &lt;script>
  48079. var worker = new SharedWorker('test.js');
  48080. var log = document.getElementById('log');
  48081. worker.port.addEventListener('message', function(e) {
  48082. log.textContent += '\n' + e.data;
  48083. }, false);
  48084. worker.port.start(); // note: need this when using addEventListener
  48085. worker.port.postMessage('ping');
  48086. &lt;/script>
  48087. </pre>
  48088. <p>Here is the JavaScript worker:</p>
  48089. <pre>onconnect = function(e) {
  48090. var port = e.ports[0];
  48091. port.postMessage('Hello World!');
  48092. port.onmessage = function(e) {
  48093. port.postMessage('pong'); // not e.ports[0].postMessage!
  48094. // e.target.postMessage('pong'); would work also
  48095. }
  48096. }
  48097. </pre>
  48098. <p><a href=//www.whatwg.org/demos/workers/shared/002/test.html>View this example online</a>.</p>
  48099. <hr>
  48100. <p>Finally, the example is extended to show how two pages can connect to the same worker; in this
  48101. 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
  48102. 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
  48103. context</a>.</p>
  48104. <p>Here is the outer HTML page:</p>
  48105. <pre>&lt;!DOCTYPE HTML>
  48106. &lt;title>Shared workers: demo 3&lt;/title>
  48107. &lt;pre id="log">Log:&lt;/pre>
  48108. &lt;script>
  48109. var worker = new SharedWorker('test.js');
  48110. var log = document.getElementById('log');
  48111. worker.port.addEventListener('message', function(e) {
  48112. log.textContent += '\n' + e.data;
  48113. }, false);
  48114. worker.port.start();
  48115. worker.port.postMessage('ping');
  48116. &lt;/script>
  48117. &lt;iframe src="inner.html">&lt;/iframe>
  48118. </pre>
  48119. <p>Here is the inner HTML page:</p>
  48120. <pre>&lt;!DOCTYPE HTML>
  48121. &lt;title>Shared workers: demo 3 inner frame&lt;/title>
  48122. &lt;pre id=log>Inner log:&lt;/pre>
  48123. &lt;script>
  48124. var worker = new SharedWorker('test.js');
  48125. var log = document.getElementById('log');
  48126. worker.port.onmessage = function(e) {
  48127. log.textContent += '\n' + e.data;
  48128. }
  48129. &lt;/script>
  48130. </pre>
  48131. <p>Here is the JavaScript worker:</p>
  48132. <pre>var count = 0;
  48133. onconnect = function(e) {
  48134. count += 1;
  48135. var port = e.ports[0];
  48136. port.postMessage('Hello World! You are connection #' + count);
  48137. port.onmessage = function(e) {
  48138. port.postMessage('pong');
  48139. }
  48140. }
  48141. </pre>
  48142. <p><a href=//www.whatwg.org/demos/workers/shared/003/test.html>View this example online</a>.</p>
  48143. <h5 id=shared-state-using-a-shared-worker>10.1.2.4 Shared state using a shared worker</h5>
  48144. <p><i>This section is non-normative.</i></p>
  48145. <p>In this example, multiple windows (viewers) can be opened that are all viewing the same map.
  48146. All the windows share the same map information, with a single worker coordinating all the viewers.
  48147. Each viewer can move around independently, but if they set any data on the map, all the viewers
  48148. are updated.</p>
  48149. <p>The main page isn't interesting, it merely provides a way to open the viewers:</p>
  48150. <pre>&lt;!DOCTYPE HTML>
  48151. &lt;html>
  48152. &lt;head>
  48153. &lt;title>Workers example: Multiviewer&lt;/title>
  48154. &lt;script>
  48155. function openViewer() {
  48156. window.open('viewer.html');
  48157. }
  48158. &lt;/script>
  48159. &lt;/head>
  48160. &lt;body>
  48161. &lt;p>&lt;button type=button onclick="openViewer()">Open a new
  48162. viewer&lt;/button>&lt;/p>
  48163. &lt;p>Each viewer opens in a new window. You can have as many viewers
  48164. as you like, they all view the same data.&lt;/p>
  48165. &lt;/body>
  48166. &lt;/html></pre>
  48167. <p>The viewer is more involved:</p>
  48168. <pre>&lt;!DOCTYPE HTML>
  48169. &lt;html>
  48170. &lt;head>
  48171. &lt;title>Workers example: Multiviewer viewer&lt;/title>
  48172. &lt;script>
  48173. var worker = new SharedWorker('worker.js', 'core');
  48174. // CONFIGURATION
  48175. function configure(event) {
  48176. if (event.data.substr(0, 4) != 'cfg ') return;
  48177. var name = event.data.substr(4).split(' ', 1)[0];
  48178. // update display to mention our name is name
  48179. document.getElementsByTagName('h1')[0].textContent += ' ' + name;
  48180. // no longer need this listener
  48181. worker.port.removeEventListener('message', configure, false);
  48182. }
  48183. worker.port.addEventListener('message', configure, false);
  48184. // MAP
  48185. function paintMap(event) {
  48186. if (event.data.substr(0, 4) != 'map ') return;
  48187. var data = event.data.substr(4).split(',');
  48188. // display tiles data[0] .. data[8]
  48189. var canvas = document.getElementById('map');
  48190. var context = canvas.getContext('2d');
  48191. for (var y = 0; y &lt; 3; y += 1) {
  48192. for (var x = 0; x &lt; 3; x += 1) {
  48193. var tile = data[y * 3 + x];
  48194. if (tile == '0')
  48195. context.fillStyle = 'green';
  48196. else
  48197. context.fillStyle = 'maroon';
  48198. context.fillRect(x * 50, y * 50, 50, 50);
  48199. }
  48200. }
  48201. }
  48202. worker.port.addEventListener('message', paintMap, false);
  48203. // PUBLIC CHAT
  48204. function updatePublicChat(event) {
  48205. if (event.data.substr(0, 4) != 'txt ') return;
  48206. var name = event.data.substr(4).split(' ', 1)[0];
  48207. var message = event.data.substr(4 + name.length + 1);
  48208. // display "&lt;name> message" in public chat
  48209. var public = document.getElementById('public');
  48210. var p = document.createElement('p');
  48211. var n = document.createElement('button');
  48212. n.textContent = '&lt;' + name + '> ';
  48213. n.onclick = function () { worker.port.postMessage('msg ' + name); };
  48214. p.appendChild(n);
  48215. var m = document.createElement('span');
  48216. m.textContent = message;
  48217. p.appendChild(m);
  48218. public.appendChild(p);
  48219. }
  48220. worker.port.addEventListener('message', updatePublicChat, false);
  48221. // PRIVATE CHAT
  48222. function startPrivateChat(event) {
  48223. if (event.data.substr(0, 4) != 'msg ') return;
  48224. var name = event.data.substr(4).split(' ', 1)[0];
  48225. var port = event.ports[0];
  48226. // display a private chat UI
  48227. var ul = document.getElementById('private');
  48228. var li = document.createElement('li');
  48229. var h3 = document.createElement('h3');
  48230. h3.textContent = 'Private chat with ' + name;
  48231. li.appendChild(h3);
  48232. var div = document.createElement('div');
  48233. var addMessage = function(name, message) {
  48234. var p = document.createElement('p');
  48235. var n = document.createElement('strong');
  48236. n.textContent = '&lt;' + name + '> ';
  48237. p.appendChild(n);
  48238. var t = document.createElement('span');
  48239. t.textContent = message;
  48240. p.appendChild(t);
  48241. div.appendChild(p);
  48242. };
  48243. port.onmessage = function (event) {
  48244. addMessage(name, event.data);
  48245. };
  48246. li.appendChild(div);
  48247. var form = document.createElement('form');
  48248. var p = document.createElement('p');
  48249. var input = document.createElement('input');
  48250. input.size = 50;
  48251. p.appendChild(input);
  48252. p.appendChild(document.createTextNode(' '));
  48253. var button = document.createElement('button');
  48254. button.textContent = 'Post';
  48255. p.appendChild(button);
  48256. form.onsubmit = function () {
  48257. port.postMessage(input.value);
  48258. addMessage('me', input.value);
  48259. input.value = '';
  48260. return false;
  48261. };
  48262. form.appendChild(p);
  48263. li.appendChild(form);
  48264. ul.appendChild(li);
  48265. }
  48266. worker.port.addEventListener('message', startPrivateChat, false);
  48267. worker.port.start();
  48268. &lt;/script>
  48269. &lt;/head>
  48270. &lt;body>
  48271. &lt;h1>Viewer&lt;/h1>
  48272. &lt;h2>Map&lt;/h2>
  48273. &lt;p>&lt;canvas id="map" height=150 width=150>&lt;/canvas>&lt;/p>
  48274. &lt;p>
  48275. &lt;button type=button onclick="worker.port.postMessage('mov left')">Left&lt;/button>
  48276. &lt;button type=button onclick="worker.port.postMessage('mov up')">Up&lt;/button>
  48277. &lt;button type=button onclick="worker.port.postMessage('mov down')">Down&lt;/button>
  48278. &lt;button type=button onclick="worker.port.postMessage('mov right')">Right&lt;/button>
  48279. &lt;button type=button onclick="worker.port.postMessage('set 0')">Set 0&lt;/button>
  48280. &lt;button type=button onclick="worker.port.postMessage('set 1')">Set 1&lt;/button>
  48281. &lt;/p>
  48282. &lt;h2>Public Chat&lt;/h2>
  48283. &lt;div id="public">&lt;/div>
  48284. &lt;form onsubmit="worker.port.postMessage('txt ' + message.value); message.value = ''; return false;">
  48285. &lt;p>
  48286. &lt;input type="text" name="message" size="50">
  48287. &lt;button>Post&lt;/button>
  48288. &lt;/p>
  48289. &lt;/form>
  48290. &lt;h2>Private Chat&lt;/h2>
  48291. &lt;ul id="private">&lt;/ul>
  48292. &lt;/body>
  48293. &lt;/html>
  48294. </pre>
  48295. <p>There are several key things worth noting about the way the viewer is written.</p>
  48296. <p><strong>Multiple listeners</strong>. Instead of a single message processing function, the code
  48297. here attaches multiple event listeners, each one performing a quick check to see if it is relevant
  48298. for the message. In this example it doesn't make much difference, but if multiple authors wanted
  48299. to collaborate using a single port to communicate with a worker, it would allow for independent
  48300. code instead of changes having to all be made to a single event handling function.</p>
  48301. <p>Registering event listeners in this way also allows you to unregister specific listeners when
  48302. you are done with them, as is done with the <code>configure()</code> method in this
  48303. example.</p>
  48304. <p>Finally, the worker:</p>
  48305. <pre>var nextName = 0;
  48306. function getNextName() {
  48307. // this could use more friendly names
  48308. // but for now just return a number
  48309. return nextName++;
  48310. }
  48311. var map = [
  48312. [0, 0, 0, 0, 0, 0, 0],
  48313. [1, 1, 0, 1, 0, 1, 1],
  48314. [0, 1, 0, 1, 0, 0, 0],
  48315. [0, 1, 0, 1, 0, 1, 1],
  48316. [0, 0, 0, 1, 0, 0, 0],
  48317. [1, 0, 0, 1, 1, 1, 1],
  48318. [1, 1, 0, 1, 1, 0, 1],
  48319. ];
  48320. function wrapX(x) {
  48321. if (x &lt; 0) return wrapX(x + map[0].length);
  48322. if (x >= map[0].length) return wrapX(x - map[0].length);
  48323. return x;
  48324. }
  48325. function wrapY(y) {
  48326. if (y &lt; 0) return wrapY(y + map.length);
  48327. if (y >= map[0].length) return wrapY(y - map.length);
  48328. return y;
  48329. }
  48330. function wrap(val, min, max) {
  48331. if (val &lt; min)
  48332. return val + (max-min)+1;
  48333. if (val > max)
  48334. return val - (max-min)-1;
  48335. return val;
  48336. }
  48337. function sendMapData(viewer) {
  48338. var data = '';
  48339. for (var y = viewer.y-1; y &lt;= viewer.y+1; y += 1) {
  48340. for (var x = viewer.x-1; x &lt;= viewer.x+1; x += 1) {
  48341. if (data != '')
  48342. data += ',';
  48343. data += map[wrap(y, 0, map[0].length-1)][wrap(x, 0, map.length-1)];
  48344. }
  48345. }
  48346. viewer.port.postMessage('map ' + data);
  48347. }
  48348. var viewers = {};
  48349. onconnect = function (event) {
  48350. var name = getNextName();
  48351. event.ports[0]._data = { port: event.ports[0], name: name, x: 0, y: 0, };
  48352. viewers[name] = event.ports[0]._data;
  48353. event.ports[0].postMessage('cfg ' + name);
  48354. event.ports[0].onmessage = getMessage;
  48355. sendMapData(event.ports[0]._data);
  48356. };
  48357. function getMessage(event) {
  48358. switch (event.data.substr(0, 4)) {
  48359. case 'mov ':
  48360. var direction = event.data.substr(4);
  48361. var dx = 0;
  48362. var dy = 0;
  48363. switch (direction) {
  48364. case 'up': dy = -1; break;
  48365. case 'down': dy = 1; break;
  48366. case 'left': dx = -1; break;
  48367. case 'right': dx = 1; break;
  48368. }
  48369. event.target._data.x = wrapX(event.target._data.x + dx);
  48370. event.target._data.y = wrapY(event.target._data.y + dy);
  48371. sendMapData(event.target._data);
  48372. break;
  48373. case 'set ':
  48374. var value = event.data.substr(4);
  48375. map[event.target._data.y][event.target._data.x] = value;
  48376. for (var viewer in viewers)
  48377. sendMapData(viewers[viewer]);
  48378. break;
  48379. case 'txt ':
  48380. var name = event.target._data.name;
  48381. var message = event.data.substr(4);
  48382. for (var viewer in viewers)
  48383. viewers[viewer].port.postMessage('txt ' + name + ' ' + message);
  48384. break;
  48385. case 'msg ':
  48386. var party1 = event.target._data;
  48387. var party2 = viewers[event.data.substr(4).split(' ', 1)[0]];
  48388. if (party2) {
  48389. var channel = new MessageChannel();
  48390. party1.port.postMessage('msg ' + party2.name, [channel.port1]);
  48391. party2.port.postMessage('msg ' + party1.name, [channel.port2]);
  48392. }
  48393. break;
  48394. }
  48395. }</pre>
  48396. <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
  48397. multiple connections.</p>
  48398. <p><strong>Direct channels</strong>. When the worker receives a "msg" message from one viewer
  48399. naming another viewer, it sets up a direct connection between the two, so that the two viewers can
  48400. communicate directly without the worker having to proxy all the messages.</p>
  48401. <p><a href=//www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</p>
  48402. <h5 id=delegation>10.1.2.5 Delegation</h5>
  48403. <p><i>This section is non-normative.</i></p>
  48404. <p>With multicore CPUs becoming prevalent, one way to obtain better performance is to split
  48405. computationally expensive tasks amongst multiple workers. In this example, a computationally
  48406. expensive task that is to be performed for every number from 1 to 10,000,000 is farmed out to ten
  48407. subworkers.</p>
  48408. <p>The main page is as follows, it just reports the result:</p>
  48409. <pre>&lt;!DOCTYPE HTML>
  48410. &lt;html>
  48411. &lt;head>
  48412. &lt;title>Worker example: Multicore computation&lt;/title>
  48413. &lt;/head>
  48414. &lt;body>
  48415. &lt;p>Result: &lt;output id="result">&lt;/output>&lt;/p>
  48416. &lt;script>
  48417. var worker = new Worker('worker.js');
  48418. worker.onmessage = function (event) {
  48419. document.getElementById('result').textContent = event.data;
  48420. };
  48421. &lt;/script>
  48422. &lt;/body>
  48423. &lt;/html></pre>
  48424. <p>The worker itself is as follows:</p>
  48425. <pre>// settings
  48426. var num_workers = 10;
  48427. var items_per_worker = 1000000;
  48428. // start the workers
  48429. var result = 0;
  48430. var pending_workers = num_workers;
  48431. for (var i = 0; i &lt; num_workers; i += 1) {
  48432. var worker = new Worker('core.js');
  48433. worker.postMessage(i * items_per_worker);
  48434. worker.postMessage((i+1) * items_per_worker);
  48435. worker.onmessage = storeResult;
  48436. }
  48437. // handle the results
  48438. function storeResult(event) {
  48439. result += 1*event.data;
  48440. pending_workers -= 1;
  48441. if (pending_workers &lt;= 0)
  48442. postMessage(result); // finished!
  48443. }</pre>
  48444. <p>It consists of a loop to start the subworkers, and then a handler
  48445. that waits for all the subworkers to respond.</p>
  48446. <p>The subworkers are implemented as follows:</p>
  48447. <pre>var start;
  48448. onmessage = getStart;
  48449. function getStart(event) {
  48450. start = 1*event.data;
  48451. onmessage = getEnd;
  48452. }
  48453. var end;
  48454. function getEnd(event) {
  48455. end = 1*event.data;
  48456. onmessage = null;
  48457. work();
  48458. }
  48459. function work() {
  48460. var result = 0;
  48461. for (var i = start; i &lt; end; i += 1) {
  48462. // perform some complex calculation here
  48463. result += 1;
  48464. }
  48465. postMessage(result);
  48466. close();
  48467. }</pre>
  48468. <p>They receive two numbers in two events, perform the computation for the range of numbers thus
  48469. specified, and then report the result back to the parent.</p>
  48470. <p><a href=//www.whatwg.org/demos/workers/multicore/page.html>View this example online</a>.</p>
  48471. <h4 id=tutorials>10.1.3 Tutorials</h4>
  48472. <h5 id=creating-a-dedicated-worker>10.1.3.1 Creating a dedicated worker</h5>
  48473. <p><i>This section is non-normative.</i></p>
  48474. <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
  48475. argument; a worker is then created and returned:</p>
  48476. <pre>var worker = new Worker('helper.js');</pre>
  48477. <h5 id=communicating-with-a-dedicated-worker>10.1.3.2 Communicating with a dedicated worker</h5>
  48478. <p><i>This section is non-normative.</i></p>
  48479. <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
  48480. the same features, such as sending structured data, transferring binary data, and transferring
  48481. other ports.</p>
  48482. <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
  48483. handler IDL attribute</a> on the <code id=communicating-with-a-dedicated-worker:worker><a href=#worker>Worker</a></code> object:</p>
  48484. <pre>worker.onmessage = function (event) { ... };</pre>
  48485. <p>You can also use the <code id=communicating-with-a-dedicated-worker:dom-eventtarget-addeventlistener><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code>
  48486. method.</p>
  48487. <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
  48488. message queue</a> implicitly enabled when it is created, so there is no equivalent to the
  48489. <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
  48490. the <code id=communicating-with-a-dedicated-worker:worker-2><a href=#worker>Worker</a></code> interface.</p>
  48491. <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
  48492. communication channel. To send <code id=communicating-with-a-dedicated-worker:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> objects efficiently (by transferring them
  48493. rather than cloning them), list them in an array in the second argument.</p>
  48494. <pre>worker.postMessage({
  48495. operation: 'find-edges',
  48496. input: buffer, // an ArrayBuffer object
  48497. threshold: 0.6,
  48498. }, [buffer]);</pre>
  48499. <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>
  48500. <pre>onmessage = function (event) { ... };</pre>
  48501. <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>
  48502. <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>
  48503. <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
  48504. structured data in the same manner.</p>
  48505. <pre>postMessage(event.data.input, [event.data.input]); // transfer the buffer back</pre>
  48506. <h5 id=shared-workers>10.1.3.3 Shared workers</h5>
  48507. <p><i>This section is non-normative.</i></p>
  48508. <p>Shared workers are identified by the URL of the script used to create it, optionally with an
  48509. explicit name. The name allows multiple instances of a particular shared worker to be started.</p>
  48510. <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
  48511. not collide. However, if a page tries to use the same shared worker name as another page on the
  48512. same site, but with a different script URL, it will fail.</p>
  48513. <p>Creating shared workers is done using the <code id=shared-workers:dom-sharedworker><a href=#dom-sharedworker>SharedWorker()</a></code>
  48514. constructor. This constructor takes the URL to the script to use for its first argument, and the
  48515. name of the worker, if any, as the second argument.</p>
  48516. <pre>var worker = new SharedWorker('service.js');</pre>
  48517. <p>Communicating with shared workers is done with explicit <code id=shared-workers:messageport><a href=#messageport>MessagePort</a></code> objects. The
  48518. object returned by the <code id=shared-workers:dom-sharedworker-2><a href=#dom-sharedworker>SharedWorker()</a></code> constructor holds a
  48519. reference to the port on its <code id=shared-workers:dom-sharedworker-port><a href=#dom-sharedworker-port>port</a></code> attribute.</p>
  48520. <pre>worker.port.onmessage = function (event) { ... };
  48521. worker.port.postMessage('some message');
  48522. worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']});</pre>
  48523. <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
  48524. given by the event object's <code id=shared-workers:dom-messageevent-source><a href=#dom-messageevent-source>source</a></code> attribute.</p>
  48525. <pre>onconnect = function (event) {
  48526. var newPort = event.source;
  48527. // set up a listener
  48528. newPort.onmessage = function (event) { ... };
  48529. // send a message back to the port
  48530. newPort.postMessage('ready!'); // can also send structured data, of course
  48531. };</pre>
  48532. <h3 id=infrastructure-2>10.2 Infrastructure</h3>
  48533. <p>There are two kinds of workers; dedicated workers, and shared workers. Dedicated workers, once
  48534. created, are linked to their creator; but message ports can be used to communicate from a
  48535. dedicated worker to multiple other browsing contexts or workers. Shared workers, on the other
  48536. 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
  48537. reference to that worker and communicate with it.</p>
  48538. <h4 id=the-global-scope>10.2.1 The global scope</h4>
  48539. <p>The global scope is the "inside" of a worker.</p>
  48540. <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>
  48541. <pre class=idl>[Exposed=Worker]
  48542. interface <dfn id=workerglobalscope>WorkerGlobalScope</dfn> : <a href=#eventtarget id=the-workerglobalscope-common-interface:eventtarget>EventTarget</a> {
  48543. 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>;
  48544. 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>;
  48545. void <a href=#dom-workerglobalscope-close id=the-workerglobalscope-common-interface:dom-workerglobalscope-close>close</a>();
  48546. 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>;
  48547. 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>;
  48548. 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>;
  48549. 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>;
  48550. // <a href="#WorkerGlobalScope-partial">also has additional members in a partial interface</a>
  48551. };</pre>
  48552. <p>The <dfn id=dom-workerglobalscope-self><code>self</code></dfn> attribute must return the
  48553. <code id=the-workerglobalscope-common-interface:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object itself.</p>
  48554. <p>The <dfn id=dom-workerglobalscope-location><code>location</code></dfn> attribute must
  48555. 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>
  48556. 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
  48557. was used to initialise the worker, after any redirects.</p>
  48558. <hr>
  48559. <p>When a script invokes the <dfn id=dom-workerglobalscope-close><code>close()</code></dfn>
  48560. 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
  48561. (atomically):</p>
  48562. <ol><li><p>Discard any <a href=#concept-task id=the-workerglobalscope-common-interface:concept-task>tasks</a> that have been added to the
  48563. <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
  48564. queues</a>.</p>
  48565. <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
  48566. tasks from being queued.)</ol>
  48567. <hr>
  48568. <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>,
  48569. by objects implementing the <code id=the-workerglobalscope-common-interface:workerglobalscope-8><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface:</p>
  48570. <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>
  48571. <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>
  48572. <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>
  48573. <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>
  48574. <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>
  48575. </table>
  48576. <hr>
  48577. <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
  48578. <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
  48579. 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
  48580. 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>
  48581. <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>
  48582. <pre class=idl>[Global=(Worker,DedicatedWorker),Exposed=DedicatedWorker]
  48583. /*sealed*/ interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href=#workerglobalscope id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope</a> {
  48584. void <a href=#dom-dedicatedworkerglobalscope-postmessage id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-postmessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:transferable>Transferable</a>> transfer);
  48585. 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>;
  48586. };</pre>
  48587. <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
  48588. <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
  48589. the worker is created, but it is not exposed. This object must never be garbage collected before
  48590. the <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-3><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>
  48591. <p>All messages received by that port must immediately be retargeted at the
  48592. <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-4><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>
  48593. <p>The <dfn id=dom-dedicatedworkerglobalscope-postmessage><code>postMessage()</code></dfn>
  48594. 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
  48595. immediately invoked <a href=#dom-messageport-postmessage id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-messageport-postmessage>the method of the same name</a>
  48596. on the port, with the same arguments, and returned the same return value.</p>
  48597. <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
  48598. handler IDL attributes</a>, by objects implementing the <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-6><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
  48599. interface:</p>
  48600. <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>
  48601. <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>
  48602. </table>
  48603. <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
  48604. 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>
  48605. <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>
  48606. <pre class=idl>[Global=(Worker,SharedWorker),Exposed=SharedWorker]
  48607. /*sealed*/ interface <dfn id=sharedworkerglobalscope>SharedWorkerGlobalScope</dfn> : <a href=#workerglobalscope id=shared-workers-and-the-sharedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope</a> {
  48608. readonly attribute DOMString <a href=#dom-sharedworkerglobalscope-name id=shared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-name>name</a>;
  48609. 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>;
  48610. 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>;
  48611. };</pre>
  48612. <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
  48613. connection.</p>
  48614. <p>The <dfn id=dom-sharedworkerglobalscope-name><code>name</code></dfn> attribute must return
  48615. 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
  48616. "<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
  48617. reference to the worker using the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworker><a href=#sharedworker>SharedWorker</a></code> constructor.</p>
  48618. <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
  48619. handler IDL attributes</a>, by objects implementing the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-4><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
  48620. interface:</p>
  48621. <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>
  48622. <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>
  48623. </table>
  48624. <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
  48625. 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
  48626. worker with an <a href=#application-cache id=shared-workers-and-the-sharedworkerglobalscope-interface:application-cache-2>application cache</a>.</p>
  48627. <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
  48628. <code id=shared-workers-and-the-sharedworkerglobalscope-interface:applicationcache-2><a href=#applicationcache>ApplicationCache</a></code> object for the worker.</p>
  48629. <h4 id=worker-event-loop>10.2.2 The event loop</h4>
  48630. <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
  48631. 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
  48632. similar-origin browsing contexts</a>. This <a href=#event-loop id=worker-event-loop:event-loop-2>event loop</a> has no associated
  48633. <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
  48634. 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>
  48635. <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
  48636. can get set to true by the algorithms in the processing model section below.</p>
  48637. <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
  48638. 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
  48639. 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,
  48640. notifications for all pending asynchronous operations are dropped, etc.</p>
  48641. <h4 id="the-worker's-lifetime">10.2.3 The worker's lifetime</h4>
  48642. <p>Workers communicate with other workers and with <a href=#browsing-context id="the-worker's-lifetime:browsing-context">browsing
  48643. contexts</a> through <a href=#channel-messaging id="the-worker's-lifetime:channel-messaging">message channels</a> and their
  48644. <code id="the-worker's-lifetime:messageport"><a href=#messageport>MessagePort</a></code> objects.</p>
  48645. <p>Each <code id="the-worker's-lifetime:workerglobalscope"><a href=#workerglobalscope>WorkerGlobalScope</a></code> <var>worker global scope</var> has a list of
  48646. <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
  48647. entangled with another port and that have one (but only one) port owned by <var>worker
  48648. 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>
  48649. <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>.
  48650. Initially this list is empty; it is populated when the worker creates or obtains further
  48651. workers.</p>
  48652. <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
  48653. <code>Document</code>s</dfn>. Initially this list is empty; it is populated when the worker is
  48654. created.</p>
  48655. <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
  48656. 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
  48657. <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
  48658. <code>Document</code>s</span></a>.</p>
  48659. <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>,
  48660. 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
  48661. worker whose list contains that <code id="the-worker's-lifetime:document-3"><a href=#document>Document</a></code>.</p>
  48662. <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
  48663. 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
  48664. 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>
  48665. 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
  48666. 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
  48667. <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
  48668. 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
  48669. <a href=#responsible-document id="the-worker's-lifetime:responsible-document">responsible document</a> specified by <var>o</var>.</p>
  48670. <hr>
  48671. <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
  48672. <code>Document</code>s</a> is not empty.</p>
  48673. <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>
  48674. 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>
  48675. <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
  48676. worker</a> and either it has outstanding timers, database transactions, or network connections,
  48677. 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>
  48678. is actually a <code id="the-worker's-lifetime:sharedworkerglobalscope"><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared
  48679. worker).</p>
  48680. <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
  48681. worker</a> but it is a <a href=#permissible-worker id="the-worker's-lifetime:permissible-worker">permissible worker</a>.</p>
  48682. <h4 id=processing-model-11>10.2.4 Processing model</h4>
  48683. <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>
  48684. <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
  48685. the following steps:</p>
  48686. <ol><li id=worker-processing-model-top>
  48687. <p>Create a separate parallel execution environment (i.e. a separate thread or process or
  48688. equivalent construct), and run the rest of these steps asynchronously in that context.</p>
  48689. <p>For the purposes of timing APIs, this is the <dfn id=official-moment-of-creation>official moment of creation</dfn> of the
  48690. worker.</p>
  48691. <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
  48692. <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>
  48693. 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
  48694. <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,
  48695. <em>not</em> excluding entries marked as <a href=#concept-appcache-foreign id=processing-model-11:concept-appcache-foreign>foreign</a>,
  48696. 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
  48697. match.<li>
  48698. <p>Attempt to <a href=#fetch id=processing-model-11:fetch>fetch</a> the resource identified by <var>url</var>, from the
  48699. <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
  48700. document</a> specified by <var>settings object</var> as the <a href=#referrer-source id=processing-model-11:referrer-source>referrer source</a> (not
  48701. 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
  48702. the <i>force same-origin flag</i> set.</p>
  48703. <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
  48704. 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
  48705. event</a> named <code id=processing-model-11:event-error><a href=#event-error>error</a></code> at that object. Abort these
  48706. steps.</p>
  48707. <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
  48708. decode</a> algorithm on the script resource.</p>
  48709. <p>Let <var>language</var> be JavaScript.</p>
  48710. <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.
  48711. 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
  48712. assumed to be JavaScript.</p>
  48713. <li><p>In the newly created execution environment, create a <a href=#javascript-global-environment id=processing-model-11:javascript-global-environment>JavaScript global
  48714. environment</a> whose <i>global object</i> is <var>worker global scope</var>. If <var>worker
  48715. global scope</var> is a <code id=processing-model-11:dedicatedworkerglobalscope><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this is a
  48716. <a href=#dedicated-worker-environment id=processing-model-11:dedicated-worker-environment>dedicated worker environment</a>. Otherwise, <var>worker global scope</var> is a
  48717. <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
  48718. environment</a>. (In either case, by definition, it is a <a href=#worker-environment id=processing-model-11:worker-environment>worker
  48719. environment</a>.)<li>
  48720. <p>Let <var>script</var> be a new <a href=#concept-script id=processing-model-11:concept-script>script</a>.</p>
  48721. <p>Obtain the appropriate <a href=#script-execution-environment id=processing-model-11:script-execution-environment>script execution environment</a> for the scripting language
  48722. <var>language</var> from <var>settings object</var>.</p>
  48723. <p>Parse/compile/initialise <var>source</var> using that <a href=#script-execution-environment id=processing-model-11:script-execution-environment-2>script execution
  48724. 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
  48725. 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
  48726. entry-point</a> be a no-op script, and act as if a corresponding uncaught script error had
  48727. occurred.</p>
  48728. <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>
  48729. <li>
  48730. <p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
  48731. 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
  48732. <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>
  48733. <li>
  48734. <p><strong>Suspending workers</strong>: Start monitoring the worker, such that whenever
  48735. <var>worker global scope</var>'s <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-2>closing</a>
  48736. 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
  48737. 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
  48738. being a <a href=#suspendable-worker id=processing-model-11:suspendable-worker-2>suspendable worker</a>.</p>
  48739. <li>
  48740. <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
  48741. 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
  48742. worker</a>" or "<a href=#terminate-a-worker id=processing-model-11:terminate-a-worker>terminate a worker</a>" algorithms defined below.</p>
  48743. <li><p>If <var>worker global scope</var> is actually a <code id=processing-model-11:dedicatedworkerglobalscope-2><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
  48744. 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>
  48745. of the worker's implicit port.<li>
  48746. <p><strong>Event loop</strong>: Run the <a href=#responsible-event-loop id=processing-model-11:responsible-event-loop>responsible
  48747. event loop</a> specified by <var>settings object</var> until it is destroyed.</p>
  48748. <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
  48749. 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
  48750. defined below.</p>
  48751. <p class=note>The worker processing model remains on this step until the event loop is
  48752. destroyed, which happens after the <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-4>closing</a>
  48753. 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>
  48754. <li>
  48755. <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>
  48756. <li>
  48757. <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>
  48758. <li>
  48759. <p>Empty the worker's list of
  48760. <a href="#the-worker's-documents" id="processing-model-11:the-worker's-documents">the worker's <code>Document</code>s</a>.</p>
  48761. </ol>
  48762. <hr>
  48763. <p>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must run the following steps in parallel
  48764. 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>
  48765. <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
  48766. <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
  48767. 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>
  48768. <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
  48769. time, e.g. in response to user requests, in response to CPU quota management, or when a worker
  48770. 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
  48771. <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-6>closing</a> flag was set to true.</p>
  48772. <hr>
  48773. <p>When a user agent is to <dfn id=terminate-a-worker>terminate a worker</dfn> it must run the following steps in
  48774. 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
  48775. above):</p>
  48776. <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
  48777. <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
  48778. 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
  48779. <code id=processing-model-11:dedicatedworkerglobalscope-3><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the worker is a dedicated worker), then
  48780. 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
  48781. entangled with.</ol>
  48782. <hr>
  48783. <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
  48784. source</a>.</p>
  48785. <h4 id=runtime-script-errors-2>10.2.5 Runtime script errors</h4>
  48786. <p>Whenever an uncaught runtime script error occurs in one of the worker's scripts, if the error
  48787. 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
  48788. error</a> for that <a href=#concept-script id=runtime-script-errors-2:concept-script>script</a>, with the position (line number
  48789. and column number) where the error occurred, using the <code id=runtime-script-errors-2:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object as
  48790. the target.</p>
  48791. <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>
  48792. afterwards, the error may be reported to the user.</p>
  48793. <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
  48794. 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>
  48795. 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>,
  48796. 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
  48797. <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
  48798. agent must act as if the uncaught runtime script error had occurred in the global scope that the
  48799. <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
  48800. one level up.</p>
  48801. <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
  48802. disentangled (i.e. if the parent worker has been terminated), then the user agent must act as if
  48803. 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
  48804. if that worker's <code id=runtime-script-errors-2:handler-workerglobalscope-onerror><a href=#handler-workerglobalscope-onerror>onerror</a></code> attribute was
  48805. null, but must otherwise act as described above.</p>
  48806. <p class=note>Thus, error reports propagate up to the chain of dedicated workers up to the
  48807. 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
  48808. and garbage collected.</p>
  48809. <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
  48810. source</a>.</p>
  48811. <h4 id=creating-workers>10.2.6 Creating workers</h4>
  48812. <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>
  48813. <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
  48814. interface <dfn id=abstractworker>AbstractWorker</dfn> {
  48815. 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>;
  48816. };</pre>
  48817. <p>The following are the <a href=#event-handlers id=the-abstractworker-abstract-interface:event-handlers>event handlers</a> (and their
  48818. corresponding <a href=#event-handler-event-type id=the-abstractworker-abstract-interface:event-handler-event-type>event handler
  48819. 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
  48820. objects implementing the <code id=the-abstractworker-abstract-interface:abstractworker-2><a href=#abstractworker>AbstractWorker</a></code> interface:</p>
  48821. <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>
  48822. <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>
  48823. </table>
  48824. <h5 id=script-settings-for-workers>10.2.6.2 Script settings for workers</h5>
  48825. <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
  48826. <var>worker global scope</var> and a <a href=#url id=script-settings-for-workers:url>URL</a> <var>script
  48827. address</var>, it must run the following steps:</p>
  48828. <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
  48829. 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
  48830. 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
  48831. <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
  48832. loop</a>.<li>
  48833. <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
  48834. are defined as follows:</p>
  48835. <dl><dt>The <a href=#script-execution-environment id=script-settings-for-workers:script-execution-environment>script execution environments</a><dd>
  48836. <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
  48837. user agent, create an appropriate execution environment as defined by the relevant
  48838. specification.</p>
  48839. <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
  48840. 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>
  48841. <p class=note>Currently, workers only support JavaScript, so only a JavaScript execution
  48842. environment is actually needed here.</p>
  48843. <dt>The <a href=#global-object id=script-settings-for-workers:global-object>global object</a><dd>
  48844. <p>Return <var>worker global scope</var>.</p>
  48845. <dt>The <a href=#responsible-browsing-context id=script-settings-for-workers:responsible-browsing-context-2>responsible browsing context</a><dd>
  48846. <p>Return <var>inherited responsible browsing context</var>.</p>
  48847. <dt>The <a href=#responsible-document id=script-settings-for-workers:responsible-document-2>responsible document</a><dd>
  48848. <p>Return <var>inherited responsible document</var>.</p>
  48849. <dt>The <a href=#responsible-event-loop id=script-settings-for-workers:responsible-event-loop>responsible event loop</a><dd>
  48850. <p>Return <var>worker event loop</var>.</p>
  48851. <dt>The <a href=#api-referrer-source id=script-settings-for-workers:api-referrer-source>API referrer source</a><dd>
  48852. <p>Return <var>script address</var>.</p>
  48853. <dt>The <a href=#api-url-character-encoding id=script-settings-for-workers:api-url-character-encoding>API URL character encoding</a><dd>
  48854. <p>Return UTF-8.</p>
  48855. <dt>The <a href=#api-base-url id=script-settings-for-workers:api-base-url>API base URL</a><dd>
  48856. <p>Return <var>worker URL</var>.</p>
  48857. <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>
  48858. <p>Return <var>inherited origin</var>.</p>
  48859. </dl>
  48860. <li><p>Return <var>settings object</var>.</ol>
  48861. <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>
  48862. <pre class=idl>[<a href=#dom-worker id=dedicated-workers-and-the-worker-interface:dom-worker>Constructor</a>(DOMString scriptURL), Exposed=(Window,Worker)]
  48863. interface <dfn id=worker>Worker</dfn> : <a href=#eventtarget id=dedicated-workers-and-the-worker-interface:eventtarget>EventTarget</a> {
  48864. void <a href=#dom-worker-terminate id=dedicated-workers-and-the-worker-interface:dom-worker-terminate>terminate</a>();
  48865. void <a href=#dom-worker-postmessage id=dedicated-workers-and-the-worker-interface:dom-worker-postmessage>postMessage</a>(any message, optional sequence&lt;<a href=#transferable id=dedicated-workers-and-the-worker-interface:transferable>Transferable</a>> transfer);
  48866. 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>;
  48867. };
  48868. <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>
  48869. <p>The <dfn id=dom-worker-terminate><code>terminate()</code></dfn> method, when invoked, must
  48870. 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
  48871. is associated.</p>
  48872. <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
  48873. with them. This port is part of a channel that is set up when the worker is created, but it is not
  48874. 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>
  48875. <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>
  48876. object.</p>
  48877. <p>The <dfn id=dom-worker-postmessage><code>postMessage()</code></dfn> method on
  48878. <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
  48879. arguments, and returned the same return value.</p>
  48880. <div class=example>
  48881. <p>The <code id=dedicated-workers-and-the-worker-interface:dom-worker-postmessage-2><a href=#dom-worker-postmessage>postMessage()</a></code>
  48882. method's first argument can be structured data:</p>
  48883. <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>
  48884. </div>
  48885. <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>,
  48886. by objects implementing the <code id=dedicated-workers-and-the-worker-interface:worker-7><a href=#worker>Worker</a></code> interface:</p>
  48887. <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>
  48888. <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>
  48889. </table>
  48890. <hr>
  48891. <p>When the <dfn id=dom-worker><code>Worker(<var>scriptURL</var>)</code></dfn> constructor
  48892. is invoked, the user agent must run the following steps:</p>
  48893. <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
  48894. the request violates a policy decision (e.g. if the user agent is configured to not allow the
  48895. 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
  48896. 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
  48897. 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>
  48898. <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
  48899. 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
  48900. 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
  48901. 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
  48902. and abort these steps.</p>
  48903. <p class=note>For example, scripts can be external files with the same scheme, host, and port
  48904. 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
  48905. 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>
  48906. <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
  48907. 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>
  48908. 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>.
  48909. 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
  48910. 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
  48911. 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
  48912. 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
  48913. scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
  48914. <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>
  48915. 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
  48916. <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
  48917. <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
  48918. <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
  48919. 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>
  48920. <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>
  48921. <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)]
  48922. interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#eventtarget id=shared-workers-and-the-sharedworker-interface:eventtarget>EventTarget</a> {
  48923. 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>;
  48924. };
  48925. <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>
  48926. <p>The <dfn id=dom-sharedworker-port><code>port</code></dfn> attribute must return the value
  48927. 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
  48928. communicating with the shared worker.</p>
  48929. <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
  48930. steps:</p>
  48931. <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
  48932. the request violates a policy decision (e.g. if the user agent is configured to not allow the
  48933. 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>
  48934. 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
  48935. the second argument was omitted.<li>
  48936. <p>If the <a href=#concept-url-scheme id=shared-workers-and-the-sharedworker-interface:concept-url-scheme>scheme</a> component of <var>parsed
  48937. 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>
  48938. of <var>scriptURL</var> is not the <a href=#same-origin id=shared-workers-and-the-sharedworker-interface:same-origin>same</a> as the
  48939. <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
  48940. <code id=shared-workers-and-the-sharedworker-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
  48941. <p class=note>Thus, scripts must either be external files with the same scheme, host, and port
  48942. 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
  48943. 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
  48944. 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>
  48945. <li>
  48946. <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
  48947. 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>
  48948. <li>
  48949. <p>Execute the following substeps atomically:</p>
  48950. <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
  48951. <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
  48952. 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>
  48953. <p>If <var>name</var> is not the empty string and there exists a
  48954. <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
  48955. <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
  48956. 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>
  48957. 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
  48958. that <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-3><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>
  48959. <p>Otherwise, if <var>name</var> is the empty string and there exists a
  48960. <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
  48961. <code id=shared-workers-and-the-sharedworker-interface:dom-workerglobalscope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute represents an
  48962. <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
  48963. global scope</var> be that <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-5><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>
  48964. <li>
  48965. <p>If <var>worker global scope</var> is not null, but the user agent has been
  48966. 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
  48967. <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
  48968. object</a>, then set <var>worker global scope</var> to null.</p>
  48969. <p class=note>For example, a user agent could have a development mode that isolates a
  48970. 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
  48971. development mode could be blocked from connecting to shared workers running in the normal
  48972. browser mode.</p>
  48973. <li>
  48974. <p>If <var>worker global scope</var> is not null, then run these steps:</p>
  48975. <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
  48976. URL</a> that is not exactly equal to <var>scriptURL</var>, then throw a
  48977. <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
  48978. 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>
  48979. 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
  48980. the <var>inside port</var>.<li><p><a href=#entangle id=shared-workers-and-the-sharedworker-interface:entangle>Entangle</a> <var>outside port</var>
  48981. 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
  48982. <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
  48983. 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>
  48984. 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,
  48985. 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
  48986. 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
  48987. scope</var>.<li>
  48988. <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
  48989. scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
  48990. <code id=shared-workers-and-the-sharedworker-interface:document><a href=#document>Document</a></code> objects in <var>docs</var>.</p>
  48991. <li>
  48992. <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>
  48993. 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
  48994. 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
  48995. 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
  48996. object</a>.</p>
  48997. <li><p>Return <var>worker</var> and abort all these steps.</ol>
  48998. <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
  48999. 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
  49000. scope</var> and <var>scriptURL</var>, and let <var>settings object</var> be
  49001. 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
  49002. <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
  49003. 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>
  49004. <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
  49005. <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
  49006. 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>
  49007. 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
  49008. 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
  49009. 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
  49010. scope</var>.<li>
  49011. <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
  49012. scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
  49013. <code id=shared-workers-and-the-sharedworker-interface:document-2><a href=#document>Document</a></code> objects in <var>docs</var>.</p>
  49014. <li>
  49015. <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
  49016. 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
  49017. 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
  49018. 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>
  49019. <li>
  49020. <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>
  49021. 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>
  49022. </ol>
  49023. <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
  49024. source</a>.</p>
  49025. <h3 id=apis-available-to-workers>10.3 APIs available to workers</h3>
  49026. <pre class=idl>[Exposed=Worker]
  49027. partial interface <a href=#workerglobalscope id=WorkerGlobalScope-partial>WorkerGlobalScope</a> { // not obsolete
  49028. void <a href=#dom-workerglobalscope-importscripts id=apis-available-to-workers:dom-workerglobalscope-importscripts>importScripts</a>(DOMString... urls);
  49029. 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>;
  49030. };
  49031. <a href=#workerglobalscope id=apis-available-to-workers:workerglobalscope>WorkerGlobalScope</a> implements <a href=#windowtimers id=apis-available-to-workers:windowtimers>WindowTimers</a>;
  49032. <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>
  49033. <h4 id=importing-scripts-and-libraries>10.3.1 Importing scripts and libraries</h4>
  49034. <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
  49035. agent must run the following steps:</p>
  49036. <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
  49037. 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>
  49038. <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>
  49039. <li>
  49040. <p>For each argument in turn, in the order given, starting with the first one, run these
  49041. substeps:</p>
  49042. <ol><li>
  49043. <p>Wait for the fetching attempt for the corresponding resource to complete.</p>
  49044. <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
  49045. these steps.</p>
  49046. <p>If the attempt succeeds, then let <var>source</var> be the result of running the
  49047. <a href=#utf-8-decode id=importing-scripts-and-libraries:utf-8-decode>UTF-8 decode</a> algorithm on the script resource.</p>
  49048. <p>Let <var>language</var> be JavaScript.</p>
  49049. <p class=note>As with the worker's script, the script here is always assumed to be
  49050. JavaScript, regardless of the MIME type.</p>
  49051. <li>
  49052. <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
  49053. <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
  49054. the <a href=#script-settings-object id=importing-scripts-and-libraries:script-settings-object>script settings object</a>.</p>
  49055. <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
  49056. 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
  49057. 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
  49058. script</a> algorithm as well.</p>
  49059. <p>Let the newly created <a href=#concept-script id=importing-scripts-and-libraries:concept-script>script</a> run until it either
  49060. returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
  49061. "<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
  49062. above.</p>
  49063. <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>
  49064. <p>If an exception was thrown or if the script was prematurely aborted, then abort all these
  49065. 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>
  49066. <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
  49067. the script then abort all these steps.</p>
  49068. </ol>
  49069. </ol>
  49070. <h4 id=the-workernavigator-object>10.3.2 The <code id=the-workernavigator-object:workernavigator><a href=#workernavigator>WorkerNavigator</a></code> object</h4>
  49071. <p>The <dfn id=dom-worker-navigator><code>navigator</code></dfn> attribute
  49072. of the <code id=the-workernavigator-object:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface must return an instance of
  49073. the <code id=the-workernavigator-object:workernavigator-2><a href=#workernavigator>WorkerNavigator</a></code> interface, which represents the
  49074. identity and state of the user agent (the client):</p>
  49075. <pre class=idl>[Exposed=Worker]
  49076. interface <dfn id=workernavigator>WorkerNavigator</dfn> {};
  49077. <a href=#workernavigator id=the-workernavigator-object:workernavigator-3>WorkerNavigator</a> implements <a href=#navigatorid id=the-workernavigator-object:navigatorid>NavigatorID</a>;
  49078. <a href=#workernavigator id=the-workernavigator-object:workernavigator-4>WorkerNavigator</a> implements <a href=#navigatorlanguage id=the-workernavigator-object:navigatorlanguage>NavigatorLanguage</a>;
  49079. <a href=#workernavigator id=the-workernavigator-object:workernavigator-5>WorkerNavigator</a> implements <a href=#navigatoronline id=the-workernavigator-object:navigatoronline>NavigatorOnLine</a>;</pre>
  49080. <h4 id=worker-locations>10.3.3 Worker locations</h4>
  49081. <pre class=idl>[Exposed=Worker]
  49082. interface <dfn id=workerlocation>WorkerLocation</dfn> { };
  49083. <a href=#workerlocation id=worker-locations:workerlocation>WorkerLocation</a> implements <a href=#urlutilsreadonly id=worker-locations:urlutilsreadonly>URLUtilsReadOnly</a>;</pre>
  49084. <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
  49085. creation.</p>
  49086. <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>
  49087. interface. <a href=#refsURL>[URL]</a></p>
  49088. <p>When the object is created, the user agent must invoke the element's
  49089. <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
  49090. 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>
  49091. object represents as the given value.</p>
  49092. <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>
  49093. <h2 id=webstorage>11 Web storage</h2>
  49094. <h3 id=introduction-16>11.1 Introduction</h3>
  49095. <p><i>This section is non-normative.</i></p>
  49096. <p>This specification introduces two related mechanisms, similar to HTTP session cookies, for
  49097. storing name-value pairs on the client side. <a href=#refsCOOKIES>[COOKIES]</a></p>
  49098. <p>The first is designed for scenarios where the user is carrying out a single transaction, but
  49099. could be carrying out multiple transactions in different windows at the same time.</p>
  49100. <p>Cookies don't really handle this case well. For example, a user could be buying plane tickets
  49101. in two different windows, using the same site. If the site used cookies to keep track of which
  49102. ticket the user was buying, then as the user clicked from page to page in both windows, the ticket
  49103. currently being purchased would "leak" from one window to the other, potentially causing the user
  49104. to buy two tickets for the same flight without really noticing.</p>
  49105. <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
  49106. storage, and it will be accessible to any page from the same site opened in that window.</p>
  49107. <div class=example>
  49108. <p>For example, a page could have a checkbox that the user ticks to
  49109. indicate that he wants insurance:</p>
  49110. <pre>&lt;label>
  49111. &lt;input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
  49112. I want insurance on this trip.
  49113. &lt;/label></pre>
  49114. <p>A later page could then check, from script, whether the user had checked the checkbox or
  49115. not:</p>
  49116. <pre>if (sessionStorage.insurance) { ... }</pre>
  49117. <p>If the user had multiple windows opened on the site, each one would have its own individual
  49118. copy of the session storage object.</p>
  49119. </div>
  49120. <p>The second storage mechanism is designed for storage that spans multiple windows, and lasts
  49121. beyond the current session. In particular, Web applications may wish to store megabytes of user
  49122. data, such as entire user-authored documents or a user's mailbox, on the client side for
  49123. performance reasons.</p>
  49124. <p>Again, cookies do not handle this case well, because they are transmitted with every
  49125. request.</p>
  49126. <p>The <code id=introduction-16:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> IDL attribute is used to access a page's
  49127. local storage area.</p>
  49128. <div class=example>
  49129. <p>The site at example.com can display a count of how many times the user has loaded its page by
  49130. putting the following at the bottom of its page:</p>
  49131. <pre>&lt;p>
  49132. You have viewed this page
  49133. &lt;span id="count">an untold number of&lt;/span>
  49134. time(s).
  49135. &lt;/p>
  49136. &lt;script>
  49137. if (!localStorage.pageLoadCount)
  49138. localStorage.pageLoadCount = 0;
  49139. localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
  49140. document.getElementById('count').textContent = localStorage.pageLoadCount;
  49141. &lt;/script></pre>
  49142. </div>
  49143. <p>Each site has its own separate storage area.</p>
  49144. <h3 id=storage>11.2 The API</h3>
  49145. <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>
  49146. <pre class=idl>interface <dfn id=storage-2>Storage</dfn> {
  49147. readonly attribute unsigned long <a href=#dom-storage-length id=the-storage-interface:dom-storage-length>length</a>;
  49148. DOMString? <a href=#dom-storage-key id=the-storage-interface:dom-storage-key>key</a>(unsigned long index);
  49149. getter DOMString? <a href=#dom-storage-getitem id=the-storage-interface:dom-storage-getitem>getItem</a>(DOMString key);
  49150. setter creator void <a href=#dom-storage-setitem id=the-storage-interface:dom-storage-setitem>setItem</a>(DOMString key, DOMString value);
  49151. deleter void <a href=#dom-storage-removeitem id=the-storage-interface:dom-storage-removeitem>removeItem</a>(DOMString key);
  49152. void <a href=#dom-storage-clear id=the-storage-interface:dom-storage-clear>clear</a>();
  49153. };</pre>
  49154. <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
  49155. sometimes called items. Keys are strings. Any string (including the empty string) is a valid key.
  49156. Values are similarly strings.</p>
  49157. <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
  49158. created, as defined in the sections on the <code id=the-storage-interface:dom-sessionstorage><a href=#dom-sessionstorage>sessionStorage</a></code>
  49159. and <code id=the-storage-interface:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> attributes. Multiple separate objects
  49160. 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
  49161. key/value pairs simultaneously.</p>
  49162. <p>The <dfn id=dom-storage-length><code>length</code></dfn> attribute must return the number
  49163. of key/value pairs currently present in the list associated with the object.</p>
  49164. <p>The <dfn id=dom-storage-key><code>key(<var>n</var>)</code></dfn> method must
  49165. return the name of the <var>n</var>th key in the list. The order of keys is user-agent
  49166. defined, but must be consistent within an object so long as the number of keys doesn't change.
  49167. (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
  49168. changing the value of an existing key must not.) If <var>n</var> is
  49169. greater than or equal to the number of key/value pairs
  49170. in the object, then this method must return null.</p>
  49171. <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
  49172. key/value pair currently present in the list associated with the object, in the order that the
  49173. keys were last added to the storage area.</p>
  49174. <p>The <dfn id=dom-storage-getitem><code>getItem(<var>key</var>)</code></dfn> method
  49175. 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
  49176. return null. </p>
  49177. <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>
  49178. <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>
  49179. <p>If the given <var>key</var> <em>does</em> exist in the list, and its value is not
  49180. 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
  49181. the method must do nothing.</p>
  49182. <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>
  49183. exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the
  49184. quota has been exceeded.)</p>
  49185. <p>The <dfn id=dom-storage-removeitem><code>removeItem(<var>key</var>)</code></dfn>
  49186. method must cause the key/value pair with the given <var>key</var> to be removed from the
  49187. list associated with the object, if it exists. If no item with that key exists, the method must do
  49188. nothing.</p>
  49189. <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.
  49190. In the case of failure, the method does nothing. That is, changes to the data storage area must
  49191. either be successful, or the data storage area must not be changed at all.</p>
  49192. <p>The <dfn id=dom-storage-clear><code>clear()</code></dfn> method must atomically cause the
  49193. list associated with the object to be emptied of all key/value pairs, if there are any. If there
  49194. are none, then the method must do nothing.</p>
  49195. <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
  49196. <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
  49197. 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>
  49198. <p class=note>This specification does not require that the above methods wait until the data has
  49199. been physically written to disk. Only consistency in what different scripts accessing the same
  49200. underlying list of key/value pairs see is required.</p>
  49201. <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>
  49202. <pre class=idl>[NoInterfaceObject]
  49203. interface <dfn id=windowsessionstorage>WindowSessionStorage</dfn> {
  49204. 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>;
  49205. };
  49206. <a href=#window id=the-sessionstorage-attribute:window>Window</a> implements <a href=#windowsessionstorage id=the-sessionstorage-attribute:windowsessionstorage>WindowSessionStorage</a>;</pre>
  49207. <p>The <dfn id=dom-sessionstorage><code>sessionStorage</code></dfn> attribute represents the
  49208. 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>
  49209. <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
  49210. each <a href=#origin-2 id=the-sessionstorage-attribute:origin-2>origin</a>.</p>
  49211. <p>User agents should not expire data from a browsing context's session storage areas, but may do
  49212. so when the user requests that such data be deleted, or when the UA detects that it has limited
  49213. storage space, or for security reasons. User agents should always avoid deleting data while a
  49214. script that could access that data is running. When a top-level browsing context is destroyed (and
  49215. therefore permanently inaccessible to the user) the data stored in its session storage areas can
  49216. be discarded with it, as the API described in this specification provides no way for that data to
  49217. ever be subsequently retrieved.</p>
  49218. <p class=note>The lifetime of a browsing context can be unrelated to the lifetime of the actual
  49219. user agent process itself, as the user agent may support resuming sessions after a restart.</p>
  49220. <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
  49221. <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
  49222. 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
  49223. 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
  49224. 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>
  49225. 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
  49226. storage area does not change during the lifetime of a <code id=the-sessionstorage-attribute:document-5><a href=#document>Document</a></code>.</p>
  49227. <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
  49228. <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>
  49229. <p>The <code id=the-sessionstorage-attribute:dom-sessionstorage-3><a href=#dom-sessionstorage>sessionStorage</a></code> attribute must return a
  49230. <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
  49231. 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
  49232. 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>
  49233. attribute.</p>
  49234. <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
  49235. <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
  49236. areas as the original, but the two sets must from that point on be considered separate, not
  49237. affecting each other in any way.</p>
  49238. <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
  49239. following a link in an existing browsing context, or in some other way related to a specific
  49240. <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
  49241. 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
  49242. into the new browsing context when it is created. From that point on, however, the two session
  49243. storage areas must be considered separate, not affecting each other in any way.</p>
  49244. <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
  49245. 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
  49246. <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
  49247. <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>
  49248. <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>
  49249. <pre class=idl>[NoInterfaceObject]
  49250. interface <dfn id=windowlocalstorage>WindowLocalStorage</dfn> {
  49251. 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>;
  49252. };
  49253. <a href=#window id=the-localstorage-attribute:window>Window</a> implements <a href=#windowlocalstorage id=the-localstorage-attribute:windowlocalstorage>WindowLocalStorage</a>;</pre>
  49254. <p>The <dfn id=dom-localstorage><code>localStorage</code></dfn> object provides a
  49255. <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>.
  49256. <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>
  49257. </p>
  49258. <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>
  49259. <p>User agents should expire data from the local storage areas only for security reasons or when
  49260. requested to do so by the user. User agents should always avoid deleting data while a script that
  49261. could access that data is running.</p>
  49262. <p>When the <code id=the-localstorage-attribute:dom-localstorage-3><a href=#dom-localstorage>localStorage</a></code> attribute is accessed, the user
  49263. agent must run the following steps, which are known as the <dfn id=storage-object-initialization-steps><code>Storage</code> object
  49264. initialization steps</dfn>:</p>
  49265. <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
  49266. 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
  49267. (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
  49268. 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
  49269. <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
  49270. attribute was accessed. If it has not, create a new storage area for that
  49271. <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.
  49272. 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>
  49273. </ol>
  49274. <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
  49275. 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
  49276. <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
  49277. <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>.
  49278. <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
  49279. examined, returned, set, or deleted, whether as part of a direct property access, when checking
  49280. for the presence of a property, during property enumeration, when determining the number of
  49281. properties present, or as part of the execution of any of the methods or attributes defined on the
  49282. <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
  49283. mutex</a>.</p>
  49284. <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>
  49285. <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
  49286. <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
  49287. (<a href=#sessionStorageEvent>for session storage</a>, <a href=#localStorageEvent>for local
  49288. storage</a>).</p>
  49289. <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
  49290. 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
  49291. 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
  49292. 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>
  49293. <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>,
  49294. 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
  49295. <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>
  49296. <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
  49297. source</a>.</p>
  49298. <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,
  49299. its <code id=the-storage-event:dom-storageevent-oldvalue><a href=#dom-storageevent-oldvalue>oldValue</a></code> attribute initialised to the old
  49300. 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
  49301. key in question, or null if the key was removed.</p>
  49302. <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>,
  49303. and <code id=the-storage-event:dom-storageevent-newvalue-2><a href=#dom-storageevent-newvalue>newValue</a></code> attributes initialised to null.</p>
  49304. <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
  49305. 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
  49306. <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
  49307. <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
  49308. <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
  49309. (i.e. session or local).</p>
  49310. <h5 id=the-storageevent-interface>11.2.4.1 The <code id=the-storageevent-interface:storageevent><a href=#storageevent>StorageEvent</a></code> interface</h5>
  49311. <pre class=idl>[Constructor(DOMString type, optional <a href=#storageeventinit id=the-storageevent-interface:storageeventinit>StorageEventInit</a> eventInitDict)]
  49312. interface <dfn id=storageevent>StorageEvent</dfn> : <a href=#event id=the-storageevent-interface:event>Event</a> {
  49313. readonly attribute DOMString? <a href=#dom-storageevent-key id=the-storageevent-interface:dom-storageevent-key>key</a>;
  49314. readonly attribute DOMString? <a href=#dom-storageevent-oldvalue id=the-storageevent-interface:dom-storageevent-oldvalue>oldValue</a>;
  49315. readonly attribute DOMString? <a href=#dom-storageevent-newvalue id=the-storageevent-interface:dom-storageevent-newvalue>newValue</a>;
  49316. readonly attribute DOMString <a href=#dom-storageevent-url id=the-storageevent-interface:dom-storageevent-url>url</a>;
  49317. 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>;
  49318. };
  49319. dictionary <dfn id=storageeventinit>StorageEventInit</dfn> : <a href=#eventinit id=the-storageevent-interface:eventinit>EventInit</a> {
  49320. DOMString? key;
  49321. DOMString? oldValue;
  49322. DOMString? newValue;
  49323. DOMString url;
  49324. <a href=#storage-2 id=the-storageevent-interface:storage-2-2>Storage</a>? storageArea;
  49325. };</pre>
  49326. <p>The <dfn id=dom-storageevent-key><code>key</code></dfn> attribute must return the value it
  49327. was initialised to. When the object is created, this attribute must be initialised to null. It
  49328. represents the key being changed.</p>
  49329. <p>The <dfn id=dom-storageevent-oldvalue><code>oldValue</code></dfn> attribute must return
  49330. the value it was initialised to. When the object is created, this attribute must be initialised to
  49331. null. It represents the old value of the key being changed.</p>
  49332. <p>The <dfn id=dom-storageevent-newvalue><code>newValue</code></dfn> attribute must return
  49333. the value it was initialised to. When the object is created, this attribute must be initialised to
  49334. null. It represents the new value of the key being changed.</p>
  49335. <p>The <dfn id=dom-storageevent-url><code>url</code></dfn> attribute must return the value it
  49336. was initialised to. When the object is created, this attribute must be initialised to the empty
  49337. string. It represents the address of the document whose key changed.</p>
  49338. <p>The <dfn id=dom-storageevent-storagearea><code>storageArea</code></dfn> attribute must
  49339. return the value it was initialised to. When the object is created, this attribute must be
  49340. 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>
  49341. <h4 id=threads>11.2.5 Threads</h4>
  49342. <p>Because of <a href=#localStorageMutex>the use</a> of the <a href=#storage-mutex id=threads:storage-mutex>storage mutex</a>, multiple
  49343. browsing contexts will be able to access the local storage areas simultaneously in such a manner
  49344. that scripts cannot detect any concurrent script execution.</p>
  49345. <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>
  49346. object, and the value of the various properties of that object, cannot change while a script is
  49347. executing, other than in a way that is predictable by the script itself.</p>
  49348. <h3 id=disk-space-2>11.3 Disk space</h3>
  49349. <p>User agents should limit the total amount of space allowed for storage areas, because hostile
  49350. authors could otherwise use this feature to exhaust the user's available disk space.</p>
  49351. <p>User agents should guard against sites storing data under their origin's other affiliated
  49352. sites, e.g. storing up to the limit in a1.example.com, a2.example.com, a3.example.com, etc,
  49353. circumventing the main example.com storage limit.</p>
  49354. <p>User agents may prompt the user when quotas are reached, allowing the user to grant a site more
  49355. space. This enables sites to store many user-created documents on the user's computer, for
  49356. instance.</p>
  49357. <p>User agents should allow users to see how much space each domain is using.</p>
  49358. <p>A mostly arbitrary limit of five megabytes per <a href=#origin-2 id=disk-space-2:origin-2>origin</a> is suggested. Implementation
  49359. feedback is welcome and will be used to update this suggestion in the future.</p>
  49360. <p>For predictability, quotas should be based on the uncompressed size of data stored.</p>
  49361. <h3 id=privacy>11.4 Privacy</h3>
  49362. <h4 id=user-tracking>11.4.1 User tracking</h4>
  49363. <p>A third-party advertiser (or any entity capable of getting content distributed to multiple
  49364. sites) could use a unique identifier stored in its local storage area to track a user across
  49365. multiple sessions, building a profile of the user's interests to allow for highly targeted
  49366. advertising. In conjunction with a site that is aware of the user's real identity (for example an
  49367. e-commerce site that requires authenticated credentials), this could allow oppressive groups to
  49368. target individuals with greater accuracy than in a world with purely anonymous Web usage.</p>
  49369. <p>There are a number of techniques that can be used to mitigate the risk of user tracking:</p>
  49370. <dl><dt>Blocking third-party storage<dd>
  49371. <p>User agents may restrict access to the <code id=user-tracking:dom-localstorage><a href=#dom-localstorage>localStorage</a></code>
  49372. 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
  49373. context</a>, for instance denying access to the API for pages from other domains running in
  49374. <code id=user-tracking:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s.</p>
  49375. <dt>Expiring stored data<dd>
  49376. <p>User agents may, possibly in a manner configured by the user, automatically delete stored
  49377. data after a period of time.</p>
  49378. <p>For example, a user agent could be configured to treat third-party local storage areas as
  49379. 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>
  49380. <p>This can restrict the ability of a site to track a user, as the site would then only be able
  49381. to track the user across multiple sessions when he authenticates with the site itself (e.g. by
  49382. making a purchase or logging in to a service).</p>
  49383. <p>However, this also reduces the usefulness of the API as a long-term storage mechanism. It can
  49384. also put the user's data at risk, if the user does not fully understand the implications of data
  49385. expiration.</p>
  49386. <dt>Treating persistent storage as cookies<dd>
  49387. <p>If users attempt to protect their privacy by clearing cookies without also clearing data
  49388. stored in the local storage area, sites can defeat those attempts by using the two features as
  49389. redundant backup for each other. User agents should present the interfaces for clearing these in
  49390. a way that helps users to understand this possibility and enables them to delete data in all
  49391. persistent storage features simultaneously. <a href=#refsCOOKIES>[COOKIES]</a></p>
  49392. <dt>Site-specific white-listing of access to local storage areas<dd>
  49393. <p>User agents may allow sites to access session storage areas in
  49394. an unrestricted manner, but require the user to authorise access
  49395. to local storage areas.</p>
  49396. <dt>Origin-tracking of stored data<dd>
  49397. <p>User agents may record the <a href=#origin-2 id=user-tracking:origin-2>origins</a> of sites that contained
  49398. content from third-party origins that caused data to be stored.</p>
  49399. <p>If this information is then used to present the view of data currently in persistent storage,
  49400. it would allow the user to make informed decisions about which parts of the persistent storage
  49401. to prune. Combined with a blacklist ("delete this data and prevent this domain from ever storing
  49402. data again"), the user can restrict the use of persistent storage to sites that he trusts.</p>
  49403. <dt>Shared blacklists<dd>
  49404. <p>User agents may allow users to share their persistent storage domain blacklists.</p>
  49405. <p>This would allow communities to act together to protect their privacy.</p>
  49406. </dl>
  49407. <p>While these suggestions prevent trivial use of this API for user tracking, they do not block it
  49408. altogether. Within a single domain, a site can continue to track the user during a session, and
  49409. can then pass all this information to the third party along with any identifying information
  49410. (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with
  49411. multiple sites to obtain such information, a profile can still be created.</p>
  49412. <p>However, user tracking is to some extent possible even with no cooperation from the user agent
  49413. whatsoever, for instance by using session identifiers in URLs, a technique already commonly used
  49414. for innocuous purposes but easily repurposed for user tracking (even retroactively). This
  49415. information can then be shared with other sites, using visitors' IP addresses and other
  49416. user-specific data (e.g. user-agent headers and configuration settings) to combine separate
  49417. sessions into coherent user profiles.</p>
  49418. <h4 id=sensitivity-of-data>11.4.2 Sensitivity of data</h4>
  49419. <p>User agents should treat persistently stored data as potentially sensitive; it's quite possible
  49420. for e-mails, calendar appointments, health records, or other confidential documents to be stored
  49421. in this mechanism.</p>
  49422. <p>To this end, user agents should ensure that when deleting data, it is promptly deleted from the
  49423. underlying storage.</p>
  49424. <h3 id=security-storage>11.5 Security</h3>
  49425. <h4 id=dns-spoofing-attacks>11.5.1 DNS spoofing attacks</h4>
  49426. <p>Because of the potential for DNS spoofing attacks, one cannot guarantee that a host claiming to
  49427. be in a certain domain really is from that domain. To mitigate this, pages can use TLS. Pages
  49428. using TLS can be sure that only the user, software working on behalf of the user, and other pages
  49429. using TLS that have certificates identifying them as being from the same domain, can access their
  49430. storage areas.</p>
  49431. <h4 id=cross-directory-attacks>11.5.2 Cross-directory attacks</h4>
  49432. <p>Different authors sharing one host name, for example users hosting content on the now defunct
  49433. <code>geocities.com</code>, all share one local storage object. There is no feature to
  49434. restrict the access by pathname. Authors on shared hosts are therefore urged to avoid using these
  49435. features, as it would be trivial for other authors to read the data and overwrite it.</p>
  49436. <p class=note>Even if a path-restriction feature was made available, the usual DOM scripting
  49437. security model would make it trivial to bypass this protection and access the data from any
  49438. path.</p>
  49439. <h4 id=implementation-risks>11.5.3 Implementation risks</h4>
  49440. <p>The two primary risks when implementing these persistent storage features are letting hostile
  49441. sites read information from other domains, and letting hostile sites write information that is
  49442. then read from other domains.</p>
  49443. <p>Letting third-party sites read data that is not supposed to be read from their domain causes
  49444. <em>information leakage</em>, For example, a user's shopping wishlist on one domain could be used
  49445. by another domain for targeted advertising; or a user's work-in-progress confidential documents
  49446. stored by a word-processing site could be examined by the site of a competing company.</p>
  49447. <p>Letting third-party sites write data to the persistent storage of other domains can result in
  49448. <em>information spoofing</em>, which is equally dangerous. For example, a hostile site could add
  49449. items to a user's wishlist; or a hostile site could set a user's session identifier to a known ID
  49450. that the hostile site can then use to track the user's actions on the victim site.</p>
  49451. <p>Thus, strictly following the <a href=#origin-2 id=implementation-risks:origin-2>origin</a> model described in this specification is
  49452. important for user security.</p>
  49453. <h2 id=syntax>12 <dfn>The HTML syntax</dfn></h2>
  49454. <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
  49455. 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
  49456. XHTML syntax</a>".</p>
  49457. <h3 id=writing>12.1 Writing HTML documents</h3>
  49458. <p><i>This section only applies to documents, authoring tools, and markup generators. In
  49459. particular, it does not apply to conformance checkers; conformance checkers must use the
  49460. requirements given in the next section ("parsing HTML documents").</i></p>
  49461. <p>Documents must consist of the following parts, in the given
  49462. order:</p>
  49463. <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>.
  49464. <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>
  49465. <p>The various types of content mentioned above are described in the next few sections.</p>
  49466. <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
  49467. section on that topic.</p>
  49468. <div class=note>
  49469. <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
  49470. 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
  49471. 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
  49472. 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
  49473. around the root element do not round-trip.</p>
  49474. <p>It is suggested that newlines be inserted after the DOCTYPE, after any comments that are
  49475. 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
  49476. <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>
  49477. </div>
  49478. <p>Many strings in the HTML syntax (e.g. the names of elements and their attributes) are
  49479. 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
  49480. letters</a>. For convenience, in this section this is just referred to as
  49481. "case-insensitive".</p>
  49482. <h4 id=the-doctype>12.1.1 The DOCTYPE</h4>
  49483. <p>A <dfn id=syntax-doctype>DOCTYPE</dfn> is a
  49484. required preamble.</p>
  49485. <p class=note>DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a
  49486. different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a
  49487. document ensures that the browser makes a best-effort attempt at following the relevant
  49488. specifications.</p>
  49489. <p>A DOCTYPE must consist of the following components, in this order:</p>
  49490. <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>&lt;!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>
  49491. <p class=note>In other words, <code>&lt;!DOCTYPE html></code>, case-insensitively.</p>
  49492. <hr>
  49493. <p>For the purposes of HTML generators that cannot output HTML markup with the short DOCTYPE
  49494. "<code>&lt;!DOCTYPE html></code>", a <dfn id=doctype-legacy-string>DOCTYPE legacy string</dfn> may be inserted
  49495. into the DOCTYPE (in the position defined above). This string must consist of:</p>
  49496. <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>
  49497. <p class=note>In other words, <code>&lt;!DOCTYPE html SYSTEM "about:legacy-compat"></code> or
  49498. <code>&lt;!DOCTYPE html SYSTEM 'about:legacy-compat'></code>, case-insensitively except for the
  49499. part in single or double quotes.</p>
  49500. <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
  49501. a system that cannot output the shorter string.</p>
  49502. <hr>
  49503. <p>To help authors transition from HTML4 and XHTML1, an <dfn id=obsolete-permitted-doctype-string>obsolete permitted DOCTYPE
  49504. string</dfn> can be inserted into the DOCTYPE (in the position defined above). This string must
  49505. consist of:</p>
  49506. <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>
  49507. <table><caption>
  49508. 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>.
  49509. </caption><thead><tr><th> Public identifier
  49510. <th> System identifier
  49511. <tbody><tr><td> <code>-//W3C//DTD HTML 4.0//EN</code>
  49512. <td>
  49513. <tr><td> <code>-//W3C//DTD HTML 4.0//EN</code>
  49514. <td> <code>http://www.w3.org/TR/REC-html40/strict.dtd</code>
  49515. <tr><td> <code>-//W3C//DTD HTML 4.01//EN</code>
  49516. <td>
  49517. <tr><td> <code>-//W3C//DTD HTML 4.01//EN</code>
  49518. <td> <code>http://www.w3.org/TR/html4/strict.dtd</code>
  49519. <tr><td> <code>-//W3C//DTD XHTML 1.0 Strict//EN</code>
  49520. <td> <code>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>
  49521. <tr><td> <code>-//W3C//DTD XHTML 1.1//EN</code>
  49522. <td> <code>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>
  49523. </table>
  49524. <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
  49525. 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
  49526. long.</p>
  49527. <h4 id=elements-2>12.1.2 Elements</h4>
  49528. <p>There are five different kinds of <dfn id=syntax-elements>elements</dfn>: <a href=#void-elements id=elements-2:void-elements>void
  49529. 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>,
  49530. <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>
  49531. <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>,
  49532. <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>,
  49533. <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>,
  49534. <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>
  49535. <p><dfn id=syntax-tags>Tags</dfn> are used to delimit the start and end of elements in the
  49536. 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
  49537. 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
  49538. 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
  49539. described below in the section on <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-2>optional tags</a>. Those
  49540. 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
  49541. 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
  49542. either have a start tag and an end tag, or a start tag that is marked as self-closing, in which
  49543. case they must not have an end tag.</p>
  49544. <p>The <a href=#concept-html-contents id=elements-2:concept-html-contents>contents</a> of the element must be placed between
  49545. just after the start tag (which <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-3>might be implied, in certain
  49546. cases</a>) and just before the end tag (which again, <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-4>might be
  49547. implied in certain cases</a>). The exact allowed contents of each individual element depend on
  49548. the <a href=#content-models id=elements-2:content-models>content model</a> of that element, as described earlier in
  49549. this specification. Elements must not contain content that their content model disallows. In
  49550. addition to the restrictions placed on the contents by those content models, however, the five
  49551. types of elements have additional <em>syntactic</em> requirements.</p>
  49552. <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
  49553. put between the start tag and the end tag).</p>
  49554. <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>
  49555. <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
  49556. <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>
  49557. <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
  49558. (since, again, as there's no end tag, no content can be put between the start tag and the end
  49559. 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
  49560. have <a href=#syntax-text id=elements-2:syntax-text-3>text</a>, <a href=#syntax-charref id=elements-2:syntax-charref-2>character
  49561. 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
  49562. the text must not contain the character U+003C LESS-THAN SIGN (&lt;) or an <a href=#syntax-ambiguous-ampersand id=elements-2:syntax-ambiguous-ampersand-2>ambiguous ampersand</a>.</p>
  49563. <div class=note>
  49564. <p>The HTML syntax does not support namespace declarations, even in <a href=#foreign-elements id=elements-2:foreign-elements-5>foreign
  49565. elements</a>.</p>
  49566. <p>For instance, consider the following HTML fragment:</p>
  49567. <pre>&lt;p>
  49568. &lt;svg>
  49569. &lt;metadata>
  49570. &lt;!-- this is invalid -->
  49571. &lt;cdr:license xmlns:cdr="http://www.example.com/cdr/metadata" name="MIT"/>
  49572. &lt;/metadata>
  49573. &lt;/svg>
  49574. &lt;/p></pre>
  49575. <p>The innermost element, <code>cdr:license</code>, is actually in the SVG namespace, as
  49576. the "<code>xmlns:cdr</code>" attribute has no effect (unlike in XML). In fact, as the
  49577. comment in the fragment above says, the fragment is actually non-conforming. This is because the
  49578. SVG specification does not define any elements called "<code>cdr:license</code>" in the
  49579. SVG namespace.</p>
  49580. </div>
  49581. <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
  49582. the text must not contain the character U+003C LESS-THAN SIGN (&lt;) 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>
  49583. also have <a href=#element-restrictions>yet more restrictions</a> on what content they are
  49584. allowed to hold, beyond the restrictions imposed by the content model and those described in this
  49585. paragraph. Those restrictions are described below.</p>
  49586. <p>Tags contain a <dfn id=syntax-tag-name>tag name</dfn>, giving the element's name. HTML
  49587. 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
  49588. 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
  49589. lower- and uppercase letters that, when converted to all-lowercase, matches the element's tag
  49590. name; tag names are case-insensitive.</p>
  49591. <h5 id=start-tags>12.1.2.1 Start tags</h5>
  49592. <p><dfn id=syntax-start-tag>Start tags</dfn> must have the following format:</p>
  49593. <ol><li>The first character of a start tag must be a U+003C LESS-THAN SIGN character (&lt;).<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
  49594. separated from each other by one or more <a href=#space-character id=start-tags:space-character-2>space
  49595. 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
  49596. no attributes, there may be one or more <a href=#space-character id=start-tags:space-character-3>space characters</a>.
  49597. (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
  49598. 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
  49599. 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>
  49600. <h5 id=end-tags>12.1.2.2 End tags</h5>
  49601. <p><dfn id=syntax-end-tag>End tags</dfn> must have the following format:</p>
  49602. <ol><li>The first character of an end tag must be a U+003C LESS-THAN SIGN character (&lt;).<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
  49603. name</a>.<li>After the tag name, there may be one or more <a href=#space-character id=end-tags:space-character>space
  49604. characters</a>.<li>Finally, end tags must be closed by a U+003E GREATER-THAN SIGN character (>).</ol>
  49605. <h5 id=attributes-2>12.1.2.3 Attributes</h5>
  49606. <p><dfn id=syntax-attributes>Attributes</dfn> for an element are expressed inside the
  49607. element's start tag.</p>
  49608. <p>Attributes have a name and a value. <dfn id=syntax-attribute-name>Attribute names</dfn>
  49609. must consist of one or more characters other than the <a href=#space-character id=attributes-2:space-character>space
  49610. characters</a>, U+0000 NULL, U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+003E
  49611. GREATER-THAN SIGN (>), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) characters, the <a href=#control-characters id=attributes-2:control-characters>control
  49612. characters</a>, and any characters that are not defined by Unicode. In the HTML syntax, attribute
  49613. 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
  49614. 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
  49615. name.</p>
  49616. <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>,
  49617. 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>
  49618. <p>Attributes can be specified in four different ways:</p>
  49619. <dl><dt>Empty attribute syntax<dd>
  49620. <p>Just the <a href=#syntax-attribute-name id=attributes-2:syntax-attribute-name>attribute name</a>. The value is implicitly
  49621. the empty string.</p>
  49622. <div class=example>
  49623. <p>In the following example, the <code id=attributes-2:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is
  49624. given with the empty attribute syntax:</p>
  49625. <pre>&lt;input <em>disabled</em>></pre>
  49626. </div>
  49627. <p>If an attribute using the empty attribute syntax is to be followed by another attribute, then
  49628. there must be a <a href=#space-character id=attributes-2:space-character-2>space character</a> separating the two.</p>
  49629. <dt id=unquoted>Unquoted attribute value syntax<dd>
  49630. <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
  49631. character, followed by zero or more <a href=#space-character id=attributes-2:space-character-4>space characters</a>,
  49632. followed by the <a href=#syntax-attribute-value id=attributes-2:syntax-attribute-value>attribute value</a>, which, in addition
  49633. 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 ("),
  49634. U+0027 APOSTROPHE characters ('), U+003D EQUALS SIGN characters (=), U+003C LESS-THAN SIGN
  49635. characters (&lt;), U+003E GREATER-THAN SIGN characters (>), or U+0060 GRAVE ACCENT characters
  49636. (`), and must not be the empty string.</p>
  49637. <div class=example>
  49638. <p>In the following example, the <code id=attributes-2:attr-input-value><a href=#attr-input-value>value</a></code> attribute is given
  49639. with the unquoted attribute value syntax:</p>
  49640. <pre>&lt;input <em>value=yes</em>></pre>
  49641. </div>
  49642. <p>If an attribute using the unquoted attribute syntax is to be followed by another attribute or
  49643. 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
  49644. character</a> separating the two.</p>
  49645. <dt>Single-quoted attribute value syntax<dd>
  49646. <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
  49647. character, followed by zero or more <a href=#space-character id=attributes-2:space-character-8>space characters</a>,
  49648. 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
  49649. given above for attribute values, must not contain any literal U+0027 APOSTROPHE characters ('),
  49650. and finally followed by a second single U+0027 APOSTROPHE character (').</p>
  49651. <div class=example>
  49652. <p>In the following example, the <code id=attributes-2:attr-input-type><a href=#attr-input-type>type</a></code> attribute is given
  49653. with the single-quoted attribute value syntax:</p>
  49654. <pre>&lt;input <em>type='checkbox'</em>></pre>
  49655. </div>
  49656. <p>If an attribute using the single-quoted attribute syntax is to be followed by another
  49657. attribute, then there must be a <a href=#space-character id=attributes-2:space-character-9>space character</a> separating the two.</p>
  49658. <dt>Double-quoted attribute value syntax<dd>
  49659. <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
  49660. character, followed by zero or more <a href=#space-character id=attributes-2:space-character-11>space characters</a>,
  49661. 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
  49662. given above for attribute values, must not contain any literal U+0022 QUOTATION MARK characters
  49663. ("), and finally followed by a second single U+0022 QUOTATION MARK character (").</p>
  49664. <div class=example>
  49665. <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
  49666. the double-quoted attribute value syntax:</p>
  49667. <pre>&lt;input <em>name="be evil"</em>></pre>
  49668. </div>
  49669. <p>If an attribute using the double-quoted attribute syntax is to be followed by another
  49670. attribute, then there must be a <a href=#space-character id=attributes-2:space-character-12>space character</a> separating the two.</p>
  49671. </dl>
  49672. <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
  49673. case-insensitive</a> match for each other.</p>
  49674. <hr>
  49675. <p>When a <a href=#foreign-elements id=attributes-2:foreign-elements-2>foreign element</a> has one of the namespaced
  49676. attributes given by the local name and namespace of the first and second cells of a row from the
  49677. following table, it must be written using the name given by the third cell from the same row.</p>
  49678. <table><thead><tr><th> Local name <th> Namespace <th> Attribute name
  49679. <tbody><tr><td> <code>actuate</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace>XLink namespace</a> <td> <code>xlink:actuate</code>
  49680. <tr><td> <code>arcrole</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-2>XLink namespace</a> <td> <code>xlink:arcrole</code>
  49681. <tr><td> <code>href</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-3>XLink namespace</a> <td> <code>xlink:href</code>
  49682. <tr><td> <code>role</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-4>XLink namespace</a> <td> <code>xlink:role</code>
  49683. <tr><td> <code>show</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-5>XLink namespace</a> <td> <code>xlink:show</code>
  49684. <tr><td> <code>title</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-6>XLink namespace</a> <td> <code>xlink:title</code>
  49685. <tr><td> <code>type</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-7>XLink namespace</a> <td> <code>xlink:type</code>
  49686. <tr><td> <code>base</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace>XML namespace</a> <td> <code>xml:base</code>
  49687. <tr><td> <code>lang</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace-2>XML namespace</a> <td> <code>xml:lang</code>
  49688. <tr><td> <code>space</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace-3>XML namespace</a> <td> <code>xml:space</code>
  49689. <tr><td> <code>xmlns</code> <td> <a href=#xmlns-namespace id=attributes-2:xmlns-namespace>XMLNS namespace</a> <td> <code>xmlns</code>
  49690. <tr><td> <code>xlink</code> <td> <a href=#xmlns-namespace id=attributes-2:xmlns-namespace-2>XMLNS namespace</a> <td> <code>xmlns:xlink</code>
  49691. </table>
  49692. <p>No other namespaced attribute can be expressed in <a href=#syntax id=attributes-2:syntax>the HTML syntax</a>.</p>
  49693. <p class=note>Whether the attributes in the table above are conforming or not is defined by
  49694. other specifications (e.g. the SVG and MathML specifications); this section only describes the
  49695. syntax rules if the attributes are serialised using the HTML syntax.</p>
  49696. <h5 id=optional-tags>12.1.2.4 Optional tags</h5>
  49697. <p>Certain tags can be <dfn id=syntax-tag-omission>omitted</dfn>.</p>
  49698. <p class=note>Omitting an element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag>start tag</a> in the
  49699. situations described below does not mean the element is not present; it is implied, but it is
  49700. 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
  49701. the string <code>&lt;html></code> doesn't appear anywhere in the markup.</p>
  49702. <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
  49703. 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>
  49704. <div class=example>
  49705. <p>For example, in the following case it's ok to remove the "<code>&lt;html></code>"
  49706. tag:</p>
  49707. <pre>&lt;!DOCTYPE HTML>
  49708. <strong>&lt;html></strong>
  49709. &lt;head>
  49710. &lt;title>Hello&lt;/title>
  49711. &lt;/head>
  49712. &lt;body>
  49713. &lt;p>Welcome to this example.&lt;/p>
  49714. &lt;/body>
  49715. &lt;/html></pre>
  49716. <p>Doing so would make the document look like this:</p>
  49717. <pre>&lt;!DOCTYPE HTML>
  49718. &lt;head>
  49719. &lt;title>Hello&lt;/title>
  49720. &lt;/head>
  49721. &lt;body>
  49722. &lt;p>Welcome to this example.&lt;/p>
  49723. &lt;/body>
  49724. &lt;/html></pre>
  49725. <p>This has the exact same DOM. In particular, note that white space around the root element is
  49726. ignored by the parser. The following example would also have the exact same DOM:</p>
  49727. <pre>&lt;!DOCTYPE HTML>&lt;head>
  49728. &lt;title>Hello&lt;/title>
  49729. &lt;/head>
  49730. &lt;body>
  49731. &lt;p>Welcome to this example.&lt;/p>
  49732. &lt;/body>
  49733. &lt;/html></pre>
  49734. <p>However, in the following example, removing the start tag moves the comment to before the
  49735. <code id=optional-tags:the-html-element-4><a href=#the-html-element>html</a></code> element:</p>
  49736. <pre>&lt;!DOCTYPE HTML>
  49737. &lt;html>
  49738. <strong>&lt;!-- where is this comment in the DOM? --></strong>
  49739. &lt;head>
  49740. &lt;title>Hello&lt;/title>
  49741. &lt;/head>
  49742. &lt;body>
  49743. &lt;p>Welcome to this example.&lt;/p>
  49744. &lt;/body>
  49745. &lt;/html></pre>
  49746. <p>With the tag removed, the document actually turns into the same as this:</p>
  49747. <pre>&lt;!DOCTYPE HTML>
  49748. &lt;!-- where is this comment in the DOM? -->
  49749. <small>&lt;html></small>
  49750. &lt;head>
  49751. &lt;title>Hello&lt;/title>
  49752. &lt;/head>
  49753. &lt;body>
  49754. &lt;p>Welcome to this example.&lt;/p>
  49755. &lt;/body>
  49756. &lt;/html></pre>
  49757. <p>This is why the tag can only be removed if it is not followed by a comment: removing the tag
  49758. when there is a comment there changes the document's resulting parse tree. Of course, if the
  49759. position of the comment does not matter, then the tag can be omitted, as if the comment had been
  49760. moved to before the start tag in the first place.</p>
  49761. </div>
  49762. <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
  49763. 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>
  49764. <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
  49765. 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
  49766. element.</p>
  49767. <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
  49768. <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>
  49769. <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
  49770. 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
  49771. <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
  49772. 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>,
  49773. <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>
  49774. <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
  49775. <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>
  49776. <div class=example>
  49777. <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
  49778. <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
  49779. space:</p>
  49780. <pre>&lt;!DOCTYPE HTML>
  49781. &lt;html><strong>
  49782. </strong>&lt;head><strong>
  49783. </strong>&lt;title>Hello&lt;/title><strong>
  49784. </strong>&lt;/head><strong>
  49785. </strong>&lt;body><strong>
  49786. </strong>&lt;p>Welcome to this example.&lt;/p>
  49787. &lt;/body>
  49788. &lt;/html></pre>
  49789. <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
  49790. 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>
  49791. <p>Usually, however, white space isn't an issue. If we first remove the white space we don't care
  49792. about:</p>
  49793. <pre>&lt;!DOCTYPE HTML>&lt;html>&lt;head>&lt;title>Hello&lt;/title>&lt;/head>&lt;body>&lt;p>Welcome to this example.&lt;/p>&lt;/body>&lt;/html></pre>
  49794. <p>Then we can omit a number of tags without affecting the DOM:</p>
  49795. <pre>&lt;!DOCTYPE HTML>&lt;title>Hello&lt;/title>&lt;p>Welcome to this example.&lt;/p></pre>
  49796. <p>At that point, we can also add some white space back:</p>
  49797. <pre>&lt;!DOCTYPE HTML>
  49798. &lt;title>Hello&lt;/title>
  49799. &lt;p>Welcome to this example.&lt;/p></pre>
  49800. <p>This would be equivalent to this document, with the omitted tags shown in their
  49801. parser-implied positions; the only white space text node that results from this is the newline at
  49802. the end of the <code id=optional-tags:the-head-element-6><a href=#the-head-element>head</a></code> element:</p>
  49803. <pre>&lt;!DOCTYPE HTML>
  49804. <small>&lt;html>&lt;head></small>&lt;title>Hello&lt;/title>
  49805. <small>&lt;/head>&lt;body></small>&lt;p>Welcome to this example.&lt;/p><small>&lt;/body>&lt;/html></small></pre>
  49806. </div>
  49807. <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
  49808. <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
  49809. no more content in the parent element.</p>
  49810. <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
  49811. <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
  49812. <code id=optional-tags:the-dd-element><a href=#the-dd-element>dd</a></code> element.</p>
  49813. <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
  49814. <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
  49815. <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>
  49816. <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
  49817. <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>,
  49818. <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>,
  49819. <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>,
  49820. <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>,
  49821. <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>,
  49822. <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
  49823. <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
  49824. element is not an <code id=optional-tags:the-a-element><a href=#the-a-element>a</a></code> element.</p>
  49825. <div class=example>
  49826. <p>We can thus simplify the earlier example further:
  49827. <pre>&lt;!DOCTYPE HTML>&lt;title>Hello&lt;/title>&lt;p>Welcome to this example.<small>&lt;/p></small></pre>
  49828. </div>
  49829. <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
  49830. <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,
  49831. or if there is no more content in the parent element.</p>
  49832. <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
  49833. <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,
  49834. or if there is no more content in the parent element.</p>
  49835. <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
  49836. if the <code id=optional-tags:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element is
  49837. 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
  49838. the parent element.</p>
  49839. <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
  49840. 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
  49841. 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
  49842. in the parent element.</p>
  49843. <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
  49844. 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,
  49845. 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
  49846. <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
  49847. is empty.)</p>
  49848. <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
  49849. 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
  49850. a <a href=#syntax-comments id=optional-tags:syntax-comments-6>comment</a>.</p>
  49851. <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
  49852. 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
  49853. a <a href=#syntax-comments id=optional-tags:syntax-comments-7>comment</a>.</p>
  49854. <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
  49855. 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
  49856. <code id=optional-tags:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element.</p>
  49857. <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
  49858. 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
  49859. 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
  49860. <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
  49861. can't be omitted if the element is empty.)</p>
  49862. <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
  49863. 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
  49864. <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>
  49865. <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
  49866. 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
  49867. there is no more content in the parent element.</p>
  49868. <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
  49869. <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
  49870. no more content in the parent element.</p>
  49871. <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
  49872. <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,
  49873. or if there is no more content in the parent element.</p>
  49874. <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
  49875. <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,
  49876. or if there is no more content in the parent element.</p>
  49877. <div class=example>
  49878. <p>The ability to omit all these table-related tags makes table markup much terser.</p>
  49879. <p>Take this example:</p>
  49880. <pre>&lt;table>
  49881. &lt;caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)&lt;/caption>
  49882. &lt;colgroup>&lt;col>&lt;col>&lt;col>&lt;/colgroup>
  49883. &lt;thead>
  49884. &lt;tr>
  49885. &lt;th>Function&lt;/th>
  49886. &lt;th>Control Unit&lt;/th>
  49887. &lt;th>Central Station&lt;/th>
  49888. &lt;/tr>
  49889. &lt;/thead>
  49890. &lt;tbody>
  49891. &lt;tr>
  49892. &lt;td>Headlights&lt;/td>
  49893. &lt;td>✔&lt;/td>
  49894. &lt;td>✔&lt;/td>
  49895. &lt;/tr>
  49896. &lt;tr>
  49897. &lt;td>Interior Lights&lt;/td>
  49898. &lt;td>✔&lt;/td>
  49899. &lt;td>✔&lt;/td>
  49900. &lt;/tr>
  49901. &lt;tr>
  49902. &lt;td>Electric locomotive operating sounds&lt;/td>
  49903. &lt;td>✔&lt;/td>
  49904. &lt;td>✔&lt;/td>
  49905. &lt;/tr>
  49906. &lt;tr>
  49907. &lt;td>Engineer's cab lighting&lt;/td>
  49908. &lt;td>&lt;/td>
  49909. &lt;td>✔&lt;/td>
  49910. &lt;/tr>
  49911. &lt;tr>
  49912. &lt;td>Station Announcements - Swiss&lt;/td>
  49913. &lt;td>&lt;/td>
  49914. &lt;td>✔&lt;/td>
  49915. &lt;/tr>
  49916. &lt;/tbody>
  49917. &lt;/table></pre>
  49918. <p>The exact same table, modulo some white space differences, could be marked up as follows:</p>
  49919. <pre>&lt;table>
  49920. &lt;caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)
  49921. &lt;colgroup>&lt;col>&lt;col>&lt;col>
  49922. &lt;thead>
  49923. &lt;tr>
  49924. &lt;th>Function
  49925. &lt;th>Control Unit
  49926. &lt;th>Central Station
  49927. &lt;tbody>
  49928. &lt;tr>
  49929. &lt;td>Headlights
  49930. &lt;td>✔
  49931. &lt;td>✔
  49932. &lt;tr>
  49933. &lt;td>Interior Lights
  49934. &lt;td>✔
  49935. &lt;td>✔
  49936. &lt;tr>
  49937. &lt;td>Electric locomotive operating sounds
  49938. &lt;td>✔
  49939. &lt;td>✔
  49940. &lt;tr>
  49941. &lt;td>Engineer's cab lighting
  49942. &lt;td>
  49943. &lt;td>✔
  49944. &lt;tr>
  49945. &lt;td>Station Announcements - Swiss
  49946. &lt;td>
  49947. &lt;td>✔
  49948. &lt;/table></pre>
  49949. <p>Since the cells take up much less room this way, this can be made even terser by having each
  49950. row on one line:</p>
  49951. <pre>&lt;table>
  49952. &lt;caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)
  49953. &lt;colgroup>&lt;col>&lt;col>&lt;col>
  49954. &lt;thead>
  49955. &lt;tr> &lt;th>Function &lt;th>Control Unit &lt;th>Central Station
  49956. &lt;tbody>
  49957. &lt;tr> &lt;td>Headlights &lt;td>✔ &lt;td>✔
  49958. &lt;tr> &lt;td>Interior Lights &lt;td>✔ &lt;td>✔
  49959. &lt;tr> &lt;td>Electric locomotive operating sounds &lt;td>✔ &lt;td>✔
  49960. &lt;tr> &lt;td>Engineer's cab lighting &lt;td> &lt;td>✔
  49961. &lt;tr> &lt;td>Station Announcements - Swiss &lt;td> &lt;td>✔
  49962. &lt;/table></pre>
  49963. <p>The only differences between these tables, at the DOM level, is with the precise position of
  49964. the (in any case semantically-neutral) white space.</p>
  49965. </div>
  49966. <p><strong>However</strong>, a <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-7>start tag</a> must never be
  49967. omitted if it has any attributes.</p>
  49968. <div class=example>
  49969. <p>Returning to the earlier example with all the white space removed and then all the optional
  49970. tags removed:</p>
  49971. <pre>&lt;!DOCTYPE HTML>&lt;title>Hello&lt;/title>&lt;p>Welcome to this example.</pre>
  49972. <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>
  49973. <pre>&lt;!DOCTYPE HTML>&lt;html lang="en">&lt;title>Hello&lt;/title>&lt;body class="demo">&lt;p>Welcome to this example.</pre>
  49974. </div>
  49975. <p class=note>This section assumes that the document is conforming, in particular, that there
  49976. are no <a href=#content-models id=optional-tags:content-models>content model</a> violations. Omitting tags in the fashion
  49977. 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>
  49978. described in this specification is likely to result in unexpected DOM differences (this is, in
  49979. part, what the content models are designed to avoid).</p>
  49980. <h5 id=element-restrictions>12.1.2.5 Restrictions on content models</h5>
  49981. <p>For historical reasons, certain elements have extra restrictions beyond even the restrictions
  49982. given by their content model.</p>
  49983. <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
  49984. 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
  49985. 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
  49986. <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
  49987. it.)</p>
  49988. <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.
  49989. 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
  49990. themselves start with a <a href=#syntax-newlines id=element-restrictions:syntax-newlines-3>newline</a> (because otherwise the
  49991. leading newline in the contents would be treated like the optional newline, and ignored).</p>
  49992. <div class=example>
  49993. <p>The following two <code id=element-restrictions:the-pre-element-2><a href=#the-pre-element>pre</a></code> blocks are equivalent:</p>
  49994. <pre>&lt;pre>Hello&lt;/pre></pre>
  49995. <pre>&lt;pre><br>Hello&lt;/pre></pre>
  49996. </div>
  49997. <h5 id=cdata-rcdata-restrictions>12.1.2.6 Restrictions on the contents of raw text and escapable raw text elements</h5>
  49998. <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
  49999. elements</a> must not contain any occurrences of the string "<code>&lt;/</code>"
  50000. (U+003C LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that case-insensitively match the
  50001. tag name of the element followed by one of U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
  50002. (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, U+003E GREATER-THAN SIGN
  50003. (>), or U+002F SOLIDUS (/).</p>
  50004. <h4 id=text-2>12.1.3 Text</h4>
  50005. <p><dfn id=syntax-text>Text</dfn> is allowed inside elements, attribute values, and comments.
  50006. Extra constraints are placed on what is and what is not allowed in text based on where the text is
  50007. to be put, as described in the other sections.</p>
  50008. <h5 id=newlines>12.1.3.1 Newlines</h5>
  50009. <p><dfn id=syntax-newlines>Newlines</dfn> in HTML may be represented either as U+000D
  50010. CARRIAGE RETURN (CR) characters, U+000A LINE FEED (LF) characters, or pairs of U+000D CARRIAGE
  50011. RETURN (CR), U+000A LINE FEED (LF) characters in that order.</p>
  50012. <p>Where <a href=#syntax-charref id=newlines:syntax-charref>character references</a> are allowed, a character
  50013. reference of a U+000A LINE FEED (LF) character (but not a U+000D CARRIAGE RETURN (CR) character)
  50014. also represents a <a href=#syntax-newlines id=newlines:syntax-newlines>newline</a>.</p>
  50015. <h4 id=character-references>12.1.4 Character references</h4>
  50016. <p>In certain cases described in other sections, <a href=#syntax-text id=character-references:syntax-text>text</a> may be
  50017. mixed with <dfn id=syntax-charref>character references</dfn>. These can be used to escape
  50018. characters that couldn't otherwise legally be included in <a href=#syntax-text id=character-references:syntax-text-2>text</a>.</p>
  50019. <p>Character references must start with a U+0026 AMPERSAND character (&amp;). Following this,
  50020. there are three possible kinds of character references:</p>
  50021. <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
  50022. references</a> section, using the same case. The name must be one that is
  50023. 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
  50024. <a href=#ascii-digits id=character-references:ascii-digits>ASCII digits</a>, representing a base-ten integer that corresponds to a Unicode code
  50025. point that is allowed according to the definition below. The digits must then be followed by a
  50026. 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
  50027. by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X
  50028. 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>,
  50029. representing a hexadecimal integer that corresponds to a Unicode code point that is allowed
  50030. according to the definition below. The digits must then be followed by a U+003B SEMICOLON
  50031. character (;).</dl>
  50032. <p>The numeric character reference forms described above are allowed to reference any Unicode code
  50033. point other than U+0000, U+000D, permanently undefined Unicode characters (noncharacters),
  50034. 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>
  50035. <p>An <dfn id=syntax-ambiguous-ampersand>ambiguous ampersand</dfn> is a U+0026 AMPERSAND
  50036. character (&amp;) that is followed by one or more <a href=#alphanumeric-ascii-characters id=character-references:alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
  50037. followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names
  50038. given in the <a href=#named-character-references id=character-references:named-character-references-2>named character references</a> section.</p>
  50039. <h4 id=cdata-sections>12.1.5 CDATA sections</h4>
  50040. <p><dfn id=syntax-cdata>CDATA sections</dfn> must consist of the following components, in
  50041. this order:</p>
  50042. <ol><li>The string "<code>&lt;![CDATA[</code>".<li>Optionally, <a href=#syntax-text id=cdata-sections:syntax-text>text</a>, with the additional restriction that the
  50043. text must not contain the string "<code>]]></code>".<li>The string "<code>]]></code>".</ol>
  50044. <div class=example>
  50045. <p>CDATA sections can only be used in foreign content (MathML or SVG). In this example, a CDATA
  50046. section is used to escape the contents of an <code id=cdata-sections:math:ms><a href=#math:ms>ms</a></code> element:</p>
  50047. <pre>&lt;p>You can add a string to a number, but this stringifies the number:&lt;/p>
  50048. &lt;math>
  50049. &lt;ms>&lt;![CDATA[x&lt;y]]>&lt;/ms>
  50050. &lt;mo>+&lt;/mo>
  50051. &lt;mn>3&lt;/mn>
  50052. &lt;mo>=&lt;/mo>
  50053. &lt;ms>&lt;![CDATA[x&lt;y3]]>&lt;/ms>
  50054. &lt;/math></pre>
  50055. </div>
  50056. <h4 id=comments>12.1.6 Comments</h4>
  50057. <p><dfn id=syntax-comments>Comments</dfn> must start with the four character sequence U+003C
  50058. LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<code>&lt;!--</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
  50059. a single U+003E GREATER-THAN SIGN character (>), nor start with a U+002D HYPHEN-MINUS character
  50060. (-) followed by a U+003E GREATER-THAN SIGN (>) character, nor contain two consecutive U+002D
  50061. HYPHEN-MINUS characters (<code>--</code>), nor end with a U+002D HYPHEN-MINUS character
  50062. (-). Finally, the comment must be ended by the three character sequence U+002D HYPHEN-MINUS,
  50063. U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN (<code>--></code>).</p>
  50064. <h3 id=parsing>12.2 Parsing HTML documents</h3>
  50065. <p><i>This section only applies to user agents, data mining tools, and conformance
  50066. checkers.</i></p>
  50067. <p class=note>The rules for parsing XML documents into DOM trees are covered by the next
  50068. section, entitled "<a href=#the-xhtml-syntax id=parsing:the-xhtml-syntax>The XHTML syntax</a>".</p>
  50069. <p>User agents must use the parsing rules described in this section to generate the DOM trees from
  50070. <code id=parsing:text/html><a href=#text/html>text/html</a></code> resources. Together, these rules define what is referred to as the
  50071. <dfn id=html-parser>HTML parser</dfn>.</p>
  50072. <div class=note>
  50073. <p>While the HTML syntax described in this specification bears a close resemblance to SGML and
  50074. XML, it is a separate language with its own parsing rules.</p>
  50075. <p>Some earlier versions of HTML (in particular from HTML2 to HTML4) were based on SGML and used
  50076. SGML parsing rules. However, few (if any) web browsers ever implemented true SGML parsing for
  50077. HTML documents; the only user agents to strictly handle HTML as an SGML application have
  50078. historically been validators. The resulting confusion — with validators claiming documents
  50079. to have one representation while widely deployed Web browsers interoperably implemented a
  50080. different representation — has wasted decades of productivity. This version of HTML thus
  50081. returns to a non-SGML basis.</p>
  50082. <p>Authors interested in using SGML tools in their authoring pipeline are encouraged to use XML
  50083. tools and the XML serialisation of HTML.</p>
  50084. </div>
  50085. <p>This specification defines the parsing rules for HTML documents, whether they are syntactically
  50086. 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
  50087. processing rules described throughout this specification), but user agents, while parsing an HTML
  50088. 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
  50089. error</a> that they encounter for which they do not wish to apply the rules described in this
  50090. specification.</p>
  50091. <p>Conformance checkers must report at least one parse error condition to the user if one or more
  50092. parse error conditions exist in the document and must not report parse error conditions if none
  50093. exist in the document. Conformance checkers may report more than one parse error condition if more
  50094. than one parse error condition exists in the document.</p>
  50095. <p class=note>Parse errors are only errors with the <em>syntax</em> of HTML. In addition to
  50096. checking for parse errors, conformance checkers will also verify that the document obeys all the
  50097. other conformance requirements described in this specification.</p>
  50098. <p>For the purposes of conformance checkers, if a resource is determined to be in <a href=#syntax id=parsing:syntax>the HTML
  50099. syntax</a>, then it is an <a href=#html-documents id=parsing:html-documents>HTML document</a>.</p>
  50100. <p class=note>As stated <a href=#html-elements id=parsing:html-elements class=no-backref>in the terminology
  50101. section</a>, references to <a href=#element-type id=parsing:element-type>element types</a> that do not
  50102. explicitly specify a namespace always refer to elements in the <a href=#html-namespace-2 id=parsing:html-namespace-2>HTML namespace</a>. For
  50103. 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
  50104. 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>.
  50105. Where possible, references to such elements are hyperlinked to their definition.</p>
  50106. <h4 id=overview-of-the-parsing-model>12.2.1 Overview of the parsing model</h4>
  50107. <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>
  50108. <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
  50109. 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>
  50110. object.</p>
  50111. <p class=note>Implementations that <a href=#non-scripted>do not support scripting</a> do not
  50112. 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
  50113. still used as the model for the rest of the specification.</p>
  50114. <p>In the common case, the data handled by the tokenization stage comes from the network, but
  50115. <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
  50116. 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>
  50117. <p id=nestedParsing>There is only one set of states for the tokenizer stage and the tree
  50118. construction stage, but the tree construction stage is reentrant, meaning that while the tree
  50119. construction stage is handling one token, the tokenizer might be resumed, causing further tokens
  50120. to be emitted and processed before the first token's processing is complete.</p>
  50121. <div class=example>
  50122. <p>In the following example, the tree construction stage will be called upon to handle a "p"
  50123. start tag token while handling the "script" end tag token:</p>
  50124. <pre>...
  50125. &lt;script>
  50126. document.write('&lt;p>');
  50127. &lt;/script>
  50128. ...</pre>
  50129. </div>
  50130. <p>To handle these cases, parsers have a <dfn id=script-nesting-level>script nesting level</dfn>, which must be initially
  50131. set to zero, and a <dfn id=parser-pause-flag>parser pause flag</dfn>, which must be initially set to false.</p>
  50132. <h4 id=the-input-byte-stream>12.2.2 The <dfn>input byte stream</dfn></h4>
  50133. <p>The stream of Unicode code points that comprises the input to the tokenization stage will be
  50134. initially seen by the user agent as a stream of bytes (typically coming over the network or from
  50135. the local file system). The bytes encode the actual characters according to a particular
  50136. <i>character encoding</i>, which the user agent uses to decode the bytes into characters.</p>
  50137. <p class=note>For XML documents, the algorithm user agents are required to use to determine the
  50138. character encoding is given by the XML specification. This section does not apply to XML
  50139. documents. <a href=#refsXML>[XML]</a></p>
  50140. <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
  50141. character encoding.</p>
  50142. <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
  50143. 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
  50144. for that encoding's <a href=#decoder id=the-input-byte-stream:decoder>decoder</a>.</p>
  50145. <p class=note>Bytes or sequences of bytes in the original byte stream that did not conform to
  50146. the Encoding standard (e.g. invalid UTF-8 byte sequences in a UTF-8 input byte stream) are errors
  50147. that conformance checkers are expected to report. <a href=#refsENCODING>[ENCODING]</a></p>
  50148. <p class=note>Leading Byte Order Marks (BOMs) are not stripped by the decoder algorithms, they
  50149. are stripped by the algorithm below.</p>
  50150. <p class=warning>The decoder algorithms describe how to handle invalid input; for security
  50151. reasons, it is imperative that those rules be followed precisely. Differences in how invalid byte
  50152. sequences are handled can result in, amongst other problems, script injection vulnerabilities
  50153. ("XSS").</p>
  50154. <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>,
  50155. <i>certain</i>, or <i>irrelevant</i>. The encoding used, and whether the confidence in that
  50156. encoding is <i>tentative</i> or <i>certain</i>, is <a href=#meta-charset-during-parse>used
  50157. 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
  50158. necessary, e.g. because the parser is operating on a Unicode stream and doesn't have to use a
  50159. character encoding at all, then the <a href=#concept-encoding-confidence id=the-input-byte-stream:concept-encoding-confidence>confidence</a> is
  50160. <i>irrelevant</i>.</p>
  50161. <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
  50162. 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>
  50163. <h5 id=parsing-with-a-known-character-encoding>12.2.2.1 Parsing with a known character encoding</h5>
  50164. <p>When the HTML parser is to operate on an input byte stream that has <dfn id=a-known-definite-encoding>a known definite
  50165. 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>
  50166. <h5 id=determining-the-character-encoding>12.2.2.2 Determining the character encoding</h5>
  50167. <p>In some cases, it might be impractical to unambiguously determine the encoding before parsing
  50168. the document. Because of this, this specification provides for a two-pass mechanism with an
  50169. optional pre-scan. Implementations are allowed, as described below, to apply a simplified parsing
  50170. algorithm to whatever bytes they have available before beginning to parse the document. Then, the
  50171. real parser is started, using a tentative encoding derived from this pre-parse and other
  50172. out-of-band metadata. If, while the document is being loaded, the user agent discovers a character
  50173. encoding declaration that conflicts with this information, then the parser can get reinvoked to
  50174. perform a parse of the document with the real encoding.</p>
  50175. <p id=documentEncoding>User agents must use the following algorithm, called the <dfn id=encoding-sniffing-algorithm>encoding
  50176. sniffing algorithm</dfn>, to determine the character encoding to use when decoding a document in
  50177. the first pass. This algorithm takes as input any out-of-band metadata available to the user agent
  50178. (e.g. the <a href=#content-type id=determining-the-character-encoding:content-type>Content-Type metadata</a> of the document) and all the
  50179. 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
  50180. <i>certain</i>.</p>
  50181. <ol><li>
  50182. <p>If the user has explicitly instructed the user agent to override the document's character
  50183. 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>
  50184. <p class=note>Typically, user agents remember such user requests across sessions, and in some
  50185. 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>
  50186. <li>
  50187. <p>The user agent may wait for more bytes of the resource to be available, either in this step
  50188. or at any later step in this algorithm. For instance, a user agent might wait 500ms or 1024
  50189. bytes, whichever came first. In general preparsing the source to find the encoding improves
  50190. performance, as it reduces the need to throw away the data structures used when parsing upon
  50191. finding the encoding information. However, if the user agent delays too long to obtain data to
  50192. determine the encoding, then the cost of the delay could outweigh any performance improvements
  50193. from the preparse.</p>
  50194. <p class=note>The authoring conformance requirements for character encoding declarations limit
  50195. them to only appearing <a href=#charset1024>in the first 1024 bytes</a>. User agents are
  50196. therefore encouraged to use the prescan algorithm below (as invoked by these steps) on the first
  50197. 1024 bytes, but not to stall beyond that.</p>
  50198. <li>
  50199. <p>For each of the rows in the following table, starting with the first one and going down, if
  50200. there are as many or more bytes available than the number of bytes in the first column, and the
  50201. first bytes of the file match the bytes given in the first column, then return the encoding
  50202. 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>
  50203. <table><thead><tr><th>Bytes in Hexadecimal
  50204. <th>Encoding
  50205. <tbody><tr><td>FE FF
  50206. <td>Big-endian UTF-16
  50207. <tr><td>FF FE
  50208. <td>Little-endian UTF-16
  50209. <tr><td>EF BB BF
  50210. <td>UTF-8
  50211. </table>
  50212. <p class=note>This step looks for Unicode Byte Order Marks (BOMs).</p>
  50213. <p class=note>That this step happens before the next one honoring the HTTP
  50214. <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,
  50215. motivated by a desire to be maximally compatible with legacy content. <a href=#refsHTTP>[HTTP]</a></p>
  50216. <li><p>If the transport layer specifies a character encoding, and it is supported, return that
  50217. encoding with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-4>confidence</a> <i>certain</i>, and
  50218. abort these steps.<li>
  50219. <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
  50220. stream to determine its encoding</a>. The <var>end condition</var> is that the user
  50221. agent decides that scanning further bytes would not be efficient. User agents are encouraged to
  50222. only prescan the first 1024 bytes. User agents may decide that scanning <em>any</em> bytes is
  50223. not efficient, in which case these substeps are entirely skipped.</p>
  50224. <p>The aforementioned algorithm either aborts unsuccessfully or returns a character encoding. If
  50225. it returns a character encoding, then this algorithm must be aborted, returning the same
  50226. encoding, with <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-5>confidence</a> <i>tentative</i>.</p>
  50227. <li>
  50228. <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
  50229. <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
  50230. substeps:</p>
  50231. <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
  50232. <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
  50233. 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
  50234. <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
  50235. 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
  50236. 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>,
  50237. 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
  50238. <a href=#encoding-sniffing-algorithm id=determining-the-character-encoding:encoding-sniffing-algorithm>encoding sniffing algorithm</a>'s steps.</ol>
  50239. <li><p>Otherwise, if the user agent has information on the likely encoding for this page, e.g.
  50240. based on the encoding of the page when it was last visited, then return that encoding, with the
  50241. <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-7>confidence</a> <i>tentative</i>, and abort these
  50242. steps.<li>
  50243. <p>The user agent may attempt to autodetect the character encoding from applying frequency
  50244. analysis or other algorithms to the data stream. Such algorithms may use information about the
  50245. resource other than the resource's contents, including the address of the resource. If
  50246. autodetection succeeds in determining a character encoding, and that encoding is a supported
  50247. 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.
  50248. <a href=#refsUNIVCHARDET>[UNIVCHARDET]</a></p>
  50249. <p class=note>User agents are generally discouraged from attempting to autodetect encodings
  50250. for resources obtained over the network, since doing so involves inherently non-interoperable
  50251. heuristics. Attempting to detect encodings based on an HTML document's preamble is especially
  50252. tricky since HTML markup typically uses only ASCII characters, and HTML documents tend to begin
  50253. with a lot of markup rather than with text content.</p>
  50254. <p class=note>The UTF-8 encoding has a highly detectable bit pattern. Files from the local
  50255. file system that contain bytes with values greater than 0x7F which match the UTF-8 pattern are
  50256. very likely to be UTF-8, while documents with byte sequences that do not match it are very
  50257. likely not. When a user agent can examine the whole file, rather than just the preamble,
  50258. detecting for UTF-8 specifically can be especially effective. <a href=#refsPPUTF8>[PPUTF8]</a> <a href=#refsUTF8DET>[UTF8DET]</a></p>
  50259. <li>
  50260. <p>Otherwise, return an implementation-defined or user-specified default character encoding,
  50261. with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-9>confidence</a> <i>tentative</i>.</p>
  50262. <p>In controlled environments or in environments where the encoding of documents can be
  50263. prescribed (for example, for user agents intended for dedicated use in new networks), the
  50264. comprehensive <code>UTF-8</code> encoding is suggested.</p>
  50265. <p>In other environments, the default encoding is typically dependent on the user's locale (an
  50266. approximation of the languages, and thus often encodings, of the pages that the user is likely
  50267. to frequent). The following table gives suggested defaults based on the user's locale, for
  50268. compatibility with legacy content. Locales are identified by BCP 47 language tags. <a href=#refsBCP47>[BCP47]</a> <a href=#refsENCODING>[ENCODING]</a></p>
  50269. <table><thead><tr><th colspan=2>Locale language
  50270. <th>Suggested default encoding
  50271. <tbody><tr><td>ar
  50272. <td>Arabic
  50273. <td>windows-1256
  50274. <tr><td>ba
  50275. <td>Bashkir
  50276. <td>windows-1251
  50277. <tr><td>be
  50278. <td>Belarusian
  50279. <td>windows-1251
  50280. <tr><td>bg
  50281. <td>Bulgarian
  50282. <td>windows-1251
  50283. <tr><td>cs
  50284. <td>Czech
  50285. <td>windows-1250
  50286. <tr><td>el
  50287. <td>Greek
  50288. <td>ISO-8859-7
  50289. <tr><td>et
  50290. <td>Estonian
  50291. <td>windows-1257
  50292. <tr><td>fa
  50293. <td>Persian
  50294. <td>windows-1256
  50295. <tr><td>he
  50296. <td>Hebrew
  50297. <td>windows-1255
  50298. <tr><td>hr
  50299. <td>Croatian
  50300. <td>windows-1250
  50301. <tr><td>hu
  50302. <td>Hungarian
  50303. <td>ISO-8859-2
  50304. <tr><td>ja
  50305. <td>Japanese
  50306. <td>Shift_JIS
  50307. <tr><td>kk
  50308. <td>Kazakh
  50309. <td>windows-1251
  50310. <tr><td>ko
  50311. <td>Korean
  50312. <td>euc-kr
  50313. <tr><td>ku
  50314. <td>Kurdish
  50315. <td>windows-1254
  50316. <tr><td>ky
  50317. <td>Kyrgyz
  50318. <td>windows-1251
  50319. <tr><td>lt
  50320. <td>Lithuanian
  50321. <td>windows-1257
  50322. <tr><td>lv
  50323. <td>Latvian
  50324. <td>windows-1257
  50325. <tr><td>mk
  50326. <td>Macedonian
  50327. <td>windows-1251
  50328. <tr><td>pl
  50329. <td>Polish
  50330. <td>ISO-8859-2
  50331. <tr><td>ru
  50332. <td>Russian
  50333. <td>windows-1251
  50334. <tr><td>sah
  50335. <td>Yakut
  50336. <td>windows-1251
  50337. <tr><td>sk
  50338. <td>Slovak
  50339. <td>windows-1250
  50340. <tr><td>sl
  50341. <td>Slovenian
  50342. <td>ISO-8859-2
  50343. <tr><td>sr
  50344. <td>Serbian
  50345. <td>windows-1251
  50346. <tr><td>tg
  50347. <td>Tajik
  50348. <td>windows-1251
  50349. <tr><td>th
  50350. <td>Thai
  50351. <td>windows-874
  50352. <tr><td>tr
  50353. <td>Turkish
  50354. <td>windows-1254
  50355. <tr><td>tt
  50356. <td>Tatar
  50357. <td>windows-1251
  50358. <tr><td>uk
  50359. <td>Ukrainian
  50360. <td>windows-1251
  50361. <tr><td>vi
  50362. <td>Vietnamese
  50363. <td>windows-1258
  50364. <tr><td>zh-CN
  50365. <td>Chinese (People's Republic of China)
  50366. <td>GB18030
  50367. <tr><td>zh-TW
  50368. <td>Chinese (Taiwan)
  50369. <td>Big5
  50370. <tr><td colspan=2>All other locales
  50371. <td>windows-1252
  50372. </table>
  50373. <p class=tablenote><small>The contents of this table are derived from the intersection of
  50374. Windows, Chrome, and Firefox defaults.</small></p>
  50375. </ol>
  50376. <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
  50377. from this algorithm, at the same time as the user agent uses the returned value to select the
  50378. decoder to use for the input byte stream.</p>
  50379. <hr>
  50380. <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
  50381. encoding</dfn>, given some defined <var>end condition</var>, then it must run the
  50382. following steps. These steps either abort unsuccessfully or return a character encoding. If at any
  50383. 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
  50384. one) the user agent either runs out of bytes (meaning the <var>position</var> pointer
  50385. created in the first step below goes beyond the end of the byte stream obtained so far) or reaches
  50386. 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
  50387. encoding</a> algorithm unsuccessfully.</p>
  50388. <ol><li>
  50389. <p>Let <var>position</var> be a pointer to a byte in the input byte stream, initially
  50390. pointing at the first byte.</p>
  50391. <li>
  50392. <p><i>Loop</i>: If <var>position</var> points to:</p>
  50393. <dl class=switch><dt>A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (ASCII '&lt;!--')<dd>
  50394. <p>Advance the <var>position</var> pointer so that it points at the first 0x3E byte
  50395. which is preceded by two 0x2D bytes (i.e. at the end of an ASCII '-->' sequence) and comes
  50396. after the 0x3C byte that was found. (The two 0x2D bytes can be the same as the those in the
  50397. '&lt;!--' sequence.)</p>
  50398. <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 '&lt;meta' followed by a space or slash)<dd>
  50399. <ol><li><p>Advance the <var>position</var> pointer so that it points at the next 0x09,
  50400. 0x0A, 0x0C, 0x0D, 0x20, or 0x2F byte (the one in sequence of characters matched
  50401. 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
  50402. 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
  50403. attribute</a> and its value. If no attribute was sniffed, then jump to the
  50404. <i>processing</i> step below.<li><p>If the attribute's name is already in <var>attribute list</var>, then return
  50405. to the step labeled <i>attributes</i>.</p>
  50406. <li><p>Add the attribute's name to <var>attribute list</var>.</p>
  50407. <li>
  50408. <p>Run the appropriate step from the following list, if one applies:</p>
  50409. <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
  50410. <code>meta</code> element</a>, giving the attribute's value as the string to parse. If a
  50411. character encoding is returned, and if <var>charset</var> is still set to null,
  50412. let <var>charset</var> be the encoding returned, and set <var>need
  50413. 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>
  50414. from the attribute's value, and set <var>need pragma</var> to false.</dl>
  50415. <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
  50416. below labeled <i>next byte</i>.<li><p>If <var>need pragma</var> is true but <var>got pragma</var> is
  50417. 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
  50418. <var>charset</var> to UTF-8.<li><p>If <var>charset</var> is the x-user-defined encoding, change the value of
  50419. <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
  50420. 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,
  50421. returning the encoding given by <var>charset</var>.</ol>
  50422. <dt>A sequence of bytes starting with a 0x3C byte (ASCII &lt;), optionally a 0x2F byte (ASCII /), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (an ASCII letter)<dd>
  50423. <ol><li><p>Advance the <var>position</var> pointer so that it points at the next 0x09
  50424. (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E
  50425. (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>
  50426. until no further attributes can be found, then jump to the step below labeled <i>next
  50427. byte</i>.</ol>
  50428. <dt>A sequence of bytes starting with: 0x3C 0x21 (ASCII '&lt;!')<dt>A sequence of bytes starting with: 0x3C 0x2F (ASCII '&lt;/')<dt>A sequence of bytes starting with: 0x3C 0x3F (ASCII '&lt;?')<dd>
  50429. <p>Advance the <var>position</var> pointer so that it points at the first 0x3E byte
  50430. (ASCII >) that comes after the 0x3C byte that was found.</p>
  50431. <dt>Any other byte<dd>
  50432. <p>Do nothing with that byte.</p>
  50433. </dl>
  50434. <li><i>Next byte</i>: Move <var>position</var> so it points at the next byte in the
  50435. input byte stream, and return to the step above labeled <i>loop</i>.</ol>
  50436. <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>
  50437. <ol><li><p>If the byte at <var>position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII LF),
  50438. 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
  50439. one.<li><p>Otherwise, the byte at <var>position</var> is the start of the attribute name.
  50440. Let <var>attribute name</var> and <var>attribute value</var> be the empty
  50441. string.<li><p>Process the byte at <var>position</var> as follows:</p>
  50442. <dl class=switch><dt>If it is 0x3D (ASCII =), and the <var>attribute name</var> is longer than the
  50443. empty string<dd>Advance <var>position</var> to the next byte and jump to the step below labeled
  50444. <i>value</i>.<dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20
  50445. (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>
  50446. algorithm. The attribute's name is the value of <var>attribute name</var>, its value
  50447. 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>
  50448. is the value of the byte at <var>position</var>). (This converts the input to
  50449. 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
  50450. bytes outside the ASCII range are handled here, since only ASCII characters can contribute to
  50451. the detection of a character encoding.)</dl>
  50452. <li><p>Advance <var>position</var> to the next byte and return to the previous
  50453. step.<li><p><i>Spaces</i>: If the byte at <var>position</var> is one of 0x09 (ASCII TAB),
  50454. 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
  50455. <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-6>get an attribute</a> algorithm. The
  50456. attribute's name is the value of <var>attribute name</var>, its value is the empty
  50457. 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
  50458. (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>
  50459. <dl class=switch><dt>If it is 0x22 (ASCII ") or 0x27 (ASCII ')<dd>
  50460. <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
  50461. "get an attribute" algorithm. The attribute's name is the value of <var>attribute
  50462. 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
  50463. (ASCII A) to 0x5A (ASCII Z), then append a Unicode character to <var>attribute
  50464. 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
  50465. 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>
  50466. <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>
  50467. algorithm. The attribute's name is the value of <var>attribute name</var>, its value
  50468. 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>
  50469. <li><p>Process the byte at <var>position</var> as
  50470. follows:</p>
  50471. <dl class=switch><dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII
  50472. 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>
  50473. algorithm. The attribute's name is the value of <var>attribute name</var> and its
  50474. 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>
  50475. <li><p>Advance <var>position</var> to the next byte and return to the previous
  50476. step.</ol>
  50477. <p>For the sake of interoperability, user agents should not use a pre-scan algorithm that returns
  50478. different results than the one described above. (But, if you do, please at least let us know, so
  50479. that we can improve this algorithm and benefit everyone...)</p>
  50480. <h5 id=character-encodings>12.2.2.3 Character encodings</h5>
  50481. <p>User agents must support the encodings defined in the WHATWG Encoding standard. User agents
  50482. should not support other encodings.</p>
  50483. <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>
  50484. <p>Support for encodings based on EBCDIC is especially discouraged. This encoding is rarely used
  50485. for publicly-facing Web content. Support for UTF-32 is also especially discouraged. This encoding
  50486. is rarely used, and frequently implemented incorrectly.</p>
  50487. <p class=note>This specification does not make any attempt to support EBCDIC-based encodings and
  50488. UTF-32 in its algorithms; support and use of these encodings can thus lead to unexpected behavior
  50489. in implementations of this specification.</p>
  50490. <h5 id=changing-the-encoding-while-parsing>12.2.2.4 Changing the encoding while parsing</h5>
  50491. <p>When the parser requires the user agent to <dfn id=change-the-encoding>change the encoding</dfn>, it must run the
  50492. 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
  50493. failed to find a character encoding, or if it found a character encoding that was not the actual
  50494. encoding of the file.</p>
  50495. <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
  50496. encoding</a>, then set the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence>confidence</a> to
  50497. <i>certain</i> and abort these steps. The new encoding is ignored; if it was anything but the
  50498. 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
  50499. 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.
  50500. 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
  50501. sniffing algorithm</a> determined to be the encoding, and in the second pass through the
  50502. parser if the first pass found that the encoding sniffing algorithm described in the earlier
  50503. 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
  50504. Unicode interpretations in both the current encoding and the new encoding, and if the user agent
  50505. supports changing the converter on the fly, then the user agent may change to the new converter
  50506. 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
  50507. 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
  50508. steps.<li><p>Otherwise, <a href=#navigate id=changing-the-encoding-while-parsing:navigate>navigate</a> to the document again, with
  50509. <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
  50510. 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
  50511. the new encoding and the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence-4>confidence</a> to
  50512. <i>certain</i>. Whenever possible, this should be done without actually contacting the network
  50513. layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not
  50514. being cacheable. If this is not possible and contacting the network layer would involve repeating
  50515. 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
  50516. 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
  50517. encoding. The resource will be misinterpreted. User agents may notify the user of the situation,
  50518. to aid in application development.</ol>
  50519. <p class=note>This algorithm is only invoked when a new encoding is found declared on a
  50520. <code id=changing-the-encoding-while-parsing:the-meta-element><a href=#the-meta-element>meta</a></code> element.</p>
  50521. <h5 id=preprocessing-the-input-stream>12.2.2.5 Preprocessing the input stream</h5>
  50522. <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
  50523. stream</a> is decoded or from the various APIs that directly manipulate the input stream.</p>
  50524. <p>One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present in the
  50525. <a href=#input-stream id=preprocessing-the-input-stream:input-stream>input stream</a>.</p>
  50526. <p class=note>The requirement to strip a U+FEFF BYTE ORDER MARK character regardless of whether
  50527. 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
  50528. Unicode, motivated by a desire to increase the resilience of user agents in the face of naïve
  50529. transcoders.</p>
  50530. <p>Any occurrences of any characters in the ranges U+0001 to U+0008, U+000E to U+001F,
  50531. U+007F to U+009F, U+FDD0 to U+FDEF, and
  50532. characters U+000B, U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE,
  50533. U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF,
  50534. U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE,
  50535. 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
  50536. <a href=#control-characters id=preprocessing-the-input-stream:control-characters>control characters</a> or permanently undefined Unicode characters (noncharacters).</p>
  50537. <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
  50538. 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
  50539. script APIs such as <code id=preprocessing-the-input-stream:dom-document-write><a href=#dom-document-write>document.write()</a></code>.)</p>
  50540. <p>U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated
  50541. specially. All CR characters must be converted to LF characters, and any LF characters that
  50542. immediately follow a CR character must be ignored. Thus, newlines in HTML DOMs are represented by
  50543. 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>
  50544. stage.</p>
  50545. <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>
  50546. that has not yet been <dfn>consumed</dfn> or explicitly ignored by the requirements in
  50547. 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
  50548. first character in the input. The <dfn id=current-input-character>current input character</dfn> is the last character to have
  50549. been <i>consumed</i>.</p>
  50550. <p>The <dfn id=insertion-point>insertion point</dfn> is the position (just before a character or just before the end
  50551. 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
  50552. relative to the position of the character immediately after it, it is not an absolute offset into
  50553. the input stream. Initially, the insertion point is undefined.</p>
  50554. <p>The "EOF" character in the tables below is a conceptual character representing the end of the
  50555. <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
  50556. 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
  50557. the <code id=preprocessing-the-input-stream:dom-document-close><a href=#dom-document-close>document.close()</a></code> method) is consumed. Otherwise, the
  50558. "EOF" character is not a real character in the stream, but rather the lack of any further
  50559. characters.</p>
  50560. <p class=note>The handling of U+0000 NULL characters varies based on where the characters are
  50561. found. In general, they are ignored except where doing so could plausibly introduce an attack
  50562. vector. This handling is, by necessity, spread across both the tokenization stage and the tree
  50563. construction stage.</p>
  50564. <h4 id=parse-state>12.2.3 Parse state</h4>
  50565. <h5 id=the-insertion-mode>12.2.3.1 The insertion mode</h5>
  50566. <p>The <dfn id=insertion-mode>insertion mode</dfn> is a state variable that controls the primary operation of the
  50567. tree construction stage.</p>
  50568. <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
  50569. 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>",
  50570. "<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
  50571. 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
  50572. 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>",
  50573. "<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
  50574. after body</a>", and "<a href=#the-after-after-frameset-insertion-mode id=the-insertion-mode:the-after-after-frameset-insertion-mode>after after
  50575. frameset</a>" during the course of the parsing, as described in the <a href=#tree-construction id=the-insertion-mode:tree-construction>tree
  50576. construction</a> stage. The insertion mode affects how tokens are processed and whether CDATA
  50577. sections are supported.</p>
  50578. <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
  50579. table</a>", and "<a href=#parsing-main-inselect id=the-insertion-mode:parsing-main-inselect-2>in select</a>", are special, in
  50580. that the other modes defer to them at various times. When the algorithm below says that the user
  50581. agent is to do something "<dfn id=using-the-rules-for>using the rules for</dfn> the <var>m</var> insertion
  50582. mode", where <var>m</var> is one of these modes, the user agent must use the rules
  50583. 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
  50584. the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-3>insertion mode</a> unchanged unless the rules in <var>m</var> themselves
  50585. switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-4>insertion mode</a> to a new value.</p>
  50586. <p>When the insertion mode is switched to "<a href=#parsing-main-incdata id=the-insertion-mode:parsing-main-incdata-2>text</a>" or
  50587. "<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
  50588. mode</dfn> is also set. This is the insertion mode to which the tree construction stage will
  50589. return.</p>
  50590. <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
  50591. modes</dfn> is used. It is initially empty. The <dfn id=current-template-insertion-mode>current template insertion mode</dfn> is the
  50592. 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>.
  50593. The algorithms in the sections below will <i>push</i> insertion modes onto this stack, meaning
  50594. that the specified insertion mode is to be added to the stack, and <i>pop</i> insertion modes from
  50595. the stack, which means that the most recently added insertion mode must be removed from the
  50596. stack.</p>
  50597. <hr>
  50598. <p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion mode appropriately</dfn>, it
  50599. means the UA must follow these steps:</p>
  50600. <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
  50601. elements</a>.<li><p><i>Loop</i>: If <var>node</var> is the first node in the stack of open elements,
  50602. then set <var>last</var> to true, and, if the parser was originally created as part of
  50603. 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>
  50604. element.<li>
  50605. <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>
  50606. <ol><li><p>If <var>last</var> is true, jump to the step below labeled
  50607. <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
  50608. 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
  50609. <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
  50610. 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
  50611. mode</a> to "<a href=#parsing-main-inselectintable id=the-insertion-mode:parsing-main-inselectintable-2>in select in table</a>" and
  50612. 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>
  50613. <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
  50614. mode</a> to "<a href=#parsing-main-intr id=the-insertion-mode:parsing-main-intr-2>in row</a>" and abort these
  50615. 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
  50616. <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
  50617. <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
  50618. 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
  50619. <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
  50620. 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
  50621. <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
  50622. 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
  50623. <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
  50624. 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
  50625. 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
  50626. 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
  50627. <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
  50628. 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
  50629. <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
  50630. abort these steps. (<a href=#fragment-case id=the-insertion-mode:fragment-case-2>fragment case</a>)<li>
  50631. <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>
  50632. <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
  50633. <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>"
  50634. 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
  50635. <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
  50636. abort these steps.</ol>
  50637. <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
  50638. case</a>)<li><p>Let <var>node</var> now be the node before <var>node</var> in the
  50639. <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>
  50640. <h5 id=the-stack-of-open-elements>12.2.3.2 The stack of open elements</h5>
  50641. <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The stack grows downwards; the
  50642. topmost node on the stack is the first one added to the stack, and the bottommost node of the
  50643. stack is the most recently added node in the stack (notwithstanding when the stack is manipulated
  50644. in a random access fashion as part of <a href=#adoptionAgency>the handling for misnested
  50645. tags</a>).</p>
  50646. <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
  50647. 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>
  50648. <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
  50649. 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
  50650. "<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>
  50651. <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
  50652. gets popped off the stack when the parser <a href=#stop-parsing id=the-stack-of-open-elements:stop-parsing>finishes</a>.</p>
  50653. <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
  50654. elements</a>.</p>
  50655. <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>
  50656. 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
  50657. 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
  50658. node</a> is the <a href=#current-node id=the-stack-of-open-elements:current-node>current node</a>.</p>
  50659. <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>
  50660. <dl><dt><dfn id=special>Special</dfn><dd><p>The following elements have varying levels of special parsing rules: HTML's
  50661. <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>,
  50662. <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>,
  50663. <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>,
  50664. <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>,
  50665. <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>,
  50666. <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>,
  50667. <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>,
  50668. <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>,
  50669. <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>,
  50670. <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>,
  50671. <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>,
  50672. <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>,
  50673. <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>,
  50674. <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>,
  50675. <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>,
  50676. <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>,
  50677. <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>,
  50678. <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>,
  50679. <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>,
  50680. <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>,
  50681. <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
  50682. 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>,
  50683. <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>,
  50684. <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
  50685. <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>
  50686. <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
  50687. list of element types <var>list</var> when the following algorithm terminates in a match
  50688. state:</p>
  50689. <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
  50690. 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
  50691. elements</a> and return to step 2. (This will never fail, since the loop will always terminate
  50692. 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
  50693. reached.)</ol>
  50694. <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
  50695. 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
  50696. that element in the specific scope</a> consisting of the following element types:</p>
  50697. <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>
  50698. <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
  50699. element types:</p>
  50700. <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>
  50701. <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
  50702. types:</p>
  50703. <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>
  50704. <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
  50705. types:</p>
  50706. <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>
  50707. <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
  50708. <em>except</em> the following:</p>
  50709. <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>
  50710. <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>
  50711. 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,
  50712. the stack is not changed in this situation. This can cause, amongst other strange effects, content
  50713. to be appended to nodes that are no longer in the DOM.</p>
  50714. <p class=note>In some cases (namely, when <a href=#adoptionAgency>closing misnested formatting
  50715. elements</a>), the stack is manipulated in a random-access fashion.</p>
  50716. <h5 id=the-list-of-active-formatting-elements>12.2.3.3 The list of active formatting elements</h5>
  50717. <p>Initially, the <dfn id=list-of-active-formatting-elements>list of active formatting elements</dfn> is empty. It is used to handle
  50718. mis-nested <a href=#formatting id=the-list-of-active-formatting-elements:formatting>formatting element tags</a>.</p>
  50719. <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>
  50720. 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
  50721. 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,
  50722. <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>
  50723. <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
  50724. with the token for which it was created, so that further elements can be created for that token if
  50725. necessary.</p>
  50726. <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
  50727. elements</dfn> an element <var>element</var>, the UA must perform the following
  50728. steps:</p>
  50729. <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>
  50730. 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
  50731. 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
  50732. name, namespace, and attributes as <var>element</var>, then remove the earliest such
  50733. 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
  50734. attributes must be compared as they were when the elements were created by the parser; two
  50735. elements have the same attributes if all their parsed attributes can be paired such that the two
  50736. attributes in each pair have identical names, namespaces, and values (the order of the attributes
  50737. does not matter).</p>
  50738. <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
  50739. elements</a>.</ol>
  50740. <p>When the steps below require the UA to <dfn id=reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</dfn>,
  50741. the UA must perform the following steps:</p>
  50742. <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
  50743. 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
  50744. 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
  50745. 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
  50746. 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
  50747. 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
  50748. 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
  50749. 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
  50750. 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
  50751. <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
  50752. elements</a> is not the last entry in the list, return to the step labeled
  50753. <i>advance</i>.</ol>
  50754. <p>This has the effect of reopening all the formatting elements that were opened in the current
  50755. body, cell, or caption (whichever is youngest) that haven't been explicitly closed.</p>
  50756. <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
  50757. elements</a> always consists of elements in chronological order with the least recently added
  50758. element first and the most recently added element last (except for while steps 8 to 11 of the
  50759. above algorithm are being executed, of course).</p>
  50760. <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
  50761. the last marker</dfn>, the UA must perform the following steps:</p>
  50762. <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
  50763. 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
  50764. 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>,
  50765. 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>
  50766. <h5 id=the-element-pointers>12.2.3.4 The element pointers</h5>
  50767. <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>
  50768. <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
  50769. <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>
  50770. <p>The <a href=#form-element-pointer id=the-element-pointers:form-element-pointer><code>form</code> element pointer</a> points to the last
  50771. <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
  50772. make form controls associate with forms in the face of dramatically bad markup, for historical
  50773. reasons. It is ignored inside <code id=the-element-pointers:the-template-element><a href=#the-template-element>template</a></code> elements.</p>
  50774. <h5 id=other-parsing-state-flags>12.2.3.5 Other parsing state flags</h5>
  50775. <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
  50776. 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
  50777. parser was created, and "disabled" otherwise.</p>
  50778. <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
  50779. 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>
  50780. elements don't execute in that case.</p>
  50781. <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
  50782. ok" after certain tokens are seen.</p>
  50783. <h4 id=tokenization>12.2.4 <dfn>Tokenization</dfn></h4>
  50784. <p>Implementations must act as if they used the following state machine to tokenise HTML. The
  50785. state machine must start in the <a href=#data-state id=tokenization:data-state>data state</a>. Most states consume a single character,
  50786. which may have various side-effects, and either switches the state machine to a new state to
  50787. <i>reconsume</i> the same character, or switches it to a new state to consume the next character,
  50788. or stays in the same state to consume the next character. Some states have more complicated
  50789. behavior and can consume several characters before switching to another state. In some cases, the
  50790. tokenizer state is also changed by the tree construction stage.</p>
  50791. <p>The exact behavior of certain states depends on the <a href=#insertion-mode id=tokenization:insertion-mode>insertion mode</a> and the
  50792. <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>
  50793. <p>The output of the tokenization step is a series of zero or more of the following tokens:
  50794. DOCTYPE, start tag, end tag, comment, character, end-of-file. DOCTYPE tokens have a name, a public
  50795. identifier, a system identifier, and a <dfn id=force-quirks-flag><i>force-quirks flag</i></dfn>. When a DOCTYPE token
  50796. is created, its name, public identifier, and system identifier must be marked as missing (which is
  50797. 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
  50798. <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
  50799. 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
  50800. list must be empty. Comment and character tokens have data.</p>
  50801. <p>When a token is emitted, it must immediately be handled by the <a href=#tree-construction id=tokenization:tree-construction>tree construction</a>
  50802. stage. The tree construction stage can affect the state of the tokenization stage, and can insert
  50803. 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
  50804. scripts executing and using the <a href=#dynamic-markup-insertion id=tokenization:dynamic-markup-insertion>dynamic markup insertion</a> APIs to insert characters
  50805. into the stream being tokenized.)</p>
  50806. <p class=note>Creating a token and emitting it are distinct actions. It is possible for a token
  50807. to be created but implicitly abandoned (never emitted), e.g. if the file ends unexpectedly while
  50808. processing the characters that are being parsed into a start tag token.</p>
  50809. <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
  50810. <dfn id=acknowledge-self-closing-flag>acknowledged</dfn> when it is processed by the tree
  50811. construction stage, that is a <a href=#parse-error id=tokenization:parse-error>parse error</a>.</p>
  50812. <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>
  50813. <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
  50814. error</a>.</p>
  50815. <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
  50816. of the last start tag to have been emitted from this tokenizer, if any. If no start tag has been
  50817. emitted from this tokenizer, then no end tag token is appropriate.</p>
  50818. <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
  50819. flag</a>. If it is true, then the tokenizer must abort the processing of any nested invocations
  50820. of the tokenizer, yielding control back to the caller.</p>
  50821. <p>The tokenizer state machine consists of the states defined in the following subsections.</p>
  50822. <h5 id=data-state>12.2.4.1 <dfn>Data state</dfn></h5>
  50823. <p>Consume the <a href=#next-input-character id=data-state:next-input-character>next input character</a>:</p>
  50824. <dl class=switch><dt>U+0026 AMPERSAND (&amp;)<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 (&lt;)<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
  50825. 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>
  50826. <h5 id=character-reference-in-data-state>12.2.4.2 <dfn>Character reference in data state</dfn></h5>
  50827. <p>Switch to the <a href=#data-state id=character-reference-in-data-state:data-state>data state</a>.</p>
  50828. <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
  50829. character</a>.</p>
  50830. <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;) token.</p>
  50831. <p>Otherwise, emit the character tokens that were returned.</p>
  50832. <h5 id=rcdata-state>12.2.4.3 <dfn>RCDATA state</dfn></h5>
  50833. <p>Consume the <a href=#next-input-character id=rcdata-state:next-input-character>next input character</a>:</p>
  50834. <dl class=switch><dt>U+0026 AMPERSAND (&amp;)<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 (&lt;)<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>
  50835. <h5 id=character-reference-in-rcdata-state>12.2.4.4 <dfn>Character reference in RCDATA state</dfn></h5>
  50836. <p>Switch to the <a href=#rcdata-state id=character-reference-in-rcdata-state:rcdata-state>RCDATA state</a>.</p>
  50837. <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
  50838. character</a>.</p>
  50839. <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;) token.</p>
  50840. <p>Otherwise, emit the character tokens that were returned.</p>
  50841. <h5 id=rawtext-state>12.2.4.5 <dfn>RAWTEXT state</dfn></h5>
  50842. <p>Consume the <a href=#next-input-character id=rawtext-state:next-input-character>next input character</a>:</p>
  50843. <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)<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>
  50844. <h5 id=script-data-state>12.2.4.6 <dfn>Script data state</dfn></h5>
  50845. <p>Consume the <a href=#next-input-character id=script-data-state:next-input-character>next input character</a>:</p>
  50846. <dl class=switch><dt>U+003C LESS-THAN SIGN (&lt;)<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>
  50847. <h5 id=plaintext-state>12.2.4.7 <dfn>PLAINTEXT state</dfn></h5>
  50848. <p>Consume the <a href=#next-input-character id=plaintext-state:next-input-character>next input character</a>:</p>
  50849. <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>
  50850. <h5 id=tag-open-state>12.2.4.8 <dfn>Tag open state</dfn></h5>
  50851. <p>Consume the <a href=#next-input-character id=tag-open-state:next-input-character>next input character</a>:</p>
  50852. <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
  50853. 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
  50854. name state</a>. (Don't emit the token yet; further details will be filled in before it is
  50855. 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>,
  50856. 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
  50857. 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
  50858. character token. Reconsume the <a href=#current-input-character id=tag-open-state:current-input-character-3>current input character</a>.</dl>
  50859. <h5 id=end-tag-open-state>12.2.4.9 <dfn>End tag open state</dfn></h5>
  50860. <p>Consume the <a href=#next-input-character id=end-tag-open-state:next-input-character>next input character</a>:</p>
  50861. <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
  50862. 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
  50863. name state</a>. (Don't emit the token yet; further details will be filled in before it is
  50864. 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>,
  50865. 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
  50866. 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
  50867. 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>
  50868. <h5 id=tag-name-state>12.2.4.10 <dfn>Tag name state</dfn></h5>
  50869. <p>Consume the <a href=#next-input-character id=tag-name-state:next-input-character>next input character</a>:</p>
  50870. <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
  50871. 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
  50872. 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
  50873. 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>
  50874. <h5 id=rcdata-less-than-sign-state>12.2.4.11 <dfn>RCDATA less-than sign state</dfn></h5>
  50875. <p>Consume the <a href=#next-input-character id=rcdata-less-than-sign-state:next-input-character>next input character</a>:</p>
  50876. <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
  50877. 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.
  50878. Reconsume the <a href=#current-input-character id=rcdata-less-than-sign-state:current-input-character>current input character</a>.</dl>
  50879. <h5 id=rcdata-end-tag-open-state>12.2.4.12 <dfn>RCDATA end tag open state</dfn></h5>
  50880. <p>Consume the <a href=#next-input-character id=rcdata-end-tag-open-state:next-input-character>next input character</a>:</p>
  50881. <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
  50882. <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
  50883. <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
  50884. 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
  50885. 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>.
  50886. 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
  50887. 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
  50888. 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
  50889. 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>
  50890. <h5 id=rcdata-end-tag-name-state>12.2.4.13 <dfn>RCDATA end tag name state</dfn></h5>
  50891. <p>Consume the <a href=#next-input-character id=rcdata-end-tag-name-state:next-input-character>next input character</a>:</p>
  50892. <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
  50893. <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
  50894. 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
  50895. <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
  50896. 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
  50897. <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
  50898. 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
  50899. 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
  50900. 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
  50901. 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
  50902. 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
  50903. 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).
  50904. Reconsume the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
  50905. <h5 id=rawtext-less-than-sign-state>12.2.4.14 <dfn>RAWTEXT less-than sign state</dfn></h5>
  50906. <p>Consume the <a href=#next-input-character id=rawtext-less-than-sign-state:next-input-character>next input character</a>:</p>
  50907. <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
  50908. 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.
  50909. Reconsume the <a href=#current-input-character id=rawtext-less-than-sign-state:current-input-character>current input character</a>.</dl>
  50910. <h5 id=rawtext-end-tag-open-state>12.2.4.15 <dfn>RAWTEXT end tag open state</dfn></h5>
  50911. <p>Consume the <a href=#next-input-character id=rawtext-end-tag-open-state:next-input-character>next input character</a>:</p>
  50912. <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
  50913. <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
  50914. <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
  50915. 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
  50916. 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>.
  50917. 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
  50918. 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
  50919. 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
  50920. 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>
  50921. <h5 id=rawtext-end-tag-name-state>12.2.4.16 <dfn>RAWTEXT end tag name state</dfn></h5>
  50922. <p>Consume the <a href=#next-input-character id=rawtext-end-tag-name-state:next-input-character>next input character</a>:</p>
  50923. <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
  50924. <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
  50925. 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
  50926. <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
  50927. 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
  50928. <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
  50929. 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
  50930. 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
  50931. 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
  50932. 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
  50933. 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
  50934. 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).
  50935. Reconsume the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
  50936. <h5 id=script-data-less-than-sign-state>12.2.4.17 <dfn>Script data less-than sign state</dfn></h5>
  50937. <p>Consume the <a href=#next-input-character id=script-data-less-than-sign-state:next-input-character>next input character</a>:</p>
  50938. <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
  50939. 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
  50940. 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.
  50941. Reconsume the <a href=#current-input-character id=script-data-less-than-sign-state:current-input-character>current input character</a>.</dl>
  50942. <h5 id=script-data-end-tag-open-state>12.2.4.18 <dfn>Script data end tag open state</dfn></h5>
  50943. <p>Consume the <a href=#next-input-character id=script-data-end-tag-open-state:next-input-character>next input character</a>:</p>
  50944. <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
  50945. <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
  50946. <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
  50947. 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
  50948. 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>.
  50949. 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
  50950. 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
  50951. 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
  50952. 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>
  50953. <h5 id=script-data-end-tag-name-state>12.2.4.19 <dfn>Script data end tag name state</dfn></h5>
  50954. <p>Consume the <a href=#next-input-character id=script-data-end-tag-name-state:next-input-character>next input character</a>:</p>
  50955. <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
  50956. <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
  50957. 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
  50958. <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
  50959. 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
  50960. <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
  50961. 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
  50962. 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
  50963. 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
  50964. 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
  50965. 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
  50966. 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).
  50967. Reconsume the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
  50968. <h5 id=script-data-escape-start-state>12.2.4.20 <dfn>Script data escape start state</dfn></h5>
  50969. <p>Consume the <a href=#next-input-character id=script-data-escape-start-state:next-input-character>next input character</a>:</p>
  50970. <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
  50971. 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
  50972. character</a>.</dl>
  50973. <h5 id=script-data-escape-start-dash-state>12.2.4.21 <dfn>Script data escape start dash state</dfn></h5>
  50974. <p>Consume the <a href=#next-input-character id=script-data-escape-start-dash-state:next-input-character>next input character</a>:</p>
  50975. <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
  50976. 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
  50977. character</a>.</dl>
  50978. <h5 id=script-data-escaped-state>12.2.4.22 <dfn>Script data escaped state</dfn></h5>
  50979. <p>Consume the <a href=#next-input-character id=script-data-escaped-state:next-input-character>next input character</a>:</p>
  50980. <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
  50981. character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  50982. 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>
  50983. <h5 id=script-data-escaped-dash-state>12.2.4.23 <dfn>Script data escaped dash state</dfn></h5>
  50984. <p>Consume the <a href=#next-input-character id=script-data-escaped-dash-state:next-input-character>next input character</a>:</p>
  50985. <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
  50986. character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  50987. 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
  50988. 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
  50989. character</a> as a character token.</dl>
  50990. <h5 id=script-data-escaped-dash-dash-state>12.2.4.24 <dfn>Script data escaped dash dash state</dfn></h5>
  50991. <p>Consume the <a href=#next-input-character id=script-data-escaped-dash-dash-state:next-input-character>next input character</a>:</p>
  50992. <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Emit a U+002D HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  50993. 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
  50994. 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
  50995. 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
  50996. character</a> as a character token.</dl>
  50997. <h5 id=script-data-escaped-less-than-sign-state>12.2.4.25 <dfn>Script data escaped less-than sign state</dfn></h5>
  50998. <p>Consume the <a href=#next-input-character id=script-data-escaped-less-than-sign-state:next-input-character>next input character</a>:</p>
  50999. <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
  51000. 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
  51001. 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
  51002. 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
  51003. data double escape start state</a>. Emit a U+003C LESS-THAN SIGN character token and the
  51004. <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
  51005. <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
  51006. 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
  51007. 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
  51008. 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
  51009. 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>
  51010. <h5 id=script-data-escaped-end-tag-open-state>12.2.4.26 <dfn>Script data escaped end tag open state</dfn></h5>
  51011. <p>Consume the <a href=#next-input-character id=script-data-escaped-end-tag-open-state:next-input-character>next input character</a>:</p>
  51012. <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
  51013. <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
  51014. <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
  51015. 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
  51016. 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>.
  51017. 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
  51018. 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
  51019. 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
  51020. 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
  51021. character</a>.</dl>
  51022. <h5 id=script-data-escaped-end-tag-name-state>12.2.4.27 <dfn>Script data escaped end tag name state</dfn></h5>
  51023. <p>Consume the <a href=#next-input-character id=script-data-escaped-end-tag-name-state:next-input-character>next input character</a>:</p>
  51024. <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
  51025. <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
  51026. 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
  51027. <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
  51028. 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
  51029. <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
  51030. 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
  51031. 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
  51032. 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
  51033. 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
  51034. 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
  51035. token, a U+002F SOLIDUS character token, and a character token for each of the characters in the
  51036. <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
  51037. 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>
  51038. <h5 id=script-data-double-escape-start-state>12.2.4.28 <dfn>Script data double escape start state</dfn></h5>
  51039. <p>Consume the <a href=#next-input-character id=script-data-double-escape-start-state:next-input-character>next input character</a>:</p>
  51040. <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>.
  51041. 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
  51042. 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
  51043. 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
  51044. <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
  51045. 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
  51046. character</a>.</dl>
  51047. <h5 id=script-data-double-escaped-state>12.2.4.29 <dfn>Script data double escaped state</dfn></h5>
  51048. <p>Consume the <a href=#next-input-character id=script-data-double-escaped-state:next-input-character>next input character</a>:</p>
  51049. <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
  51050. character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51051. 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
  51052. 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>
  51053. <h5 id=script-data-double-escaped-dash-state>12.2.4.30 <dfn>Script data double escaped dash state</dfn></h5>
  51054. <p>Consume the <a href=#next-input-character id=script-data-double-escaped-dash-state:next-input-character>next input character</a>:</p>
  51055. <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
  51056. HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51057. 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
  51058. 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
  51059. 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
  51060. character</a> as a character token.</dl>
  51061. <h5 id=script-data-double-escaped-dash-dash-state>12.2.4.31 <dfn>Script data double escaped dash dash state</dfn></h5>
  51062. <p>Consume the <a href=#next-input-character id=script-data-double-escaped-dash-dash-state:next-input-character>next input character</a>:</p>
  51063. <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Emit a U+002D HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51064. 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
  51065. 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
  51066. 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
  51067. 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
  51068. character</a> as a character token.</dl>
  51069. <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>
  51070. <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>
  51071. <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
  51072. 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
  51073. input character</a>.</dl>
  51074. <h5 id=script-data-double-escape-end-state>12.2.4.33 <dfn>Script data double escape end state</dfn></h5>
  51075. <p>Consume the <a href=#next-input-character id=script-data-double-escape-end-state:next-input-character>next input character</a>:</p>
  51076. <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,
  51077. 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
  51078. 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
  51079. 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
  51080. <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
  51081. 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
  51082. input character</a>.</dl>
  51083. <h5 id=before-attribute-name-state>12.2.4.34 <dfn>Before attribute name state</dfn></h5>
  51084. <p>Consume the <a href=#next-input-character id=before-attribute-name-state:next-input-character>next input character</a>:</p>
  51085. <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
  51086. 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),
  51087. 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
  51088. attribute's name to a U+FFFD REPLACEMENT CHARACTER character, and its value to the empty string.
  51089. 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 (&lt;)<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
  51090. character.<dt>Anything else<dd>Start a new attribute in the current tag token. Set that attribute's name to the
  51091. <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
  51092. <a href=#attribute-name-state id=before-attribute-name-state:attribute-name-state-3>attribute name state</a>.</dl>
  51093. <h5 id=attribute-name-state>12.2.4.35 <dfn>Attribute name state</dfn></h5>
  51094. <p>Consume the <a href=#next-input-character id=attribute-name-state:next-input-character>next input character</a>:</p>
  51095. <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
  51096. 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
  51097. attribute's name.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51098. 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>
  51099. <p>When the user agent leaves the attribute name state (and before emitting the tag token, if
  51100. appropriate), the complete attribute's name must be compared to the other attributes on the same
  51101. token; if there is already an attribute on the token with the exact same name, then this is a
  51102. <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>
  51103. <p class=note>If an attribute is so removed from a token, it, and the value that gets associated
  51104. with it, if any, are never subsequently used by the parser, and are therefore effectively
  51105. discarded. Removing the attribute in this way does not change its status as the "current
  51106. attribute" for the purposes of the tokenizer, however.</p>
  51107. <h5 id=after-attribute-name-state>12.2.4.36 <dfn>After attribute name state</dfn></h5>
  51108. <p>Consume the <a href=#next-input-character id=after-attribute-name-state:next-input-character>next input character</a>:</p>
  51109. <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
  51110. 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),
  51111. 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
  51112. attribute's name to a U+FFFD REPLACEMENT CHARACTER character, and its value to the empty string.
  51113. 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 (&lt;)<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
  51114. character.<dt>Anything else<dd>Start a new attribute in the current tag token. Set that attribute's name to the
  51115. <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
  51116. <a href=#attribute-name-state id=after-attribute-name-state:attribute-name-state-3>attribute name state</a>.</dl>
  51117. <h5 id=before-attribute-value-state>12.2.4.37 <dfn>Before attribute value state</dfn></h5>
  51118. <p>Consume the <a href=#next-input-character id=before-attribute-value-state:next-input-character>next input character</a>:</p>
  51119. <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 (&amp;)<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
  51120. 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
  51121. 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
  51122. token.<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51123. 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
  51124. the <a href=#attribute-value-(unquoted)-state id=before-attribute-value-state:attribute-value-(unquoted)-state-3>attribute value (unquoted) state</a>.</dl>
  51125. <h5 id=attribute-value-(double-quoted)-state>12.2.4.38 <dfn>Attribute value (double-quoted) state</dfn></h5>
  51126. <p>Consume the <a href=#next-input-character id=attribute-value-(double-quoted)-state:next-input-character>next input character</a>:</p>
  51127. <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 (&amp;)<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
  51128. <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
  51129. 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
  51130. 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>
  51131. <h5 id=attribute-value-(single-quoted)-state>12.2.4.39 <dfn>Attribute value (single-quoted) state</dfn></h5>
  51132. <p>Consume the <a href=#next-input-character id=attribute-value-(single-quoted)-state:next-input-character>next input character</a>:</p>
  51133. <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 (&amp;)<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
  51134. <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
  51135. 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
  51136. 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>
  51137. <h5 id=attribute-value-(unquoted)-state>12.2.4.40 <dfn>Attribute value (unquoted) state</dfn></h5>
  51138. <p>Consume the <a href=#next-input-character id=attribute-value-(unquoted)-state:next-input-character>next input character</a>:</p>
  51139. <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 (&amp;)<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
  51140. <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
  51141. attribute's value.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (&lt;)<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
  51142. 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>
  51143. <h5 id=character-reference-in-attribute-value-state>12.2.4.41 <dfn>Character reference in attribute value state</dfn></h5>
  51144. <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>
  51145. <p>If nothing is returned, append a U+0026 AMPERSAND character (&amp;) to the current attribute's
  51146. value.</p>
  51147. <p>Otherwise, append the returned character tokens to the current attribute's value.</p>
  51148. <p>Finally, switch back to the attribute value state that switched into this state.</p>
  51149. <h5 id=after-attribute-value-(quoted)-state>12.2.4.42 <dfn>After attribute value (quoted) state</dfn></h5>
  51150. <p>Consume the <a href=#next-input-character id=after-attribute-value-(quoted)-state:next-input-character>next input character</a>:</p>
  51151. <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
  51152. 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
  51153. the character.</dl>
  51154. <h5 id=self-closing-start-tag-state>12.2.4.43 <dfn>Self-closing start tag state</dfn></h5>
  51155. <p>Consume the <a href=#next-input-character id=self-closing-start-tag-state:next-input-character>next input character</a>:</p>
  51156. <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
  51157. 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
  51158. 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
  51159. the character.</dl>
  51160. <h5 id=bogus-comment-state>12.2.4.44 <dfn>Bogus comment state</dfn></h5>
  51161. <p>Consume every character up to and including the first U+003E GREATER-THAN SIGN character (>)
  51162. or the end of the file (EOF), whichever comes first.
  51163. If more than one character was consumed, then emit a comment token whose data is the
  51164. concatenation of all the characters starting from and including the character that caused the
  51165. state machine to switch into the bogus comment state, up to and including the character
  51166. immediately before the last consumed character (i.e. up to the character just before the U+003E or
  51167. EOF character), but with any U+0000 NULL characters replaced by U+FFFD REPLACEMENT CHARACTER
  51168. characters. (If the comment was started by the end of the file (EOF), the token is empty.
  51169. Similarly, the token is empty if it was generated by the string "<code>&lt;!></code>".)</p>
  51170. <p>Switch to the <a href=#data-state id=bogus-comment-state:data-state>data state</a>.</p>
  51171. <p>If the end of the file was reached, reconsume the EOF character.</p>
  51172. <h5 id=markup-declaration-open-state>12.2.4.45 <dfn>Markup declaration open state</dfn></h5>
  51173. <p>If the next two characters are both U+002D HYPHEN-MINUS characters (-), consume those two
  51174. 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
  51175. start state</a>.</p>
  51176. <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
  51177. the word "DOCTYPE", then consume those characters and switch to the <a href=#doctype-state id=markup-declaration-open-state:doctype-state>DOCTYPE
  51178. state</a>.</p>
  51179. <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
  51180. <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
  51181. for the string "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
  51182. 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
  51183. state</a>.</p>
  51184. <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>.
  51185. The next character that is consumed, if any, is the first character that will be in the
  51186. comment.</p>
  51187. <h5 id=comment-start-state>12.2.4.46 <dfn>Comment start state</dfn></h5>
  51188. <p>Consume the <a href=#next-input-character id=comment-start-state:next-input-character>next input character</a>:</p>
  51189. <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
  51190. 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.
  51191. 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
  51192. <a href=#comment-state id=comment-start-state:comment-state-2>comment state</a>.</dl>
  51193. <h5 id=comment-start-dash-state>12.2.4.47 <dfn>Comment start dash state</dfn></h5>
  51194. <p>Consume the <a href=#next-input-character id=comment-start-dash-state:next-input-character>next input character</a>:</p>
  51195. <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
  51196. 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.
  51197. 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
  51198. the comment token's data. Switch to the <a href=#comment-state id=comment-start-dash-state:comment-state-2>comment state</a>.</dl>
  51199. <h5 id=comment-state>12.2.4.48 <dfn id=comment>Comment state</dfn></h5>
  51200. <p>Consume the <a href=#next-input-character id=comment-state:next-input-character>next input character</a>:</p>
  51201. <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
  51202. 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.
  51203. 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>
  51204. <h5 id=comment-end-dash-state>12.2.4.49 <dfn>Comment end dash state</dfn></h5>
  51205. <p>Consume the <a href=#next-input-character id=comment-end-dash-state:next-input-character>next input character</a>:</p>
  51206. <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
  51207. 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.
  51208. 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
  51209. the comment token's data. Switch to the <a href=#comment-state id=comment-end-dash-state:comment-state-2>comment state</a>.</dl>
  51210. <h5 id=comment-end-state>12.2.4.50 <dfn>Comment end state</dfn></h5>
  51211. <p>Consume the <a href=#next-input-character id=comment-end-state:next-input-character>next input character</a>:</p>
  51212. <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
  51213. REPLACEMENT CHARACTER character to the comment token's data. Switch to the <a href=#comment-state id=comment-end-state:comment-state>comment
  51214. 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
  51215. 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.
  51216. 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
  51217. input character</a> to the comment token's data. Switch to the <a href=#comment-state id=comment-end-state:comment-state-2>comment
  51218. state</a>.</dl>
  51219. <h5 id=comment-end-bang-state>12.2.4.51 <dfn>Comment end bang state</dfn></h5>
  51220. <p>Consume the <a href=#next-input-character id=comment-end-bang-state:next-input-character>next input character</a>:</p>
  51221. <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to
  51222. 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
  51223. MARK character (!), and a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
  51224. 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.
  51225. Reconsume the EOF character.<dt>Anything else<dd>Append two U+002D HYPHEN-MINUS characters (-), a U+0021 EXCLAMATION MARK character (!), and
  51226. 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
  51227. state</a>.</dl>
  51228. <h5 id=doctype-state>12.2.4.52 <dfn>DOCTYPE state</dfn></h5>
  51229. <p>Consume the <a href=#next-input-character id=doctype-state:next-input-character>next input character</a>:</p>
  51230. <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.
  51231. 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
  51232. character.</dl>
  51233. <h5 id=before-doctype-name-state>12.2.4.53 <dfn>Before DOCTYPE name state</dfn></h5>
  51234. <p>Consume the <a href=#next-input-character id=before-doctype-name-state:next-input-character>next input character</a>:</p>
  51235. <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
  51236. <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
  51237. <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
  51238. 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
  51239. <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.
  51240. 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>.
  51241. Switch to the <a href=#doctype-name-state id=before-doctype-name-state:doctype-name-state-3>DOCTYPE name state</a>.</dl>
  51242. <h5 id=doctype-name-state>12.2.4.54 <dfn>DOCTYPE name state</dfn></h5>
  51243. <p>Consume the <a href=#next-input-character id=doctype-name-state:next-input-character>next input character</a>:</p>
  51244. <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
  51245. 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
  51246. 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
  51247. <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>
  51248. <h5 id=after-doctype-name-state>12.2.4.55 <dfn>After DOCTYPE name state</dfn></h5>
  51249. <p>Consume the <a href=#next-input-character id=after-doctype-name-state:next-input-character>next input character</a>:</p>
  51250. <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
  51251. <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>
  51252. <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
  51253. <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
  51254. 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>
  51255. <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
  51256. 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
  51257. 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>
  51258. <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>
  51259. </dl>
  51260. <h5 id=after-doctype-public-keyword-state>12.2.4.56 <dfn>After DOCTYPE public keyword state</dfn></h5>
  51261. <p>Consume the <a href=#next-input-character id=after-doctype-public-keyword-state:next-input-character>next input character</a>:</p>
  51262. <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
  51263. 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
  51264. 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>.
  51265. 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
  51266. <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>.
  51267. Switch to the <a href=#bogus-doctype-state id=after-doctype-public-keyword-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51268. <h5 id=before-doctype-public-identifier-state>12.2.4.57 <dfn>Before DOCTYPE public identifier state</dfn></h5>
  51269. <p>Consume the <a href=#next-input-character id=before-doctype-public-identifier-state:next-input-character>next input character</a>:</p>
  51270. <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
  51271. 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
  51272. 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>.
  51273. 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
  51274. <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>.
  51275. Switch to the <a href=#bogus-doctype-state id=before-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51276. <h5 id=doctype-public-identifier-(double-quoted)-state>12.2.4.58 <dfn>DOCTYPE public identifier (double-quoted) state</dfn></h5>
  51277. <p>Consume the <a href=#next-input-character id=doctype-public-identifier-(double-quoted)-state:next-input-character>next input character</a>:</p>
  51278. <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
  51279. 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>.
  51280. 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
  51281. <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
  51282. identifier.</dl>
  51283. <h5 id=doctype-public-identifier-(single-quoted)-state>12.2.4.59 <dfn>DOCTYPE public identifier (single-quoted) state</dfn></h5>
  51284. <p>Consume the <a href=#next-input-character id=doctype-public-identifier-(single-quoted)-state:next-input-character>next input character</a>:</p>
  51285. <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
  51286. 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>.
  51287. 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
  51288. <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
  51289. identifier.</dl>
  51290. <h5 id=after-doctype-public-identifier-state>12.2.4.60 <dfn>After DOCTYPE public identifier state</dfn></h5>
  51291. <p>Consume the <a href=#next-input-character id=after-doctype-public-identifier-state:next-input-character>next input character</a>:</p>
  51292. <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
  51293. 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
  51294. 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
  51295. <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>.
  51296. Switch to the <a href=#bogus-doctype-state id=after-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51297. <h5 id=between-doctype-public-and-system-identifiers-state>12.2.4.61 <dfn>Between DOCTYPE public and system identifiers state</dfn></h5>
  51298. <p>Consume the <a href=#next-input-character id=between-doctype-public-and-system-identifiers-state:next-input-character>next input character</a>:</p>
  51299. <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
  51300. 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
  51301. 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
  51302. <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>.
  51303. Switch to the <a href=#bogus-doctype-state id=between-doctype-public-and-system-identifiers-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51304. <h5 id=after-doctype-system-keyword-state>12.2.4.62 <dfn>After DOCTYPE system keyword state</dfn></h5>
  51305. <p>Consume the <a href=#next-input-character id=after-doctype-system-keyword-state:next-input-character>next input character</a>:</p>
  51306. <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
  51307. 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
  51308. 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>.
  51309. 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
  51310. <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>.
  51311. Switch to the <a href=#bogus-doctype-state id=after-doctype-system-keyword-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51312. <h5 id=before-doctype-system-identifier-state>12.2.4.63 <dfn>Before DOCTYPE system identifier state</dfn></h5>
  51313. <p>Consume the <a href=#next-input-character id=before-doctype-system-identifier-state:next-input-character>next input character</a>:</p>
  51314. <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
  51315. 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
  51316. 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>.
  51317. 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
  51318. <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>.
  51319. Switch to the <a href=#bogus-doctype-state id=before-doctype-system-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
  51320. <h5 id=doctype-system-identifier-(double-quoted)-state>12.2.4.64 <dfn>DOCTYPE system identifier (double-quoted) state</dfn></h5>
  51321. <p>Consume the <a href=#next-input-character id=doctype-system-identifier-(double-quoted)-state:next-input-character>next input character</a>:</p>
  51322. <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
  51323. 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>.
  51324. 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
  51325. <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
  51326. identifier.</dl>
  51327. <h5 id=doctype-system-identifier-(single-quoted)-state>12.2.4.65 <dfn>DOCTYPE system identifier (single-quoted) state</dfn></h5>
  51328. <p>Consume the <a href=#next-input-character id=doctype-system-identifier-(single-quoted)-state:next-input-character>next input character</a>:</p>
  51329. <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
  51330. 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>.
  51331. 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
  51332. <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
  51333. identifier.</dl>
  51334. <h5 id=after-doctype-system-identifier-state>12.2.4.66 <dfn>After DOCTYPE system identifier state</dfn></h5>
  51335. <p>Consume the <a href=#next-input-character id=after-doctype-system-identifier-state:next-input-character>next input character</a>:</p>
  51336. <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
  51337. <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
  51338. <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>
  51339. <h5 id=bogus-doctype-state>12.2.4.67 <dfn>Bogus DOCTYPE state</dfn></h5>
  51340. <p>Consume the <a href=#next-input-character id=bogus-doctype-state:next-input-character>next input character</a>:</p>
  51341. <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
  51342. character.<dt>Anything else<dd>Ignore the character.</dl>
  51343. <h5 id=cdata-section-state>12.2.4.68 <dfn>CDATA section state</dfn></h5>
  51344. <p>Switch to the <a href=#data-state id=cdata-section-state:data-state>data state</a>.</p>
  51345. <p>Consume every character up to the next occurrence of the three character sequence U+005D RIGHT
  51346. SQUARE BRACKET U+005D RIGHT SQUARE BRACKET U+003E GREATER-THAN SIGN (<code>]]></code>),
  51347. or the end of the file (EOF), whichever comes first. Emit a series of character tokens consisting
  51348. of all the characters consumed except the matching three character sequence at the end (if one was
  51349. found before the end of the file).</p>
  51350. <p>If the end of the file was reached, reconsume the EOF character.</p>
  51351. <h5 id=tokenizing-character-references>12.2.4.69 Tokenizing character references</h5>
  51352. <p>This section defines how to <dfn id=consume-a-character-reference>consume a character reference</dfn>, optionally with an
  51353. <dfn id=additional-allowed-character>additional allowed character</dfn>, which, if specified where the algorithm is invoked, adds
  51354. a character to the list of characters that cause there to not be a character reference.</p>
  51355. <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
  51356. attributes</a>.</p>
  51357. <p>The behavior depends on the identity of the next character (the one immediately after the
  51358. U+0026 AMPERSAND character), as follows:</p>
  51359. <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
  51360. an error, either.)<dt>U+0023 NUMBER SIGN (#)<dd>
  51361. <p>Consume the U+0023 NUMBER SIGN.</p>
  51362. <p>The behavior further depends on the character after the U+0023 NUMBER SIGN:</p>
  51363. <dl class=switch><dt>U+0078 LATIN SMALL LETTER X<dt>U+0058 LATIN CAPITAL LETTER X<dd>
  51364. <p>Consume the X.</p>
  51365. <p>Follow the steps below, but using <a href=#ascii-hex-digits id=tokenizing-character-references:ascii-hex-digits>ASCII hex digits</a>.</p>
  51366. <p>When it comes to interpreting the number, interpret it as a hexadecimal number.</p>
  51367. <dt>Anything else<dd>
  51368. <p>Follow the steps below, but using <a href=#ascii-digits id=tokenizing-character-references:ascii-digits>ASCII digits</a>.</p>
  51369. <p>When it comes to interpreting the number, interpret it as a decimal number.</p>
  51370. </dl>
  51371. <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
  51372. digits</a> or <a href=#ascii-digits id=tokenizing-character-references:ascii-digits-2>ASCII digits</a>).</p>
  51373. <p>If no characters match the range, then don't consume any characters (and unconsume the U+0023
  51374. 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>;
  51375. nothing is returned.</p>
  51376. <p>Otherwise, if the next character is a U+003B SEMICOLON, consume that too. If it isn't, there
  51377. is a <a href=#parse-error id=tokenizing-character-references:parse-error-2>parse error</a>.</p>
  51378. <p>If one or more characters match the range, then take them all and interpret the string of
  51379. characters as a number (either hexadecimal or decimal as appropriate).</p>
  51380. <p>If that number is one of the numbers in the first column of the following table, then this is
  51381. 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
  51382. character token for the Unicode character given in the second column of that row.</p>
  51383. <table id=table-charref-overrides><thead><tr><th>Number <th colspan=2>Unicode character
  51384. <tbody><tr><td>0x00 <td>U+FFFD <td>REPLACEMENT CHARACTER
  51385. <tr><td>0x80 <td>U+20AC <td>EURO SIGN (€)
  51386. <tr><td>0x82 <td>U+201A <td>SINGLE LOW-9 QUOTATION MARK (‚)
  51387. <tr><td>0x83 <td>U+0192 <td>LATIN SMALL LETTER F WITH HOOK (ƒ)
  51388. <tr><td>0x84 <td>U+201E <td>DOUBLE LOW-9 QUOTATION MARK („)
  51389. <tr><td>0x85 <td>U+2026 <td>HORIZONTAL ELLIPSIS (…)
  51390. <tr><td>0x86 <td>U+2020 <td>DAGGER (†)
  51391. <tr><td>0x87 <td>U+2021 <td>DOUBLE DAGGER (‡)
  51392. <tr><td>0x88 <td>U+02C6 <td>MODIFIER LETTER CIRCUMFLEX ACCENT (ˆ)
  51393. <tr><td>0x89 <td>U+2030 <td>PER MILLE SIGN (‰)
  51394. <tr><td>0x8A <td>U+0160 <td>LATIN CAPITAL LETTER S WITH CARON (Š)
  51395. <tr><td>0x8B <td>U+2039 <td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (‹)
  51396. <tr><td>0x8C <td>U+0152 <td>LATIN CAPITAL LIGATURE OE (Œ)
  51397. <tr><td>0x8E <td>U+017D <td>LATIN CAPITAL LETTER Z WITH CARON (Ž)
  51398. <tr><td>0x91 <td>U+2018 <td>LEFT SINGLE QUOTATION MARK (‘)
  51399. <tr><td>0x92 <td>U+2019 <td>RIGHT SINGLE QUOTATION MARK (’)
  51400. <tr><td>0x93 <td>U+201C <td>LEFT DOUBLE QUOTATION MARK (“)
  51401. <tr><td>0x94 <td>U+201D <td>RIGHT DOUBLE QUOTATION MARK (”)
  51402. <tr><td>0x95 <td>U+2022 <td>BULLET (•)
  51403. <tr><td>0x96 <td>U+2013 <td>EN DASH (–)
  51404. <tr><td>0x97 <td>U+2014 <td>EM DASH (—)
  51405. <tr><td>0x98 <td>U+02DC <td>SMALL TILDE (˜)
  51406. <tr><td>0x99 <td>U+2122 <td>TRADE MARK SIGN (™)
  51407. <tr><td>0x9A <td>U+0161 <td>LATIN SMALL LETTER S WITH CARON (š)
  51408. <tr><td>0x9B <td>U+203A <td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (›)
  51409. <tr><td>0x9C <td>U+0153 <td>LATIN SMALL LIGATURE OE (œ)
  51410. <tr><td>0x9E <td>U+017E <td>LATIN SMALL LETTER Z WITH CARON (ž)
  51411. <tr><td>0x9F <td>U+0178 <td>LATIN CAPITAL LETTER Y WITH DIAERESIS (Ÿ)
  51412. </table>
  51413. <p>Otherwise, if the number is in the range 0xD800 to 0xDFFF or is greater
  51414. 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
  51415. character token.</p>
  51416. <p>Otherwise, return a character token for the Unicode character whose code point is that
  51417. number.
  51418. Additionally, if the number is in the range 0x0001 to 0x0008, 0x000D to 0x001F, 0x007F to 0x009F, 0xFDD0 to 0xFDEF, or is
  51419. one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE,
  51420. 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE,
  51421. 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE,
  51422. 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>
  51423. <dt>Anything else<dd>
  51424. <p>Consume the maximum number of characters possible, with the consumed characters matching one
  51425. 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
  51426. a <a href=#case-sensitive id=tokenizing-character-references:case-sensitive>case-sensitive</a> manner).</p>
  51427. <p>If no match can be made, then no characters are consumed, and nothing is returned. In this
  51428. case, if the characters after the U+0026 AMPERSAND character (&amp;) consist of a sequence of
  51429. 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
  51430. (;), then this is a <a href=#parse-error id=tokenizing-character-references:parse-error-6>parse error</a>.</p>
  51431. <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
  51432. SEMICOLON character (;), and the next character is either a U+003D EQUALS SIGN character (=) or
  51433. an <a href=#alphanumeric-ascii-characters id=tokenizing-character-references:alphanumeric-ascii-characters-2>alphanumeric ASCII character</a>, then, for
  51434. historical reasons, all the characters that were matched after the U+0026 AMPERSAND character
  51435. (&amp;) must be unconsumed, and nothing is returned.
  51436. However, if this next character is in fact a U+003D EQUALS SIGN character (=), then this is a
  51437. <a href=#parse-error id=tokenizing-character-references:parse-error-7>parse error</a>, because some legacy user agents will
  51438. misinterpret the markup in those cases.</p>
  51439. <p>Otherwise, a character reference is parsed. If the last character matched is not a U+003B
  51440. SEMICOLON character (;), there is a <a href=#parse-error id=tokenizing-character-references:parse-error-8>parse error</a>.</p>
  51441. <p>Return one or two character tokens for the character(s) corresponding to the character
  51442. 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>
  51443. table).</p>
  51444. <div class=example>
  51445. <p>If the markup contains (not in an attribute) the string <code>I'm &amp;notit; I
  51446. tell you</code>, the character reference is parsed as "not", as in, <code>I'm ¬it;
  51447. I tell you</code> (and this is a parse error). But if the markup was <code>I'm
  51448. &amp;notin; I tell you</code>, the character reference would be parsed as "notin;", resulting
  51449. in <code>I'm ∉ I tell you</code> (and no parse error).</p>
  51450. </div>
  51451. </dl>
  51452. <h4 id=tree-construction>12.2.5 <dfn>Tree construction</dfn></h4>
  51453. <p>The input to the tree construction stage is a sequence of tokens from the
  51454. <a href=#tokenization id=tree-construction:tokenization>tokenization</a> stage. The tree construction stage is associated with a DOM
  51455. <code id=tree-construction:document><a href=#document>Document</a></code> object when a parser is created. The "output" of this stage consists of
  51456. dynamically modifying or extending that document's DOM tree.</p>
  51457. <p>This specification does not define when an interactive user agent has to render the
  51458. <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
  51459. input.</p>
  51460. <hr>
  51461. <p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
  51462. from the following list, known as the <dfn id=tree-construction-dispatcher>tree construction dispatcher</dfn>:</p>
  51463. <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
  51464. <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>
  51465. <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
  51466. construction dispatcher</a> (even if the token is subsequently just ignored).</p>
  51467. <p>A node is a <dfn id=mathml-text-integration-point>MathML text integration point</dfn> if it is one of the following
  51468. elements:</p>
  51469. <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>
  51470. <p>A node is an <dfn id=html-integration-point>HTML integration point</dfn> if it is one of the following elements:</p>
  51471. <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
  51472. namespace</a> whose start tag token had an attribute with the name "encoding" whose value was
  51473. 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
  51474. namespace</a> whose start tag token had an attribute with the name "encoding" whose value was
  51475. 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>
  51476. <p class=note>Not all of the tag names mentioned below are conformant tag names in this
  51477. specification; many are included to handle legacy content. They still form part of the algorithm
  51478. that implementations are required to implement to claim conformance.</p>
  51479. <p class=note>The algorithm described below places no limit on the depth of the DOM tree
  51480. generated, or on the length of tag names, attribute names, attribute values, <code id=tree-construction:text><a href=#text>Text</a></code>
  51481. 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
  51482. depth constraints.</p>
  51483. <h5 id=creating-and-inserting-nodes>12.2.5.1 Creating and inserting nodes</h5>
  51484. <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>
  51485. <p>The <dfn id=appropriate-place-for-inserting-a-node>appropriate place for inserting a node</dfn>, optionally using a particular
  51486. <i>override target</i>, is the position in an element returned by running the following steps:</p>
  51487. <ol><li>
  51488. <p>If there was an <i>override target</i> specified, then let <var>target</var> be the
  51489. <i>override target</i>.</p>
  51490. <p>Otherwise, let <var>target</var> be the <a href=#current-node id=creating-and-inserting-nodes:current-node>current node</a>.</p>
  51491. <li>
  51492. <p>Determine the <var>adjusted insertion location</var> using the first matching steps
  51493. from the following list:</p>
  51494. <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>,
  51495. <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>
  51496. <p class=note>Foster parenting happens when content is misnested in tables.</p>
  51497. <p>Run these substeps:</p>
  51498. <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
  51499. <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements>stack of open elements</a>, if any.</p>
  51500. <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
  51501. <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-2>stack of open elements</a>, if any.</p>
  51502. <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
  51503. (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
  51504. 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),
  51505. and abort these substeps.<li><p>If there is no <var>last table</var>, then let <var>adjusted insertion
  51506. 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
  51507. <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.
  51508. (<a href=#fragment-case id=creating-and-inserting-nodes:fragment-case>fragment case</a>)</p>
  51509. <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
  51510. node, immediately before <var>last table</var>, and abort these
  51511. 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
  51512. element</var>, after its last child (if any).</ol>
  51513. <p class=note>These steps are involved in part because it's possible for elements, the
  51514. <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
  51515. in the DOM, or indeed removed from the DOM entirely, after the element was inserted by the
  51516. parser.</p>
  51517. <dt>Otherwise<dd>
  51518. <p>Let <var>adjusted insertion location</var> be inside <var>target</var>,
  51519. after its last child (if any).</p>
  51520. </dl>
  51521. <li>
  51522. <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>
  51523. 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
  51524. contents</a>, after its last child (if any).</p>
  51525. <li>
  51526. <p>Return the <var>adjusted insertion location</var>.</p>
  51527. </ol>
  51528. <hr>
  51529. <p>When the steps below require the UA to <dfn id=create-an-element-for-the-token>create an
  51530. element for a token</dfn> in a particular <var>given namespace</var> and with a
  51531. particular <var>intended parent</var>, the UA must run the following steps:</p>
  51532. <ol><li>
  51533. <p>Create a node implementing the interface appropriate for the element type corresponding to
  51534. the tag name of the token in <var>given namespace</var> (as given in the specification
  51535. 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
  51536. namespace</a>, this specification defines it to be the <code id=creating-and-inserting-nodes:htmlanchorelement><a href=#htmlanchorelement>HTMLAnchorElement</a></code>
  51537. interface), with the tag name being the name of that element, with the node being in the given
  51538. namespace, and with the attributes on the node being those given in the given token.</p>
  51539. <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
  51540. defined in this specification (or <a href=#other-applicable-specifications id=creating-and-inserting-nodes:other-applicable-specifications>other applicable specifications</a>) is
  51541. <code id=creating-and-inserting-nodes:htmlunknownelement><a href=#htmlunknownelement>HTMLUnknownElement</a></code>. Elements in other namespaces whose interface is not defined by
  51542. that namespace's specification must use the interface <code id=creating-and-inserting-nodes:element><a href=#element>Element</a></code>.</p>
  51543. <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
  51544. 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>
  51545. <li><p>If the newly created element has an <code>xmlns</code> attribute <em>in the
  51546. <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,
  51547. 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
  51548. <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>,
  51549. invoke its <a href=#concept-form-reset-control id=creating-and-inserting-nodes:concept-form-reset-control>reset algorithm</a>. (This initializes the
  51550. 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>
  51551. 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
  51552. <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
  51553. 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
  51554. <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
  51555. 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
  51556. the parser subsequently attempts to insert the element.<li><p>Return the newly created element.</ol>
  51557. <hr>
  51558. <p>When the steps below require the user agent to <dfn id=insert-a-foreign-element>insert a foreign element</dfn> for a token
  51559. in a given namespace, the user agent must run these steps:</p>
  51560. <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
  51561. 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
  51562. parent being the element in which the <var>adjusted insertion location</var> finds
  51563. itself.<li>
  51564. <p>If it is possible to insert an element at the <var>adjusted insertion
  51565. location</var>, then insert the newly created element at the <var>adjusted insertion
  51566. location</var>.</p>
  51567. <p class=note>If the <var>adjusted insertion location</var> cannot accept more
  51568. 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
  51569. newly created element is dropped on the floor.</p>
  51570. <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
  51571. <a href=#current-node id=creating-and-inserting-nodes:current-node-2>current node</a>.<li><p>Return the newly created element.</ol>
  51572. <p>When the steps below require the user agent to <dfn id=insert-an-html-element>insert an HTML element</dfn> for a token,
  51573. 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
  51574. namespace</a>.</p>
  51575. <hr>
  51576. <p>When the steps below require the user agent to <dfn id=adjust-mathml-attributes>adjust MathML attributes</dfn> for a token,
  51577. then, if the token has an attribute named <code>definitionurl</code>, change its name to
  51578. <code>definitionURL</code> (note the case difference).</p>
  51579. <p>When the steps below require the user agent to <dfn id=adjust-svg-attributes>adjust SVG attributes</dfn> for a token,
  51580. then, for each attribute on the token whose attribute name is one of the ones in the first column
  51581. of the following table, change the attribute's name to the name given in the corresponding cell in
  51582. the second column. (This fixes the case of SVG attributes that are not all lowercase.)</p>
  51583. <table><thead><tr><th> Attribute name on token <th> Attribute name on element
  51584. <tbody><tr><td> <code>attributename</code> <td> <code>attributeName</code>
  51585. <tr><td> <code>attributetype</code> <td> <code>attributeType</code>
  51586. <tr><td> <code>basefrequency</code> <td> <code>baseFrequency</code>
  51587. <tr><td> <code>baseprofile</code> <td> <code>baseProfile</code>
  51588. <tr><td> <code>calcmode</code> <td> <code>calcMode</code>
  51589. <tr><td> <code>clippathunits</code> <td> <code>clipPathUnits</code>
  51590. <tr><td> <code>diffuseconstant</code> <td> <code>diffuseConstant</code>
  51591. <tr><td> <code>edgemode</code> <td> <code>edgeMode</code>
  51592. <tr><td> <code>filterunits</code> <td> <code>filterUnits</code>
  51593. <tr><td> <code>glyphref</code> <td> <code>glyphRef</code>
  51594. <tr><td> <code>gradienttransform</code> <td> <code>gradientTransform</code>
  51595. <tr><td> <code>gradientunits</code> <td> <code>gradientUnits</code>
  51596. <tr><td> <code>kernelmatrix</code> <td> <code>kernelMatrix</code>
  51597. <tr><td> <code>kernelunitlength</code> <td> <code>kernelUnitLength</code>
  51598. <tr><td> <code>keypoints</code> <td> <code>keyPoints</code>
  51599. <tr><td> <code>keysplines</code> <td> <code>keySplines</code>
  51600. <tr><td> <code>keytimes</code> <td> <code>keyTimes</code>
  51601. <tr><td> <code>lengthadjust</code> <td> <code>lengthAdjust</code>
  51602. <tr><td> <code>limitingconeangle</code> <td> <code>limitingConeAngle</code>
  51603. <tr><td> <code>markerheight</code> <td> <code>markerHeight</code>
  51604. <tr><td> <code>markerunits</code> <td> <code>markerUnits</code>
  51605. <tr><td> <code>markerwidth</code> <td> <code>markerWidth</code>
  51606. <tr><td> <code>maskcontentunits</code> <td> <code>maskContentUnits</code>
  51607. <tr><td> <code>maskunits</code> <td> <code>maskUnits</code>
  51608. <tr><td> <code>numoctaves</code> <td> <code>numOctaves</code>
  51609. <tr><td> <code>pathlength</code> <td> <code>pathLength</code>
  51610. <tr><td> <code>patterncontentunits</code> <td> <code>patternContentUnits</code>
  51611. <tr><td> <code>patterntransform</code> <td> <code>patternTransform</code>
  51612. <tr><td> <code>patternunits</code> <td> <code>patternUnits</code>
  51613. <tr><td> <code>pointsatx</code> <td> <code>pointsAtX</code>
  51614. <tr><td> <code>pointsaty</code> <td> <code>pointsAtY</code>
  51615. <tr><td> <code>pointsatz</code> <td> <code>pointsAtZ</code>
  51616. <tr><td> <code>preservealpha</code> <td> <code>preserveAlpha</code>
  51617. <tr><td> <code>preserveaspectratio</code> <td> <code>preserveAspectRatio</code>
  51618. <tr><td> <code>primitiveunits</code> <td> <code>primitiveUnits</code>
  51619. <tr><td> <code>refx</code> <td> <code>refX</code>
  51620. <tr><td> <code>refy</code> <td> <code>refY</code>
  51621. <tr><td> <code>repeatcount</code> <td> <code>repeatCount</code>
  51622. <tr><td> <code>repeatdur</code> <td> <code>repeatDur</code>
  51623. <tr><td> <code>requiredextensions</code> <td> <code>requiredExtensions</code>
  51624. <tr><td> <code>requiredfeatures</code> <td> <code>requiredFeatures</code>
  51625. <tr><td> <code>specularconstant</code> <td> <code>specularConstant</code>
  51626. <tr><td> <code>specularexponent</code> <td> <code>specularExponent</code>
  51627. <tr><td> <code>spreadmethod</code> <td> <code>spreadMethod</code>
  51628. <tr><td> <code>startoffset</code> <td> <code>startOffset</code>
  51629. <tr><td> <code>stddeviation</code> <td> <code>stdDeviation</code>
  51630. <tr><td> <code>stitchtiles</code> <td> <code>stitchTiles</code>
  51631. <tr><td> <code>surfacescale</code> <td> <code>surfaceScale</code>
  51632. <tr><td> <code>systemlanguage</code> <td> <code>systemLanguage</code>
  51633. <tr><td> <code>tablevalues</code> <td> <code>tableValues</code>
  51634. <tr><td> <code>targetx</code> <td> <code>targetX</code>
  51635. <tr><td> <code>targety</code> <td> <code>targetY</code>
  51636. <tr><td> <code>textlength</code> <td> <code>textLength</code>
  51637. <tr><td> <code>viewbox</code> <td> <code>viewBox</code>
  51638. <tr><td> <code>viewtarget</code> <td> <code>viewTarget</code>
  51639. <tr><td> <code>xchannelselector</code> <td> <code>xChannelSelector</code>
  51640. <tr><td> <code>ychannelselector</code> <td> <code>yChannelSelector</code>
  51641. <tr><td> <code>zoomandpan</code> <td> <code>zoomAndPan</code>
  51642. </table>
  51643. <p>When the steps below require the user agent to <dfn id=adjust-foreign-attributes>adjust foreign attributes</dfn> for a
  51644. token, then, if any of the attributes on the token match the strings given in the first column of
  51645. the following table, let the attribute be a namespaced attribute, with the prefix being the string
  51646. given in the corresponding cell in the second column, the local name being the string given in the
  51647. corresponding cell in the third column, and the namespace being the namespace given in the
  51648. corresponding cell in the fourth column. (This fixes the use of namespaced attributes, in
  51649. particular <a href=#attr-xml-lang id=creating-and-inserting-nodes:attr-xml-lang><code>lang</code> attributes in the <span>XML
  51650. namespace</span></a>.)</p>
  51651. <table><thead><tr><th> Attribute name <th> Prefix <th> Local name <th> Namespace
  51652. <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>
  51653. <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>
  51654. <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>
  51655. <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>
  51656. <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>
  51657. <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>
  51658. <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>
  51659. <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>
  51660. <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>
  51661. <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>
  51662. <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>
  51663. <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>
  51664. </table>
  51665. <hr>
  51666. <p>When the steps below require the user agent to <dfn id=insert-a-character>insert a character</dfn> while processing a
  51667. token, the user agent must run the following steps:</p>
  51668. <ol><li><p>Let <var>data</var> be the characters passed to the algorithm, or, if no
  51669. characters were explicitly specified, the character of the character token being
  51670. 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
  51671. place for inserting a node</a>.<li>
  51672. <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,
  51673. then abort these steps.
  51674. <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
  51675. children, so they are dropped on the floor.</p>
  51676. <li>
  51677. <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
  51678. 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>
  51679. <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
  51680. 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
  51681. element in which the <var>adjusted insertion location</var> finds itself, and insert
  51682. the newly created node at the <var>adjusted insertion location</var>.</p>
  51683. </ol>
  51684. <div class=example>
  51685. <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>
  51686. nodes that they result in, assuming a user agent that executes scripts.</p>
  51687. <table><thead><tr><th>Input <th>Number of <code id=creating-and-inserting-nodes:text-6><a href=#text>Text</a></code> nodes
  51688. <tbody><tr><td><pre>A&lt;script>
  51689. var script = document.getElementsByTagName('script')[0];
  51690. document.body.removeChild(script);
  51691. &lt;/script>B</pre>
  51692. <td>One <code id=creating-and-inserting-nodes:text-7><a href=#text>Text</a></code> node in the document, containing "AB".
  51693. <tr><td><pre>A&lt;script>
  51694. var text = document.createTextNode('B');
  51695. document.body.appendChild(text);
  51696. &lt;/script>C</pre>
  51697. <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).
  51698. <tr><td><pre>A&lt;script>
  51699. var text = document.getElementsByTagName('script')[0].firstChild;
  51700. text.data = 'B';
  51701. document.body.appendChild(text);
  51702. &lt;/script>C</pre>
  51703. <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".
  51704. <tr><td><pre>A&lt;table>B&lt;tr>C&lt;/tr>D&lt;/table></pre>
  51705. <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>.)
  51706. <tr><td><pre>A&lt;table>&lt;tr> B&lt;/tr> C&lt;/table></pre>
  51707. <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>.)
  51708. <tr><td><pre>A&lt;table>&lt;tr> B&lt;/tr> &lt;/em>C&lt;/table></pre>
  51709. <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.)
  51710. </table>
  51711. </div>
  51712. <hr>
  51713. <p>When the steps below require the user agent to <dfn id=insert-a-comment>insert a comment</dfn> while processing a
  51714. comment token, optionally with an explicitly insertion position <var>position</var>, the
  51715. user agent must run the following steps:</p>
  51716. <ol><li><p>Let <var>data</var> be the data given in the comment token being
  51717. processed.<li><p>If <var>position</var> was specified, then let the <var>adjusted
  51718. insertion location</var> be <var>position</var>. Otherwise, let <var>adjusted
  51719. 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
  51720. <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
  51721. the same as that of the node in which the <var>adjusted insertion location</var> finds
  51722. itself.</p>
  51723. <li><p>Insert the newly created node at the <var>adjusted insertion
  51724. location</var>.</ol>
  51725. <hr>
  51726. <p id=mutation-during-parsing>DOM mutation events must not fire for changes caused by the UA
  51727. 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>
  51728. <p>However, mutation observers <em>do</em> fire, as required by the DOM specification.</p>
  51729. <h5 id=parsing-elements-that-contain-only-text>12.2.5.2 Parsing elements that contain only text</h5>
  51730. <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
  51731. parsing algorithm</dfn> consist of the following steps. These algorithms are always invoked in
  51732. response to a start tag token.</p>
  51733. <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
  51734. 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
  51735. 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
  51736. 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
  51737. mode</a>.</p>
  51738. <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>
  51739. <h5 id=closing-elements-that-have-implied-end-tags>12.2.5.3 Closing elements that have implied end tags</h5>
  51740. <p>When the steps below require the UA to <dfn id=generate-implied-end-tags>generate implied end tags</dfn>, then, while the
  51741. <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
  51742. <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
  51743. <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
  51744. 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>
  51745. <p>If a step requires the UA to generate implied end tags but lists an element to exclude from the
  51746. process, then the UA must perform the above steps as if that element was not in the above
  51747. list.</p>
  51748. <p>When the steps below require the UA to <dfn id=generate-all-implied-end-tags-thoroughly>generate all implied end tags thoroughly</dfn>,
  51749. 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
  51750. <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
  51751. <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
  51752. <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
  51753. <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
  51754. <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
  51755. 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>
  51756. <h5 id=parsing-main-inhtml>12.2.5.4 The rules for parsing tokens in HTML content</h5>
  51757. <h6 id=the-initial-insertion-mode>12.2.5.4.1 The "<dfn>initial</dfn>" insertion mode</h6>
  51758. <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
  51759. follows:</p>
  51760. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
  51761. TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
  51762. U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  51763. <p>Ignore the token.</p>
  51764. <dt>A comment token<dd>
  51765. <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>
  51766. <dt>A DOCTYPE token<dd>
  51767. <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
  51768. 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
  51769. "<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
  51770. matched, then there is a <a href=#parse-error id=the-initial-insertion-mode:parse-error>parse error</a>.</p>
  51771. <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
  51772. "<code>-//W3C//DTD HTML 4.0//EN</code>", and the token's system identifier
  51773. 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
  51774. "<code>-//W3C//DTD HTML 4.01//EN</code>", and the token's system identifier
  51775. 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
  51776. "<code>-//W3C//DTD XHTML 1.0 Strict//EN</code>", and the token's system
  51777. 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
  51778. "<code>-//W3C//DTD XHTML 1.1//EN</code>", and the token's system identifier
  51779. 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>
  51780. <p>Conformance checkers may, based on the values (including presence or lack thereof) of the
  51781. DOCTYPE token's name, public identifier, or system identifier, switch to a conformance checking
  51782. mode for another language (e.g. based on the DOCTYPE token a conformance checker could recognise
  51783. that the document is an HTML4-era document, and defer to an HTML4 conformance checker.)</p>
  51784. <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
  51785. if the name was missing; the <code>publicId</code> attribute set to the public
  51786. identifier given in the DOCTYPE token, or the empty string if the public identifier was missing;
  51787. the <code>systemId</code> attribute set to the system identifier given in the DOCTYPE
  51788. token, or the empty string if the system identifier was missing; and the other attributes
  51789. 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.
  51790. 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
  51791. returned as the value of the <code>doctype</code> attribute of the
  51792. <code id=the-initial-insertion-mode:document-4><a href=#document>Document</a></code> object.</p>
  51793. <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>
  51794. <code>srcdoc</code> document</a>, and the DOCTYPE token matches
  51795. 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
  51796. mode</a>:</p>
  51797. <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>
  51798. <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
  51799. 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
  51800. mode</a>:</p>
  51801. <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>
  51802. <p>The system identifier and public identifier strings must be compared to the values given in
  51803. 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
  51804. value is the empty string is not considered missing for the purposes of the conditions
  51805. above.</p>
  51806. <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>
  51807. <dt>Anything else<dd>
  51808. <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
  51809. 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>
  51810. <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>
  51811. </dl>
  51812. <h6 id=the-before-html-insertion-mode>12.2.5.4.2 The "<dfn>before html</dfn>" insertion mode</h6>
  51813. <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
  51814. follows:</p>
  51815. <dl class=switch><dt>A DOCTYPE token<dd>
  51816. <p><a href=#parse-error id=the-before-html-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
  51817. <dt>A comment token<dd>
  51818. <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>
  51819. <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  51820. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  51821. <p>Ignore the token.</p>
  51822. <dt>A start tag whose tag name is "html"<dd>
  51823. <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
  51824. <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
  51825. 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>
  51826. <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
  51827. 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
  51828. 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
  51829. 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
  51830. successful, run the <a href=#concept-appcache-init id=the-before-html-insertion-mode:concept-appcache-init>application cache selection
  51831. algorithm</a> with the result of applying the <a href=#concept-url-serialiser id=the-before-html-insertion-mode:concept-url-serialiser>URL
  51832. 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
  51833. fragment flag</i> set; otherwise, if there is no such attribute, or its value is the empty
  51834. string, or resolving its value fails, run the <a href=#concept-appcache-init id=the-before-html-insertion-mode:concept-appcache-init-2>application
  51835. cache selection algorithm</a> with no manifest. The algorithm must be passed the
  51836. <code id=the-before-html-insertion-mode:document-5><a href=#document>Document</a></code> object.</p>
  51837. <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
  51838. head</a>".</p>
  51839. <dt>An end tag whose tag name is one of: "head", "body", "html", "br"<dd>
  51840. <p>Act as described in the "anything else" entry below.</p>
  51841. <dt>Any other end tag<dd>
  51842. <p><a href=#parse-error id=the-before-html-insertion-mode:parse-error-2>Parse error</a>. Ignore the token.</p>
  51843. <dt>Anything else<dd>
  51844. <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
  51845. 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
  51846. elements</a>.</p>
  51847. <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,
  51848. passing it the <code id=the-before-html-insertion-mode:document-9><a href=#document>Document</a></code> object.</p>
  51849. <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
  51850. head</a>", then reprocess the token.</p>
  51851. </dl>
  51852. <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
  51853. scripts; nothing in particular happens in such cases, content continues being appended to the
  51854. nodes as described in the next section.</p>
  51855. <h6 id=the-before-head-insertion-mode>12.2.5.4.3 The "<dfn>before head</dfn>" insertion mode</h6>
  51856. <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
  51857. follows:</p>
  51858. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
  51859. TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
  51860. U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  51861. <p>Ignore the token.</p>
  51862. <dt>A comment token<dd>
  51863. <p><a href=#insert-a-comment id=the-before-head-insertion-mode:insert-a-comment>Insert a comment</a>.</p>
  51864. <dt>A DOCTYPE token<dd>
  51865. <p><a href=#parse-error id=the-before-head-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
  51866. <dt>A start tag whose tag name is "html"<dd>
  51867. <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>
  51868. <dt>A start tag whose tag name is "head"<dd>
  51869. <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>
  51870. <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
  51871. <code id=the-before-head-insertion-mode:the-head-element><a href=#the-head-element>head</a></code> element.</p>
  51872. <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
  51873. head</a>".</p>
  51874. <dt>An end tag whose tag name is one of: "head", "body", "html", "br"<dd>
  51875. <p>Act as described in the "anything else" entry below.</p>
  51876. <dt>Any other end tag<dd>
  51877. <p><a href=#parse-error id=the-before-head-insertion-mode:parse-error-2>Parse error</a>. Ignore the token.</p>
  51878. <dt>Anything else<dd>
  51879. <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>
  51880. <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
  51881. <code id=the-before-head-insertion-mode:the-head-element-2><a href=#the-head-element>head</a></code> element.</p>
  51882. <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
  51883. head</a>".</p>
  51884. <p>Reprocess the current token.</p>
  51885. </dl>
  51886. <h6 id=parsing-main-inhead>12.2.5.4.4 The "<dfn>in head</dfn>" insertion mode</h6>
  51887. <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
  51888. 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>
  51889. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
  51890. TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
  51891. U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  51892. <p><a href=#insert-a-character id=parsing-main-inhead:insert-a-character>Insert the character</a>.</p>
  51893. <dt>A comment token<dd>
  51894. <p><a href=#insert-a-comment id=parsing-main-inhead:insert-a-comment>Insert a comment</a>.</p>
  51895. <dt>A DOCTYPE token<dd>
  51896. <p><a href=#parse-error id=parsing-main-inhead:parse-error>Parse error</a>. Ignore the token.</p>
  51897. <dt>A start tag whose tag name is "html"<dd>
  51898. <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>
  51899. <dt>A start tag whose tag name is one of: "base", "basefont",
  51900. "bgsound", "link"<dd>
  51901. <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
  51902. node</a> off the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements>stack of open elements</a>.</p>
  51903. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inhead:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  51904. flag</i></a>, if it is set.</p>
  51905. <dt>A start tag whose tag name is "meta"<dd>
  51906. <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
  51907. 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>
  51908. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inhead:acknowledge-self-closing-flag-2>Acknowledge the token's <i>self-closing
  51909. flag</i></a>, if it is set.</p>
  51910. <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
  51911. 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
  51912. UTF-16 encoding</a>, and the <a href=#concept-encoding-confidence id=parsing-main-inhead:concept-encoding-confidence>confidence</a> is
  51913. 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>
  51914. <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>
  51915. 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
  51916. extracting a character encoding from a <code>meta</code> element</a> to that attribute's
  51917. 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
  51918. encoding</a>, and the <a href=#concept-encoding-confidence id=parsing-main-inhead:concept-encoding-confidence-2>confidence</a> is
  51919. 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>
  51920. <dt>A start tag whose tag name is "title"<dd>
  51921. <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>
  51922. <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>
  51923. <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>
  51924. <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>
  51925. <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>
  51926. <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
  51927. head noscript</a>".</p>
  51928. <dt id=scriptTag>A start tag whose tag name is "script"<dd>
  51929. <p>Run these steps:</p>
  51930. <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
  51931. 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
  51932. the intended parent being the element in which the <var>adjusted insertion
  51933. location</var> finds itself.<li>
  51934. <p>Mark the element as being <a href=#parser-inserted id=parsing-main-inhead:parser-inserted>"parser-inserted"</a> and unset the element's
  51935. <a href=#force-async id=parsing-main-inhead:force-async>"force-async"</a> flag.</p>
  51936. <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,
  51937. instead of blowing the document away, as would happen in most other cases. It also prevents
  51938. the script from executing until the end tag is seen.</p>
  51939. <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
  51940. 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>.
  51941. (<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
  51942. 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
  51943. <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
  51944. mode</a>.</p>
  51945. <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>
  51946. <dt>An end tag whose tag name is "head"<dd>
  51947. <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
  51948. <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-4>stack of open elements</a>.</p>
  51949. <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
  51950. head</a>".</p>
  51951. <dt>An end tag whose tag name is one of: "body", "html", "br"<dd>
  51952. <p>Act as described in the "anything else" entry below.</p>
  51953. <dt>A start tag whose tag name is "template"<dd>
  51954. <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>
  51955. <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
  51956. active formatting elements</a>.</p>
  51957. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inhead:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
  51958. <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
  51959. template</a>".</p>
  51960. <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
  51961. 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
  51962. mode</a>.</p>
  51963. <dt>An end tag whose tag name is "template"<dd>
  51964. <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
  51965. this is a <a href=#parse-error id=parsing-main-inhead:parse-error-2>parse error</a>; ignore the token.</p>
  51966. <p>Otherwise, run these steps:</p>
  51967. <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
  51968. <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>
  51969. 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
  51970. insertion modes</a>.</p>
  51971. <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>
  51972. <dt>A start tag whose tag name is "head"<dt>Any other end tag<dd>
  51973. <p><a href=#parse-error id=parsing-main-inhead:parse-error-4>Parse error</a>. Ignore the token.</p>
  51974. <dt>Anything else<dd>
  51975. <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
  51976. <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-7>stack of open elements</a>.</p>
  51977. <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
  51978. head</a>".</p>
  51979. <p>Reprocess the token.</p>
  51980. </dl>
  51981. <h6 id=parsing-main-inheadnoscript>12.2.5.4.5 The "<dfn>in head noscript</dfn>" insertion mode</h6>
  51982. <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
  51983. token as follows:</p>
  51984. <dl class=switch><dt>A DOCTYPE token<dd>
  51985. <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error>Parse error</a>. Ignore the token.</p>
  51986. <dt>A start tag whose tag name is "html"<dd>
  51987. <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>
  51988. <dt>An end tag whose tag name is "noscript"<dd>
  51989. <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
  51990. <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
  51991. <code id=parsing-main-inheadnoscript:the-head-element><a href=#the-head-element>head</a></code> element.</p>
  51992. <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
  51993. head</a>".</p>
  51994. <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  51995. 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",
  51996. "style"<dd>
  51997. <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>
  51998. <dt>An end tag whose tag name is "br"<dd>
  51999. <p>Act as described in the "anything else" entry below.</p>
  52000. <dt>A start tag whose tag name is one of: "head", "noscript"<dt>Any other end tag<dd>
  52001. <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error-2>Parse error</a>. Ignore the token.</p>
  52002. <dt>Anything else<dd>
  52003. <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error-3>Parse error</a>.</p>
  52004. <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
  52005. <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
  52006. <code id=parsing-main-inheadnoscript:the-head-element-2><a href=#the-head-element>head</a></code> element.</p>
  52007. <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
  52008. head</a>".</p>
  52009. <p>Reprocess the token.</p>
  52010. </dl>
  52011. <h6 id=the-after-head-insertion-mode>12.2.5.4.6 The "<dfn>after head</dfn>" insertion mode</h6>
  52012. <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
  52013. follows:</p>
  52014. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
  52015. TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
  52016. U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  52017. <p><a href=#insert-a-character id=the-after-head-insertion-mode:insert-a-character>Insert the character</a>.</p>
  52018. <dt>A comment token<dd>
  52019. <p><a href=#insert-a-comment id=the-after-head-insertion-mode:insert-a-comment>Insert a comment</a>.</p>
  52020. <dt>A DOCTYPE token<dd>
  52021. <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
  52022. <dt>A start tag whose tag name is "html"<dd>
  52023. <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>
  52024. <dt>A start tag whose tag name is "body"<dd>
  52025. <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>
  52026. <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>
  52027. <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
  52028. body</a>".</p>
  52029. <dt>A start tag whose tag name is "frameset"<dd>
  52030. <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>
  52031. <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
  52032. frameset</a>".</p>
  52033. <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
  52034. "noframes", "script", "style", "template", "title"<dd>
  52035. <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error-2>Parse error</a>.</p>
  52036. <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
  52037. the <a href=#stack-of-open-elements id=the-after-head-insertion-mode:stack-of-open-elements>stack of open elements</a>.</p>
  52038. <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>
  52039. <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>
  52040. 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
  52041. this point.)</p>
  52042. <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
  52043. this point.</p>
  52044. <dt>An end tag whose tag name is "template"<dd>
  52045. <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>
  52046. <dt>An end tag whose tag name is one of: "body", "html", "br"<dd>
  52047. <p>Act as described in the "anything else" entry below.</p>
  52048. <dt>A start tag whose tag name is "head"<dt>Any other end tag<dd>
  52049. <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error-3>Parse error</a>. Ignore the token.</p>
  52050. <dt>Anything else<dd>
  52051. <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>
  52052. <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
  52053. body</a>".</p>
  52054. <p>Reprocess the current token.</p>
  52055. </dl>
  52056. <h6 id=parsing-main-inbody>12.2.5.4.7 The "<dfn>in body</dfn>" insertion mode</h6>
  52057. <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
  52058. 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>
  52059. <dl class=switch><dt>A character token that is U+0000 NULL<dd>
  52060. <p><a href=#parse-error id=parsing-main-inbody:parse-error>Parse error</a>. Ignore the token.</p>
  52061. <dt>A character token that is one of U+0009 CHARACTER TABULATION,
  52062. U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE
  52063. RETURN (CR), or U+0020 SPACE<dd>
  52064. <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>
  52065. <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character>Insert the token's character</a>.</p>
  52066. <dt>Any other character token<dd>
  52067. <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>
  52068. <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character-2>Insert the token's character</a>.</p>
  52069. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
  52070. <dt>A comment token<dd>
  52071. <p><a href=#insert-a-comment id=parsing-main-inbody:insert-a-comment>Insert a comment</a>.</p>
  52072. <dt>A DOCTYPE token<dd>
  52073. <p><a href=#parse-error id=parsing-main-inbody:parse-error-2>Parse error</a>. Ignore the token.</p>
  52074. <dt>A start tag whose tag name is "html"<dd>
  52075. <p><a href=#parse-error id=parsing-main-inbody:parse-error-3>Parse error</a>.</p>
  52076. <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
  52077. ignore the token.</p>
  52078. <p>Otherwise, for each attribute on the token, check to see if the attribute is already present
  52079. 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
  52080. and its corresponding value to that element.</p>
  52081. <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
  52082. "noframes", "script", "style", "template", "title"<dt>An end tag whose tag name is "template"<dd>
  52083. <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>
  52084. <dt>A start tag whose tag name is "body"<dd>
  52085. <p><a href=#parse-error id=parsing-main-inbody:parse-error-4>Parse error</a>.</p>
  52086. <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>
  52087. 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
  52088. <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.
  52089. (<a href=#fragment-case id=parsing-main-inbody:fragment-case>fragment case</a>)</p>
  52090. <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
  52091. 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
  52092. 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
  52093. and its corresponding value to that element.</p>
  52094. <dt>A start tag whose tag name is "frameset"<dd>
  52095. <p><a href=#parse-error id=parsing-main-inbody:parse-error-5>Parse error</a>.</p>
  52096. <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
  52097. 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
  52098. token. (<a href=#fragment-case id=parsing-main-inbody:fragment-case-2>fragment case</a>)</p>
  52099. <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>
  52100. <p>Otherwise, run the following steps:</p>
  52101. <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
  52102. 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
  52103. <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>
  52104. <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
  52105. frameset</a>".</p>
  52106. </ol>
  52107. <dt>An end-of-file token<dd>
  52108. <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
  52109. <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
  52110. template</a>" <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-4>insertion mode</a>.</p>
  52111. <p>Otherwise, follow these steps:</p>
  52112. <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
  52113. <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
  52114. <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
  52115. <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
  52116. <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
  52117. <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
  52118. <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>
  52119. <dt>An end tag whose tag name is "body"<dd>
  52120. <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>;
  52121. ignore the token.</p>
  52122. <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
  52123. <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
  52124. <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
  52125. <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
  52126. <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
  52127. <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
  52128. <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>
  52129. <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
  52130. body</a>".</p>
  52131. <dt>An end tag whose tag name is "html"<dd>
  52132. <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>;
  52133. ignore the token.</p>
  52134. <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
  52135. <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
  52136. <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
  52137. <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
  52138. <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
  52139. <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
  52140. <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>
  52141. <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
  52142. body</a>".</p>
  52143. <p>Reprocess the token.</p>
  52144. <dt>A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center",
  52145. "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
  52146. "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"<dd>
  52147. <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
  52148. <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>
  52149. element</a>.</p>
  52150. <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>
  52151. <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
  52152. "h5", "h6"<dd>
  52153. <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
  52154. <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>
  52155. element</a>.</p>
  52156. <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
  52157. 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
  52158. 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>
  52159. <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>
  52160. <dt>A start tag whose tag name is one of: "pre", "listing"<dd>
  52161. <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
  52162. 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>
  52163. element</a>.</p>
  52164. <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>
  52165. <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
  52166. 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
  52167. as an authoring convenience.)</p>
  52168. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-4>frameset-ok flag</a> to "not ok".</p>
  52169. <dt>A start tag whose tag name is "form"<dd>
  52170. <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
  52171. 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
  52172. <a href=#parse-error id=parsing-main-inbody:parse-error-12>parse error</a>; ignore the token.</p>
  52173. <p>Otherwise:</p>
  52174. <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
  52175. 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>
  52176. element</a>.</p>
  52177. <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>
  52178. 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>
  52179. <dt>A start tag whose tag name is "li"<dd>
  52180. <p>Run these steps:</p>
  52181. <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
  52182. node</a> (the bottommost node of the stack).<li>
  52183. <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
  52184. substeps:</p>
  52185. <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
  52186. <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>
  52187. element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
  52188. <li><p>If <var>node</var> is in the <a href=#special id=parsing-main-inbody:special>special</a> category, but is not an
  52189. <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
  52190. 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
  52191. 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
  52192. <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>
  52193. <dt>A start tag whose tag name is one of: "dd", "dt"<dd>
  52194. <p>Run these steps:</p>
  52195. <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
  52196. node</a> (the bottommost node of the stack).<li>
  52197. <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
  52198. substeps:</p>
  52199. <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
  52200. <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>
  52201. element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
  52202. <li>
  52203. <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>
  52204. <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
  52205. <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>
  52206. element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
  52207. <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
  52208. <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
  52209. 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
  52210. 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
  52211. <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>
  52212. <dt>A start tag whose tag name is "plaintext"<dd>
  52213. <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
  52214. <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>
  52215. element</a>.</p>
  52216. <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>
  52217. <p>Switch the tokenizer to the <a href=#plaintext-state id=parsing-main-inbody:plaintext-state>PLAINTEXT state</a>.</p>
  52218. <p class=note>Once a start tag with the tag name "plaintext" has been seen, that will be the
  52219. last token ever seen other than character tokens (and the end-of-file token), because there is
  52220. no way to switch out of the <a href=#plaintext-state id=parsing-main-inbody:plaintext-state-2>PLAINTEXT state</a>.</p>
  52221. <dt>A start tag whose tag name is "button"<dd>
  52222. <ol><li>
  52223. <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
  52224. <code>button</code> element in scope</a>, then run these substeps:</p>
  52225. <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>
  52226. element has been popped from the stack.</ol>
  52227. <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>
  52228. <dt>An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button",
  52229. "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
  52230. "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary",
  52231. "ul"<dd>
  52232. <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
  52233. 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
  52234. error</a>; ignore the token.</p>
  52235. <p>Otherwise, run these steps:</p>
  52236. <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
  52237. the same tag name as that of the token, then this is a
  52238. <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
  52239. stack.</ol>
  52240. <dt>An end tag whose tag name is "form"<dd>
  52241. <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
  52242. run these substeps:</p>
  52243. <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>
  52244. 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
  52245. 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
  52246. 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
  52247. <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>
  52248. <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
  52249. elements</a>, then run these substeps instead:</p>
  52250. <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
  52251. 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
  52252. <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>
  52253. element has been popped from the stack.</ol>
  52254. <dt>An end tag whose tag name is "p"<dd>
  52255. <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
  52256. 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
  52257. attributes.</p>
  52258. <p><a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-8>Close a <code>p</code> element</a>.</p>
  52259. <dt>An end tag whose tag name is "li"<dd>
  52260. <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
  52261. error</a>; ignore the token.</p>
  52262. <p>Otherwise, run these steps:</p>
  52263. <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
  52264. <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>
  52265. element has been popped from the stack.</ol>
  52266. <dt>An end tag whose tag name is one of: "dd", "dt"<dd>
  52267. <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
  52268. 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
  52269. error</a>; ignore the token.</p>
  52270. <p>Otherwise, run these steps:</p>
  52271. <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
  52272. 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
  52273. 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
  52274. 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
  52275. stack.</ol>
  52276. <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"<dd>
  52277. <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
  52278. element</a> and whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is
  52279. a <a href=#parse-error id=parsing-main-inbody:parse-error-28>parse error</a>; ignore the token.</p>
  52280. <p>Otherwise, run these steps:</p>
  52281. <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
  52282. 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
  52283. 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"
  52284. has been popped from the stack.</ol>
  52285. <dt>An end tag whose tag name is "sarcasm"<dd>
  52286. <p>Take a deep breath, then act as described in the "any other end
  52287. tag" entry below.</p>
  52288. <dt>A start tag whose tag name is "a"<dd>
  52289. <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
  52290. between the end of the list and the last <a href=#concept-parser-marker id=parsing-main-inbody:concept-parser-marker>marker</a> on
  52291. 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
  52292. 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
  52293. 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
  52294. 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
  52295. 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
  52296. scope</a>).</p>
  52297. <p class=example>In the non-conforming stream
  52298. <code>&lt;a href="a">a&lt;table>&lt;a href="b">b&lt;/table>x</code>, the first
  52299. <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
  52300. 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>
  52301. element is not in table scope (meaning that a regular <code>&lt;/a></code> end tag at the start
  52302. 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
  52303. <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
  52304. will often result in non-conforming DOMs when parsed.</p>
  52305. <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>
  52306. <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
  52307. formatting elements</a> that element.</p>
  52308. <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
  52309. "font", "i", "s", "small", "strike", "strong", "tt", "u"<dd>
  52310. <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>
  52311. <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
  52312. formatting elements</a> that element.</p>
  52313. <dt>A start tag whose tag name is "nobr"<dd>
  52314. <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>
  52315. <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
  52316. <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
  52317. <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
  52318. <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>
  52319. <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
  52320. formatting elements</a> that element.</p>
  52321. <dt>An end tag whose tag name is one of: "a",
  52322. "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
  52323. "strike", "strong", "tt", "u"<dd>
  52324. <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>
  52325. <dt>A start tag whose tag name is one of: "applet", "marquee", "object"<dd>
  52326. <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>
  52327. <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>
  52328. <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
  52329. active formatting elements</a>.</p>
  52330. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-8>frameset-ok flag</a> to "not ok".</p>
  52331. <dt>An end tag token whose tag name is one of: "applet", "marquee", "object"<dd>
  52332. <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
  52333. 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
  52334. error</a>; ignore the token.</p>
  52335. <p>Otherwise, run these steps:</p>
  52336. <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
  52337. 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
  52338. 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
  52339. 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>
  52340. <dt>A start tag whose tag name is "table"<dd>
  52341. <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
  52342. <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
  52343. <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>
  52344. element</a>.</p>
  52345. <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>
  52346. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-9>frameset-ok flag</a> to "not ok".</p>
  52347. <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
  52348. table</a>".</p>
  52349. <dt>An end tag whose tag name is "br"<dd>
  52350. <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
  52351. next entry; i.e. act as if this was a "br" start tag token with no attributes, rather than the
  52352. end tag token that it actually is.</p>
  52353. <dt>A start tag whose tag name is one of: "area", "br", "embed",
  52354. "img", "keygen", "wbr"<dd>
  52355. <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>
  52356. <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
  52357. 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>
  52358. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  52359. flag</i></a>, if it is set.</p>
  52360. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-10>frameset-ok flag</a> to "not ok".</p>
  52361. <dt>A start tag whose tag name is "input"<dd>
  52362. <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>
  52363. <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
  52364. 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>
  52365. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-2>Acknowledge the token's <i>self-closing
  52366. flag</i></a>, if it is set.</p>
  52367. <p>If the token does not have an attribute with the name "type", or if it does, but that
  52368. 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>
  52369. <dt>A start tag whose tag name is one of: "menuitem", "param", "source", "track"<dd>
  52370. <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
  52371. 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>
  52372. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-3>Acknowledge the token's <i>self-closing
  52373. flag</i></a>, if it is set.</p>
  52374. <dt>A start tag whose tag name is "hr"<dd>
  52375. <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
  52376. <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>
  52377. element</a>.</p>
  52378. <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
  52379. 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>
  52380. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-4>Acknowledge the token's <i>self-closing
  52381. flag</i></a>, if it is set.</p>
  52382. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-12>frameset-ok flag</a> to "not ok".</p>
  52383. <dt>A start tag whose tag name is "image"<dd>
  52384. <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
  52385. ask.)</p>
  52386. <dt id=isindex>A start tag whose tag name is "isindex"<dd>
  52387. <p><a href=#parse-error id=parsing-main-inbody:parse-error-36>Parse error</a>.</p>
  52388. <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
  52389. 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
  52390. token.</p>
  52391. <p>Otherwise:</p>
  52392. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-5>Acknowledge the token's <i>self-closing
  52393. flag</i></a>, if it is set.</p>
  52394. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-13>frameset-ok flag</a> to "not ok".</p>
  52395. <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
  52396. <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>
  52397. element</a>.</p>
  52398. <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
  52399. 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
  52400. <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-6><code>form</code> element pointer</a> to point to the element
  52401. created.</p>
  52402. <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
  52403. value of the "action" attribute of the token.</p>
  52404. <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.
  52405. 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>
  52406. <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>
  52407. <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>
  52408. <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>
  52409. <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
  52410. from the "isindex" token except "name", "action", and "prompt", and with an attribute named
  52411. "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
  52412. the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-62>stack of open elements</a>.</p>
  52413. <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>
  52414. <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
  52415. earlier) off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-63>stack of open elements</a>.</p>
  52416. <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.
  52417. 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>
  52418. <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
  52419. 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>
  52420. 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>
  52421. <p><dfn id=attr-isindex-prompt><strong>Prompt</strong></dfn>: If the token has an attribute
  52422. with the name "prompt", then the first stream of characters must be the same string as given in
  52423. that attribute, and the second stream of characters must be empty. Otherwise, the two streams of
  52424. 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
  52425. equivalent of "This is a searchable index. Enter search keywords: (input field)" in the user's
  52426. preferred language.</p>
  52427. <dt>A start tag whose tag name is "textarea"<dd>
  52428. <p>Run these steps:</p>
  52429. <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
  52430. 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>
  52431. 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
  52432. mode</a>.</p>
  52433. <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>
  52434. <dt>A start tag whose tag name is "xmp"<dd>
  52435. <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
  52436. <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>
  52437. element</a>.</p>
  52438. <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>
  52439. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-15>frameset-ok flag</a> to "not ok".</p>
  52440. <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>
  52441. <dt>A start tag whose tag name is "iframe"<dd>
  52442. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-16>frameset-ok flag</a> to "not ok".</p>
  52443. <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>
  52444. <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>
  52445. <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>
  52446. <dt>A start tag whose tag name is "select"<dd>
  52447. <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>
  52448. <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>
  52449. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-17>frameset-ok flag</a> to "not ok".</p>
  52450. <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
  52451. 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
  52452. <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
  52453. 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>
  52454. <dt>A start tag whose tag name is one of: "optgroup", "option"<dd>
  52455. <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
  52456. <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>
  52457. <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>
  52458. <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>
  52459. <dt>A start tag whose tag name is one of: "rp", "rt"<dd>
  52460. <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
  52461. <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
  52462. <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
  52463. error</a>.</p>
  52464. <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>
  52465. <dt>A start tag whose tag name is "math"<dd>
  52466. <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>
  52467. <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
  52468. attributes that are not all lowercase.)</p>
  52469. <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
  52470. attributes, in particular XLink.)</p>
  52471. <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
  52472. namespace</a>.</p>
  52473. <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
  52474. <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
  52475. the token's <i>self-closing flag</i></a>.</p>
  52476. <dt>A start tag whose tag name is "svg"<dd>
  52477. <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>
  52478. <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
  52479. are not all lowercase.)</p>
  52480. <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
  52481. attributes, in particular XLink in SVG.)</p>
  52482. <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>
  52483. <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
  52484. <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
  52485. the token's <i>self-closing flag</i></a>.</p>
  52486. <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "frame",
  52487. "head", "tbody", "td", "tfoot", "th", "thead", "tr"<dd>
  52488. <p><a href=#parse-error id=parsing-main-inbody:parse-error-38>Parse error</a>. Ignore the token.</p>
  52489. <dt>Any other start tag<dd>
  52490. <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>
  52491. <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>
  52492. <p class=note>This element will be an <a href=#ordinary id=parsing-main-inbody:ordinary>ordinary</a>
  52493. element.</p>
  52494. <dt>Any other end tag<dd>
  52495. <p>Run these steps:</p>
  52496. <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
  52497. 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
  52498. element</a> with the same tag name as the token, then:</p>
  52499. <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
  52500. 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
  52501. <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>,
  52502. including <var>node</var>, then stop these steps.</ol>
  52503. <li><p>Otherwise, if <var>node</var> is in the <a href=#special id=parsing-main-inbody:special-3>special</a> category, then
  52504. 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
  52505. elements</a>.<li><p>Return to the step labeled <i>loop</i>.</ol>
  52506. </dl>
  52507. <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
  52508. means that the user agent must run the following steps:</p>
  52509. <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
  52510. <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
  52511. has been popped from the stack.</ol>
  52512. <p id=adoptionAgency>The <dfn id=adoption-agency-algorithm>adoption agency algorithm</dfn>, which takes as its only argument
  52513. a tag name <var>subject</var> for which the algorithm is being run, consists of the
  52514. following steps:</p>
  52515. <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>
  52516. 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
  52517. <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
  52518. <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
  52519. eight, then abort these steps.<li><p>Increment <var>outer loop counter</var> by one.<li>
  52520. <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
  52521. formatting elements</a> that:</p>
  52522. <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
  52523. otherwise, and<li>has the tag name <var>subject</var>.</ul>
  52524. <p>If there is no such element, then abort these steps and instead act as described in the "any
  52525. other end tag" entry above.</p>
  52526. <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
  52527. 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
  52528. 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>,
  52529. 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
  52530. <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
  52531. <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
  52532. elements</a> that is lower in the stack than <var>formatting element</var>, and is an
  52533. 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
  52534. 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
  52535. 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
  52536. 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
  52537. <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
  52538. the list.<li>
  52539. <p>Let <var>node</var> and <var>last node</var> be <var>furthest
  52540. block</var>. Follow these steps:</p>
  52541. <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>
  52542. 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
  52543. <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>
  52544. was removed.<li><p>If <var>node</var> is <var>formatting element</var>, then go to the
  52545. 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
  52546. 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
  52547. 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
  52548. ancestor</var> as the intended parent; replace the entry for <var>node</var> in the
  52549. <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
  52550. 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
  52551. 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
  52552. aforementioned bookmark to be immediately after the new <var>node</var> in the
  52553. <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
  52554. 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>
  52555. <li><p>Insert whatever <var>last node</var> ended up being in the previous step at the
  52556. <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
  52557. 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
  52558. 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
  52559. block</var> as the intended parent.<li><p>Take all of the child nodes of <var>furthest block</var> and append them to the
  52560. 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
  52561. 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
  52562. 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
  52563. 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>
  52564. 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>
  52565. <p class=note>This algorithm's name, the "adoption agency algorithm", comes from the way it
  52566. causes elements to change parents, and is in contrast with other possible algorithms for dealing
  52567. with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
  52568. the "Heisenberg algorithm".</p>
  52569. <h6 id=parsing-main-incdata>12.2.5.4.8 The "<dfn>text</dfn>" insertion mode</h6>
  52570. <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
  52571. follows:</p>
  52572. <dl class=switch><dt>A character token<dd>
  52573. <p><a href=#insert-a-character id=parsing-main-incdata:insert-a-character>Insert the token's character</a>.</p>
  52574. <p class=note>This can never be a U+0000 NULL character; the tokenizer converts those to
  52575. U+FFFD REPLACEMENT CHARACTER characters.</p>
  52576. <dt>An end-of-file token<dd>
  52577. <p><a href=#parse-error id=parsing-main-incdata:parse-error>Parse error</a>.</p>
  52578. <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
  52579. <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>
  52580. <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>
  52581. <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
  52582. reprocess the token.</p>
  52583. <dt id=scriptEndTag>An end tag whose tag name is "script"<dd>
  52584. <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>
  52585. <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
  52586. <code id=parsing-main-incdata:the-script-element-3><a href=#the-script-element>script</a></code> element).</p>
  52587. <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>
  52588. <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>
  52589. <p>Let the <var>old insertion point</var> have the same value as the current
  52590. <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
  52591. input character</a>.</p>
  52592. <p>Increment the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level>script nesting level</a> by one.</p>
  52593. <p><a href=#prepare-a-script id=parsing-main-incdata:prepare-a-script>Prepare</a> the <var>script</var>. This might
  52594. cause some script to execute, which might cause <a href=#dom-document-write id=parsing-main-incdata:dom-document-write>new characters
  52595. to be inserted into the tokenizer</a>, and might cause the tokenizer to output more tokens,
  52596. resulting in a <a href=#nestedParsing>reentrant invocation of the parser</a>.</p>
  52597. <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
  52598. 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>
  52599. <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
  52600. 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.
  52601. This value might be the "undefined" value.)</p>
  52602. <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
  52603. script</a>, then:</p>
  52604. <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>
  52605. <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
  52606. invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume
  52607. when the caller returns to the "outer" tree construction stage.)</p>
  52608. <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>
  52609. <dt>Otherwise:<dd>
  52610. <p>Run these steps:</p>
  52611. <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
  52612. 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
  52613. <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
  52614. 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>
  52615. 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>
  52616. <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
  52617. <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>
  52618. <p>If this <a href=#abort-a-parser id=parsing-main-incdata:abort-a-parser>parser has been aborted</a> in the meantime,
  52619. abort these steps.</p>
  52620. <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>
  52621. 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
  52622. <code id=parsing-main-incdata:document-3><a href=#document>Document</a></code>.</p>
  52623. <li><p>Unblock the <a href=#tokenization id=parsing-main-incdata:tokenization-3>tokenizer</a> for this instance of the
  52624. <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
  52625. <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
  52626. 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
  52627. 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
  52628. 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
  52629. <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
  52630. the <a href=#parser-pause-flag id=parsing-main-incdata:parser-pause-flag-3>parser pause flag</a> to false.</p>
  52631. <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
  52632. these steps from step 1.</ol>
  52633. </dl>
  52634. <dt>Any other end tag<dd>
  52635. <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>
  52636. <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>
  52637. </dl>
  52638. <h6 id=parsing-main-intable>12.2.5.4.9 The "<dfn>in table</dfn>" insertion mode</h6>
  52639. <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
  52640. 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>
  52641. <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>
  52642. <p>Let the <dfn id=concept-pending-table-char-tokens><var>pending table character
  52643. tokens</var></dfn> be an empty list of tokens.</p>
  52644. <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>
  52645. <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
  52646. table text</a>" and reprocess the token.</p>
  52647. <dt>A comment token<dd>
  52648. <p><a href=#insert-a-comment id=parsing-main-intable:insert-a-comment>Insert a comment</a>.</p>
  52649. <dt>A DOCTYPE token<dd>
  52650. <p><a href=#parse-error id=parsing-main-intable:parse-error>Parse error</a>. Ignore the token.</p>
  52651. <dt>A start tag whose tag name is "caption"<dd>
  52652. <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>
  52653. <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
  52654. active formatting elements</a>.</p>
  52655. <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
  52656. mode</a> to "<a href=#parsing-main-incaption id=parsing-main-intable:parsing-main-incaption>in caption</a>".</p>
  52657. <dt>A start tag whose tag name is "colgroup"<dd>
  52658. <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>
  52659. <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
  52660. mode</a> to "<a href=#parsing-main-incolgroup id=parsing-main-intable:parsing-main-incolgroup>in column group</a>".</p>
  52661. <dt>A start tag whose tag name is "col"<dd>
  52662. <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>
  52663. <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
  52664. 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
  52665. column group</a>".</p>
  52666. <p>Reprocess the current token.</p>
  52667. <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"<dd>
  52668. <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>
  52669. <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
  52670. mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intable:parsing-main-intbody>in table body</a>".</p>
  52671. <dt>A start tag whose tag name is one of: "td", "th", "tr"<dd>
  52672. <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>
  52673. <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
  52674. 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
  52675. body</a>".</p>
  52676. <p>Reprocess the current token.</p>
  52677. <dt>A start tag whose tag name is "table"<dd>
  52678. <p><a href=#parse-error id=parsing-main-intable:parse-error-2>Parse error</a>.</p>
  52679. <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>
  52680. <p>Otherwise:</p>
  52681. <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
  52682. stack.</p>
  52683. <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-intable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
  52684. <p>Reprocess the token.</p>
  52685. <dt>An end tag whose tag name is "table"<dd>
  52686. <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
  52687. error</a>; ignore the token.</p>
  52688. <p>Otherwise:</p>
  52689. <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
  52690. stack.</p>
  52691. <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>
  52692. <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "tbody",
  52693. "td", "tfoot", "th", "thead", "tr"<dd>
  52694. <p><a href=#parse-error id=parsing-main-intable:parse-error-4>Parse error</a>. Ignore the token.</p>
  52695. <dt>A start tag whose tag name is one of: "style", "script", "template"<dt>An end tag whose tag name is "template"<dd>
  52696. <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
  52697. mode</a>.</p>
  52698. <dt>A start tag whose tag name is "input"<dd>
  52699. <p>If the token does not have an attribute with the name "type", or if it does, but that
  52700. 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>
  52701. <p>Otherwise:</p>
  52702. <p><a href=#parse-error id=parsing-main-intable:parse-error-5>Parse error</a>.</p>
  52703. <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>
  52704. <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>
  52705. <p><a href=#acknowledge-self-closing-flag id=parsing-main-intable:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  52706. flag</i></a>, if it is set.</p>
  52707. <dt>A start tag whose tag name is "form"<dd>
  52708. <p><a href=#parse-error id=parsing-main-intable:parse-error-6>Parse error</a>.</p>
  52709. <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
  52710. the <a href=#form-element-pointer id=parsing-main-intable:form-element-pointer><code>form</code> element pointer</a> is not null, ignore the
  52711. token.</p>
  52712. <p>Otherwise:</p>
  52713. <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>
  52714. <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>
  52715. <dt>An end-of-file token<dd>
  52716. <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>
  52717. <dt>Anything else<dd>
  52718. <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
  52719. 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
  52720. 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
  52721. parenting</a>.</p>
  52722. </dl>
  52723. <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
  52724. 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>,
  52725. <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
  52726. elements</a>.</p>
  52727. <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>
  52728. <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
  52729. process is a <a href=#fragment-case id=parsing-main-intable:fragment-case>fragment case</a>.</p>
  52730. <h6 id=parsing-main-intabletext>12.2.5.4.10 The "<dfn>in table text</dfn>" insertion mode</h6>
  52731. <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
  52732. follows:</p>
  52733. <dl class=switch><dt>A character token that is U+0000 NULL<dd>
  52734. <p><a href=#parse-error id=parsing-main-intabletext:parse-error>Parse error</a>. Ignore the token.</p>
  52735. <dt>Any other character token<dd>
  52736. <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
  52737. table character tokens</a></var> list.</p>
  52738. <dt>Anything else<dd>
  52739. <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
  52740. 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
  52741. 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
  52742. 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>
  52743. <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>
  52744. <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
  52745. reprocess the token.</p>
  52746. </dl>
  52747. <h6 id=parsing-main-incaption>12.2.5.4.11 The "<dfn>in caption</dfn>" insertion mode</h6>
  52748. <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
  52749. 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>
  52750. <dl class=switch><dt>An end tag whose tag name is "caption"<dd>
  52751. <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
  52752. error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-incaption:fragment-case>fragment case</a>)</p>
  52753. <p>Otherwise:</p>
  52754. <p><a href=#generate-implied-end-tags id=parsing-main-incaption:generate-implied-end-tags>Generate implied end tags</a>.</p>
  52755. <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
  52756. <a href=#parse-error id=parsing-main-incaption:parse-error-2>parse error</a>.</p>
  52757. <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
  52758. stack.</p>
  52759. <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>
  52760. <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
  52761. table</a>".</p>
  52762. <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot",
  52763. "th", "thead", "tr"<dt>An end tag whose tag name is "table"<dd>
  52764. <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
  52765. error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-incaption:fragment-case-2>fragment case</a>)</p>
  52766. <p>Otherwise:</p>
  52767. <p><a href=#generate-implied-end-tags id=parsing-main-incaption:generate-implied-end-tags-2>Generate implied end tags</a>.</p>
  52768. <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
  52769. <a href=#parse-error id=parsing-main-incaption:parse-error-4>parse error</a>.</p>
  52770. <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
  52771. stack.</p>
  52772. <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>
  52773. <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
  52774. table</a>".</p>
  52775. <p>Reprocess the token.</p>
  52776. <dt>An end tag whose tag name is one of: "body", "col", "colgroup", "html", "tbody", "td",
  52777. "tfoot", "th", "thead", "tr"<dd>
  52778. <p><a href=#parse-error id=parsing-main-incaption:parse-error-5>Parse error</a>. Ignore the token.</p>
  52779. <dt>Anything else<dd>
  52780. <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>
  52781. </dl>
  52782. <h6 id=parsing-main-incolgroup>12.2.5.4.12 The "<dfn>in column group</dfn>" insertion mode</h6>
  52783. <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
  52784. as follows:</p>
  52785. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  52786. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  52787. <p><a href=#insert-a-character id=parsing-main-incolgroup:insert-a-character>Insert the character</a>.</p>
  52788. <dt>A comment token<dd>
  52789. <p><a href=#insert-a-comment id=parsing-main-incolgroup:insert-a-comment>Insert a comment</a>.</p>
  52790. <dt>A DOCTYPE token<dd>
  52791. <p><a href=#parse-error id=parsing-main-incolgroup:parse-error>Parse error</a>. Ignore the token.</p>
  52792. <dt>A start tag whose tag name is "html"<dd>
  52793. <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>
  52794. <dt>A start tag whose tag name is "col"<dd>
  52795. <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
  52796. node</a> off the <a href=#stack-of-open-elements id=parsing-main-incolgroup:stack-of-open-elements>stack of open elements</a>.</p>
  52797. <p><a href=#acknowledge-self-closing-flag id=parsing-main-incolgroup:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  52798. flag</i></a>, if it is set.</p>
  52799. <dt>An end tag whose tag name is "colgroup"<dd>
  52800. <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
  52801. <a href=#parse-error id=parsing-main-incolgroup:parse-error-2>parse error</a>; ignore the token.</p>
  52802. <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>.
  52803. 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
  52804. table</a>".</p>
  52805. <dt>An end tag whose tag name is "col"<dd>
  52806. <p><a href=#parse-error id=parsing-main-incolgroup:parse-error-3>Parse error</a>. Ignore the token.</p>
  52807. <dt>A start tag whose tag name is "template"<dt>An end tag whose tag name is "template"<dd>
  52808. <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>
  52809. <dt>An end-of-file token<dd>
  52810. <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>
  52811. <dt>Anything else<dd>
  52812. <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
  52813. <a href=#parse-error id=parsing-main-incolgroup:parse-error-4>parse error</a>; ignore the token.</p>
  52814. <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
  52815. elements</a>.</p>
  52816. <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
  52817. table</a>".</p>
  52818. <p>Reprocess the token.</p>
  52819. </dl>
  52820. <h6 id=parsing-main-intbody>12.2.5.4.13 The "<dfn>in table body</dfn>" insertion mode</h6>
  52821. <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
  52822. follows:</p>
  52823. <dl class=switch><dt>A start tag whose tag name is "tr"<dd>
  52824. <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>
  52825. <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
  52826. mode</a> to "<a href=#parsing-main-intr id=parsing-main-intbody:parsing-main-intr>in row</a>".</p>
  52827. <dt>A start tag whose tag name is one of: "th", "td"<dd>
  52828. <p><a href=#parse-error id=parsing-main-intbody:parse-error>Parse error</a>.</p>
  52829. <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>
  52830. <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
  52831. 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
  52832. row</a>".</p>
  52833. <p>Reprocess the current token.</p>
  52834. <dt>An end tag whose tag name is one of: "tbody", "tfoot",
  52835. "thead"<dd>
  52836. <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
  52837. 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>;
  52838. ignore the token.</p>
  52839. <p>Otherwise:</p>
  52840. <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>
  52841. <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
  52842. <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>
  52843. <dt>A start tag whose tag name is one of: "caption", "col",
  52844. "colgroup", "tbody", "tfoot", "thead"<dt>An end tag whose tag name is "table"<dd>
  52845. <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
  52846. scope</a>, this is a <a href=#parse-error id=parsing-main-intbody:parse-error-3>parse error</a>; ignore the token.</p>
  52847. <p>Otherwise:</p>
  52848. <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>
  52849. <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
  52850. <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>
  52851. <p>Reprocess the token.</p>
  52852. <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td",
  52853. "th", "tr"<dd>
  52854. <p><a href=#parse-error id=parsing-main-intbody:parse-error-4>Parse error</a>. Ignore the token.</p>
  52855. <dt>Anything else<dd>
  52856. <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>
  52857. </dl>
  52858. <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>,
  52859. 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>,
  52860. <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
  52861. elements from the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements-5>stack of open elements</a>.</p>
  52862. <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
  52863. process is a <a href=#fragment-case id=parsing-main-intbody:fragment-case>fragment case</a>.</p>
  52864. <h6 id=parsing-main-intr>12.2.5.4.14 The "<dfn>in row</dfn>" insertion mode</h6>
  52865. <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
  52866. 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>
  52867. <dl class=switch><dt>A start tag whose tag name is one of: "th", "td"<dd>
  52868. <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>
  52869. <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
  52870. mode</a> to "<a href=#parsing-main-intd id=parsing-main-intr:parsing-main-intd>in cell</a>".</p>
  52871. <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
  52872. active formatting elements</a>.</p>
  52873. <dt>An end tag whose tag name is "tr"<dd>
  52874. <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>;
  52875. ignore the token.</p>
  52876. <p>Otherwise:</p>
  52877. <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>
  52878. <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
  52879. <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>
  52880. <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "tfoot",
  52881. "thead", "tr"<dt>An end tag whose tag name is "table"<dd>
  52882. <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>;
  52883. ignore the token.</p>
  52884. <p>Otherwise:</p>
  52885. <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>
  52886. <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
  52887. <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>
  52888. <p>Reprocess the token.</p>
  52889. <dt>An end tag whose tag name is one of: "tbody", "tfoot", "thead"<dd>
  52890. <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
  52891. 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>;
  52892. ignore the token.</p>
  52893. <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>
  52894. <p>Otherwise:</p>
  52895. <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>
  52896. <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
  52897. <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>
  52898. <p>Reprocess the token.</p>
  52899. <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td",
  52900. "th"<dd>
  52901. <p><a href=#parse-error id=parsing-main-intr:parse-error-4>Parse error</a>. Ignore the token.</p>
  52902. <dt>Anything else<dd>
  52903. <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>
  52904. </dl>
  52905. <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>,
  52906. 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>,
  52907. <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
  52908. elements</a>.</p>
  52909. <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
  52910. process is a <a href=#fragment-case id=parsing-main-intr:fragment-case>fragment case</a>.</p>
  52911. <h6 id=parsing-main-intd>12.2.5.4.15 The "<dfn>in cell</dfn>" insertion mode</h6>
  52912. <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>
  52913. <dl class=switch><dt>An end tag whose tag name is one of: "td", "th"<dd>
  52914. <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
  52915. 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
  52916. error</a>; ignore the token.</p>
  52917. <p>Otherwise:</p>
  52918. <p><a href=#generate-implied-end-tags id=parsing-main-intd:generate-implied-end-tags>Generate implied end tags</a>.</p>
  52919. <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
  52920. 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>
  52921. <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
  52922. stack.</p>
  52923. <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>
  52924. <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
  52925. row</a>".</p>
  52926. <dt>A start tag whose tag name is one of: "caption", "col",
  52927. "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"<dd>
  52928. <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
  52929. 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>
  52930. <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>
  52931. <dt>An end tag whose tag name is one of: "body", "caption",
  52932. "col", "colgroup", "html"<dd>
  52933. <p><a href=#parse-error id=parsing-main-intd:parse-error-4>Parse error</a>. Ignore the token.</p>
  52934. <dt>An end tag whose tag name is one of: "table", "tbody",
  52935. "tfoot", "thead", "tr"<dd>
  52936. <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
  52937. 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
  52938. error</a>; ignore the token.</p>
  52939. <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>
  52940. <dt>Anything else<dd>
  52941. <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>
  52942. </dl>
  52943. <p>Where the steps above say to <dfn id=close-the-cell>close the cell</dfn>, they mean to run the following
  52944. algorithm:</p>
  52945. <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>
  52946. 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>
  52947. 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
  52948. row</a>".</ol>
  52949. <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
  52950. <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
  52951. 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>
  52952. <h6 id=parsing-main-inselect>12.2.5.4.16 The "<dfn>in select</dfn>" insertion mode</h6>
  52953. <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
  52954. 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>
  52955. <dl class=switch><dt>A character token that is U+0000 NULL<dd>
  52956. <p><a href=#parse-error id=parsing-main-inselect:parse-error>Parse error</a>. Ignore the token.</p>
  52957. <dt>Any other character token<dd>
  52958. <p><a href=#insert-a-character id=parsing-main-inselect:insert-a-character>Insert the token's character</a>.</p>
  52959. <dt>A comment token<dd>
  52960. <p><a href=#insert-a-comment id=parsing-main-inselect:insert-a-comment>Insert a comment</a>.</p>
  52961. <dt>A DOCTYPE token<dd>
  52962. <p><a href=#parse-error id=parsing-main-inselect:parse-error-2>Parse error</a>. Ignore the token.</p>
  52963. <dt>A start tag whose tag name is "html"<dd>
  52964. <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>
  52965. <dt>A start tag whose tag name is "option"<dd>
  52966. <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
  52967. <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements>stack of open elements</a>.</p>
  52968. <p><a href=#insert-an-html-element id=parsing-main-inselect:insert-an-html-element>Insert an HTML element</a> for the token.</p>
  52969. <dt>A start tag whose tag name is "optgroup"<dd>
  52970. <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
  52971. <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-2>stack of open elements</a>.</p>
  52972. <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
  52973. <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-3>stack of open elements</a>.</p>
  52974. <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>
  52975. <dt>An end tag whose tag name is "optgroup"<dd>
  52976. <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
  52977. 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>
  52978. 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
  52979. elements</a>.</p>
  52980. <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
  52981. 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
  52982. the token.</p>
  52983. <dt>An end tag whose tag name is "option"<dd>
  52984. <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
  52985. 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
  52986. the token.</p>
  52987. <dt>An end tag whose tag name is "select"<dd>
  52988. <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
  52989. error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-inselect:fragment-case>fragment case</a>)</p>
  52990. <p>Otherwise:</p>
  52991. <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
  52992. has been popped from the stack.</p>
  52993. <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselect:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
  52994. <dt>A start tag whose tag name is "select"<dd>
  52995. <p><a href=#parse-error id=parsing-main-inselect:parse-error-6>Parse error</a>.</p>
  52996. <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.
  52997. (<a href=#fragment-case id=parsing-main-inselect:fragment-case-2>fragment case</a>)</p>
  52998. <p>Otherwise:</p>
  52999. <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
  53000. has been popped from the stack.</p>
  53001. <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>
  53002. <p class=note>It just gets treated like an end tag.</p>
  53003. <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"<dd>
  53004. <p><a href=#parse-error id=parsing-main-inselect:parse-error-7>Parse error</a>.</p>
  53005. <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.
  53006. (<a href=#fragment-case id=parsing-main-inselect:fragment-case-3>fragment case</a>)</p>
  53007. <p>Otherwise:</p>
  53008. <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
  53009. has been popped from the stack.</p>
  53010. <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>
  53011. <p>Reprocess the token.</p>
  53012. <dt>A start tag whose tag name is one of: "script", "template"<dt>An end tag whose tag name is "template"<dd>
  53013. <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>
  53014. <dt>An end-of-file token<dd>
  53015. <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>
  53016. <dt>Anything else<dd>
  53017. <p><a href=#parse-error id=parsing-main-inselect:parse-error-8>Parse error</a>. Ignore the token.</p>
  53018. </dl>
  53019. <h6 id=parsing-main-inselectintable>12.2.5.4.17 The "<dfn>in select in table</dfn>" insertion mode</h6>
  53020. <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
  53021. token as follows:</p>
  53022. <dl class=switch><dt>A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr",
  53023. "td", "th"<dd>
  53024. <p><a href=#parse-error id=parsing-main-inselectintable:parse-error>Parse error</a>.</p>
  53025. <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
  53026. has been popped from the stack.</p>
  53027. <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselectintable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
  53028. <p>Reprocess the token.</p>
  53029. <dt>An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr",
  53030. "td", "th"<dd>
  53031. <p><a href=#parse-error id=parsing-main-inselectintable:parse-error-2>Parse error</a>.</p>
  53032. <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
  53033. element</a> with the same tag name as that of the token, then ignore the token.</p>
  53034. <p>Otherwise:</p>
  53035. <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
  53036. has been popped from the stack.</p>
  53037. <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>
  53038. <p>Reprocess the token.</p>
  53039. <dt>Anything else<dd>
  53040. <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>
  53041. </dl>
  53042. <h6 id=parsing-main-intemplate>12.2.5.4.18 The "<dfn>in template</dfn>" insertion mode</h6>
  53043. <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
  53044. 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>
  53045. <dl class=switch><dt>A character token<dt>A comment token<dt>A DOCTYPE token<dd>
  53046. <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>
  53047. <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>
  53048. <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>
  53049. <dt>A start tag whose tag name is one of: "caption", "colgroup", "tbody", "tfoot", "thead"<dd>
  53050. <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
  53051. insertion modes</a>.</p>
  53052. <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
  53053. 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
  53054. mode</a>.</p>
  53055. <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
  53056. table</a>", and reprocess the token.</p>
  53057. <dt>A start tag whose tag name is "col"<dd>
  53058. <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
  53059. insertion modes</a>.</p>
  53060. <p>Push "<a href=#parsing-main-incolgroup id=parsing-main-intemplate:parsing-main-incolgroup>in column group</a>" onto the
  53061. <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
  53062. insertion mode</a>.</p>
  53063. <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
  53064. column group</a>", and reprocess the token.</p>
  53065. <dt>A start tag whose tag name is "tr"<dd>
  53066. <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
  53067. insertion modes</a>.</p>
  53068. <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
  53069. 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
  53070. mode</a>.</p>
  53071. <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
  53072. table body</a>", and reprocess the token.</p>
  53073. <dt>A start tag whose tag name is one of: "td", "th"<dd>
  53074. <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
  53075. insertion modes</a>.</p>
  53076. <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
  53077. 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>
  53078. <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
  53079. row</a>", and reprocess the token.</p>
  53080. <dt>Any other start tag<dd>
  53081. <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
  53082. insertion modes</a>.</p>
  53083. <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
  53084. 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>
  53085. <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
  53086. body</a>", and reprocess the token.</p>
  53087. <dt>Any other end tag<dd>
  53088. <p><a href=#parse-error id=parsing-main-intemplate:parse-error>Parse error</a>. Ignore the token.</p>
  53089. <dt>An end-of-file token<dd>
  53090. <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
  53091. <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>
  53092. <p>Otherwise, this is a <a href=#parse-error id=parsing-main-intemplate:parse-error-2>parse error</a>.</p>
  53093. <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>
  53094. element has been popped from the stack.</p>
  53095. <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>
  53096. <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
  53097. insertion modes</a>.</p>
  53098. <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-intemplate:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
  53099. <p>Reprocess the token.</p>
  53100. </dl>
  53101. <h6 id=parsing-main-afterbody>12.2.5.4.19 The "<dfn>after body</dfn>" insertion mode</h6>
  53102. <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>
  53103. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53104. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  53105. <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>
  53106. <dt>A comment token<dd>
  53107. <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
  53108. open elements</a> (the <code id=parsing-main-afterbody:the-html-element><a href=#the-html-element>html</a></code> element).</p>
  53109. <dt>A DOCTYPE token<dd>
  53110. <p><a href=#parse-error id=parsing-main-afterbody:parse-error>Parse error</a>. Ignore the token.</p>
  53111. <dt>A start tag whose tag name is "html"<dd>
  53112. <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>
  53113. <dt>An end tag whose tag name is "html"<dd>
  53114. <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
  53115. 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
  53116. case</a>)</p>
  53117. <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>
  53118. <dt>An end-of-file token<dd>
  53119. <p><a href=#stop-parsing id=parsing-main-afterbody:stop-parsing>Stop parsing</a>.</p>
  53120. <dt>Anything else<dd>
  53121. <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>
  53122. </dl>
  53123. <h6 id=parsing-main-inframeset>12.2.5.4.20 The "<dfn>in frameset</dfn>" insertion mode</h6>
  53124. <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
  53125. 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>
  53126. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53127. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  53128. <p><a href=#insert-a-character id=parsing-main-inframeset:insert-a-character>Insert the character</a>.</p>
  53129. <dt>A comment token<dd>
  53130. <p><a href=#insert-a-comment id=parsing-main-inframeset:insert-a-comment>Insert a comment</a>.</p>
  53131. <dt>A DOCTYPE token<dd>
  53132. <p><a href=#parse-error id=parsing-main-inframeset:parse-error>Parse error</a>. Ignore the token.</p>
  53133. <dt>A start tag whose tag name is "html"<dd>
  53134. <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>
  53135. <dt>A start tag whose tag name is "frameset"<dd>
  53136. <p><a href=#insert-an-html-element id=parsing-main-inframeset:insert-an-html-element>Insert an HTML element</a> for the token.</p>
  53137. <dt>An end tag whose tag name is "frameset"<dd>
  53138. <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
  53139. <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>
  53140. <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
  53141. elements</a>.</p>
  53142. <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
  53143. 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
  53144. <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>
  53145. <dt>A start tag whose tag name is "frame"<dd>
  53146. <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
  53147. 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>
  53148. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inframeset:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  53149. flag</i></a>, if it is set.</p>
  53150. <dt>A start tag whose tag name is "noframes"<dd>
  53151. <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>
  53152. <dt>An end-of-file token<dd>
  53153. <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
  53154. <a href=#parse-error id=parsing-main-inframeset:parse-error-3>parse error</a>.</p>
  53155. <p class=note>The <a href=#current-node id=parsing-main-inframeset:current-node-6>current node</a> can only be the root
  53156. <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>
  53157. <p><a href=#stop-parsing id=parsing-main-inframeset:stop-parsing>Stop parsing</a>.</p>
  53158. <dt>Anything else<dd>
  53159. <p><a href=#parse-error id=parsing-main-inframeset:parse-error-4>Parse error</a>. Ignore the token.</p>
  53160. </dl>
  53161. <h6 id=parsing-main-afterframeset>12.2.5.4.21 The "<dfn>after frameset</dfn>" insertion mode</h6>
  53162. <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
  53163. as follows:</p>
  53164. <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53165. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  53166. <p><a href=#insert-a-character id=parsing-main-afterframeset:insert-a-character>Insert the character</a>.</p>
  53167. <dt>A comment token<dd>
  53168. <p><a href=#insert-a-comment id=parsing-main-afterframeset:insert-a-comment>Insert a comment</a>.</p>
  53169. <dt>A DOCTYPE token<dd>
  53170. <p><a href=#parse-error id=parsing-main-afterframeset:parse-error>Parse error</a>. Ignore the token.</p>
  53171. <dt>A start tag whose tag name is "html"<dd>
  53172. <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>
  53173. <dt>An end tag whose tag name is "html"<dd>
  53174. <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>
  53175. <dt>A start tag whose tag name is "noframes"<dd>
  53176. <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>
  53177. <dt>An end-of-file token<dd>
  53178. <p><a href=#stop-parsing id=parsing-main-afterframeset:stop-parsing>Stop parsing</a>.</p>
  53179. <dt>Anything else<dd>
  53180. <p><a href=#parse-error id=parsing-main-afterframeset:parse-error-2>Parse error</a>. Ignore the token.</p>
  53181. </dl>
  53182. <h6 id=the-after-after-body-insertion-mode>12.2.5.4.22 The "<dfn>after after body</dfn>" insertion mode</h6>
  53183. <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
  53184. as follows:</p>
  53185. <dl class=switch><dt>A comment token<dd>
  53186. <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>
  53187. <dt>A DOCTYPE token<dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53188. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dt>A start tag whose tag name is "html"<dd>
  53189. <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>
  53190. <dt>An end-of-file token<dd>
  53191. <p><a href=#stop-parsing id=the-after-after-body-insertion-mode:stop-parsing>Stop parsing</a>.</p>
  53192. <dt>Anything else<dd>
  53193. <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>
  53194. </dl>
  53195. <h6 id=the-after-after-frameset-insertion-mode>12.2.5.4.23 The "<dfn>after after frameset</dfn>" insertion mode</h6>
  53196. <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
  53197. token as follows:</p>
  53198. <dl class=switch><dt>A comment token<dd>
  53199. <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>
  53200. <dt>A DOCTYPE token<dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53201. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dt>A start tag whose tag name is "html"<dd>
  53202. <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>
  53203. <dt>An end-of-file token<dd>
  53204. <p><a href=#stop-parsing id=the-after-after-frameset-insertion-mode:stop-parsing>Stop parsing</a>.</p>
  53205. <dt>A start tag whose tag name is "noframes"<dd>
  53206. <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>
  53207. <dt>Anything else<dd>
  53208. <p><a href=#parse-error id=the-after-after-frameset-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
  53209. </dl>
  53210. <h5 id=parsing-main-inforeign>12.2.5.5 The rules for parsing tokens <dfn>in foreign content</dfn></h5>
  53211. <p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent
  53212. must handle the token as follows:</p>
  53213. <dl class=switch><dt>A character token that is U+0000 NULL<dd>
  53214. <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
  53215. CHARACTER character</a>.</p>
  53216. <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
  53217. FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
  53218. <p><a href=#insert-a-character id=parsing-main-inforeign:insert-a-character-2>Insert the token's character</a>.</p>
  53219. <dt>Any other character token<dd>
  53220. <p><a href=#insert-a-character id=parsing-main-inforeign:insert-a-character-3>Insert the token's character</a>.</p>
  53221. <p>Set the <a href=#frameset-ok-flag id=parsing-main-inforeign:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
  53222. <dt>A comment token<dd>
  53223. <p><a href=#insert-a-comment id=parsing-main-inforeign:insert-a-comment>Insert a comment</a>.</p>
  53224. <dt>A DOCTYPE token<dd>
  53225. <p><a href=#parse-error id=parsing-main-inforeign:parse-error-2>Parse error</a>. Ignore the token.</p>
  53226. <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",
  53227. "li", "listing",
  53228. "menu", "meta", "nobr", "ol", "p", "pre", "ruby", "s", "small", "span", "strong", "strike", "sub",
  53229. "sup", "table", "tt", "u", "ul", "var"<dt>A start tag whose tag name is "font", if the token has any attributes named "color", "face",
  53230. or "size"<dd>
  53231. <p><a href=#parse-error id=parsing-main-inforeign:parse-error-3>Parse error</a>.</p>
  53232. <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>,
  53233. 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>
  53234. <p>Otherwise:</p>
  53235. <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
  53236. 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
  53237. <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
  53238. element in the <a href=#html-namespace-2 id=parsing-main-inforeign:html-namespace-2>HTML namespace</a>.</p>
  53239. <p>Then, reprocess the token.</p>
  53240. <dt>Any other start tag<dd>
  53241. <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>,
  53242. <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
  53243. that are not all lowercase.)</p>
  53244. <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
  53245. token's tag name is one of the ones in the first column of the following table, change the tag
  53246. name to the name given in the corresponding cell in the second column. (This fixes the case of
  53247. SVG elements that are not all lowercase.)</p>
  53248. <table><thead><tr><th> Tag name <th> Element name
  53249. <tbody><tr><td> <code>altglyph</code> <td> <code>altGlyph</code>
  53250. <tr><td> <code>altglyphdef</code> <td> <code>altGlyphDef</code>
  53251. <tr><td> <code>altglyphitem</code> <td> <code>altGlyphItem</code>
  53252. <tr><td> <code>animatecolor</code> <td> <code>animateColor</code>
  53253. <tr><td> <code>animatemotion</code> <td> <code>animateMotion</code>
  53254. <tr><td> <code>animatetransform</code> <td> <code>animateTransform</code>
  53255. <tr><td> <code>clippath</code> <td> <code>clipPath</code>
  53256. <tr><td> <code>feblend</code> <td> <code>feBlend</code>
  53257. <tr><td> <code>fecolormatrix</code> <td> <code>feColorMatrix</code>
  53258. <tr><td> <code>fecomponenttransfer</code> <td> <code>feComponentTransfer</code>
  53259. <tr><td> <code>fecomposite</code> <td> <code>feComposite</code>
  53260. <tr><td> <code>feconvolvematrix</code> <td> <code>feConvolveMatrix</code>
  53261. <tr><td> <code>fediffuselighting</code> <td> <code>feDiffuseLighting</code>
  53262. <tr><td> <code>fedisplacementmap</code> <td> <code>feDisplacementMap</code>
  53263. <tr><td> <code>fedistantlight</code> <td> <code>feDistantLight</code>
  53264. <tr><td> <code>fedropshadow</code> <td> <code>feDropShadow</code>
  53265. <tr><td> <code>feflood</code> <td> <code>feFlood</code>
  53266. <tr><td> <code>fefunca</code> <td> <code>feFuncA</code>
  53267. <tr><td> <code>fefuncb</code> <td> <code>feFuncB</code>
  53268. <tr><td> <code>fefuncg</code> <td> <code>feFuncG</code>
  53269. <tr><td> <code>fefuncr</code> <td> <code>feFuncR</code>
  53270. <tr><td> <code>fegaussianblur</code> <td> <code>feGaussianBlur</code>
  53271. <tr><td> <code>feimage</code> <td> <code>feImage</code>
  53272. <tr><td> <code>femerge</code> <td> <code>feMerge</code>
  53273. <tr><td> <code>femergenode</code> <td> <code>feMergeNode</code>
  53274. <tr><td> <code>femorphology</code> <td> <code>feMorphology</code>
  53275. <tr><td> <code>feoffset</code> <td> <code>feOffset</code>
  53276. <tr><td> <code>fepointlight</code> <td> <code>fePointLight</code>
  53277. <tr><td> <code>fespecularlighting</code> <td> <code>feSpecularLighting</code>
  53278. <tr><td> <code>fespotlight</code> <td> <code>feSpotLight</code>
  53279. <tr><td> <code>fetile</code> <td> <code>feTile</code>
  53280. <tr><td> <code>feturbulence</code> <td> <code>feTurbulence</code>
  53281. <tr><td> <code>foreignobject</code> <td> <code>foreignObject</code>
  53282. <tr><td> <code>glyphref</code> <td> <code>glyphRef</code>
  53283. <tr><td> <code>lineargradient</code> <td> <code>linearGradient</code>
  53284. <tr><td> <code>radialgradient</code> <td> <code>radialGradient</code>
  53285. <tr><td> <code>textpath</code> <td> <code>textPath</code>
  53286. </table>
  53287. <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>,
  53288. <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
  53289. are not all lowercase.)</p>
  53290. <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
  53291. attributes, in particular XLink in SVG.)</p>
  53292. <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
  53293. <a href=#adjusted-current-node id=parsing-main-inforeign:adjusted-current-node-4>adjusted current node</a>.</p>
  53294. <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
  53295. following list:</p>
  53296. <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>
  53297. <p><a href=#acknowledge-self-closing-flag id=parsing-main-inforeign:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
  53298. flag</i></a>, and then act as described in the steps for a "script" end tag below.</p>
  53299. <dt>Otherwise<dd>
  53300. <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
  53301. flag</i></a>.</p>
  53302. </dl>
  53303. <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>
  53304. <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>
  53305. <p>Let the <var>old insertion point</var> have the same value as the current
  53306. <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
  53307. input character</a>.</p>
  53308. <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
  53309. flag</a> to true.</p>
  53310. <p><a href=http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing>Process the
  53311. <code>script</code> element</a> according to the SVG rules, if the user agent supports
  53312. SVG. <a href=#refsSVG>[SVG]</a></p>
  53313. <p class=note>Even if this causes <a href=#dom-document-write id=parsing-main-inforeign:dom-document-write>new characters to be
  53314. inserted into the tokenizer</a>, the parser will not be executed reentrantly, since the
  53315. <a href=#parser-pause-flag id=parsing-main-inforeign:parser-pause-flag-2>parser pause flag</a> is true.</p>
  53316. <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
  53317. 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>
  53318. <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
  53319. 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.
  53320. This value might be the "undefined" value.)</p>
  53321. <dt>Any other end tag<dd>
  53322. <p>Run these steps:</p>
  53323. <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
  53324. 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
  53325. 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
  53326. 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
  53327. 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
  53328. elements</a> until <var>node</var> has been popped from the stack, and then abort
  53329. 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
  53330. 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
  53331. to the step labeled <i>loop</i>.<li><p>Otherwise, process the token according to the rules given in the section corresponding
  53332. to the current <a href=#insertion-mode id=parsing-main-inforeign:insertion-mode>insertion mode</a> in HTML content.</ol>
  53333. </dl>
  53334. <h4 id=the-end>12.2.6 The end</h4>
  53335. <p>Once the user agent <dfn id=stop-parsing>stops parsing</dfn> the document, the user agent
  53336. must run the following steps:</p>
  53337. <ol><li><p>Set the <a href=#current-document-readiness id=the-end:current-document-readiness>current document readiness</a> to "<code>interactive</code>"
  53338. and the <a href=#insertion-point id=the-end:insertion-point>insertion point</a> to
  53339. 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
  53340. parsing</a> is not empty, run these substeps:</p>
  53341. <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
  53342. 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
  53343. to be parser-executed"</a> flag set <em>and</em> the parser's <code id=the-end:document><a href=#document>Document</a></code>
  53344. <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
  53345. 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
  53346. 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
  53347. execute when the document has finished parsing</a> (i.e. shift out the first entry in the
  53348. 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
  53349. parsing</a> is still not empty, repeat these substeps again from substep 1.</p>
  53350. </ol>
  53351. <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
  53352. 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
  53353. 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>
  53354. <p><a href=#queue-a-task id=the-end:queue-a-task-2>Queue a task</a> to run the following substeps:</p>
  53355. <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>,
  53356. <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
  53357. <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>
  53358. object.</ol>
  53359. <li>
  53360. <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
  53361. task</a> to run the following substeps:</p>
  53362. <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
  53363. 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
  53364. <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>
  53365. object,
  53366. 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
  53367. event must not bubble, must not be cancelable, and has no default action.</ol>
  53368. <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
  53369. 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
  53370. 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
  53371. 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
  53372. <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
  53373. loaded</dfn>.</ol>
  53374. <p>When the user agent is to <dfn id=abort-a-parser>abort a parser</dfn>, it must run the following steps:</p>
  53375. <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
  53376. 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>
  53377. <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
  53378. source</a>.</p>
  53379. <h4 id=coercing-an-html-dom-into-an-infoset>12.2.7 Coercing an HTML DOM into an infoset</h4>
  53380. <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
  53381. possible that the constructed DOM is not compatible with the XML tool chain in certain subtle
  53382. 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
  53383. 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
  53384. section specifies some rules for handling these issues.</p>
  53385. <p>If the XML API being used doesn't support DOCTYPEs, the tool may drop DOCTYPEs altogether.</p>
  53386. <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
  53387. 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>
  53388. <p>The tool may annotate the output with any namespace declarations required for proper
  53389. operation.</p>
  53390. <p>If the XML API being used restricts the allowable characters in the local names of elements and
  53391. attributes, then the tool may map all element and attribute local names that the API wouldn't
  53392. support to a set of names that <em>are</em> allowed, by replacing any character that isn't
  53393. supported with the uppercase letter U and the six digits of the character's Unicode code point
  53394. when expressed in hexadecimal, using digits 0-9 and capital letters A-F as the symbols, in
  53395. increasing numeric order.</p>
  53396. <p class=example>For example, the element name <code>foo&lt;bar</code>, which can be
  53397. 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
  53398. well-formed XML element name, would be converted into <code>fooU00003Cbar</code>, which
  53399. <em>is</em> a well-formed XML element name (though it's still not legal in HTML by any means).</p>
  53400. <p class=example>As another example, consider the attribute <code>xlink:href</code>.
  53401. 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
  53402. name "<code>href</code>". However, used on an HTML element, it becomes an attribute with
  53403. no prefix and the local name "<code>xlink:href</code>", which is not a valid NCName, and
  53404. thus might not be accepted by an XML API. It could thus get converted, becoming "<code>xlinkU00003Ahref</code>".</p>
  53405. <p class=note>The resulting names from this conversion conveniently can't clash with any
  53406. 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
  53407. 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>
  53408. <p>If the XML API restricts comments from having two consecutive U+002D HYPHEN-MINUS characters
  53409. (--), the tool may insert a single U+0020 SPACE character between any such offending
  53410. characters.</p>
  53411. <p>If the XML API restricts comments from ending in a U+002D HYPHEN-MINUS character (-), the tool
  53412. may insert a single U+0020 SPACE character at the end of such comments.</p>
  53413. <p>If the XML API restricts allowed characters in character data, attribute values, or comments,
  53414. the tool may replace any U+000C FORM FEED (FF) character with a U+0020 SPACE character, and any
  53415. other literal non-XML character with a U+FFFD REPLACEMENT CHARACTER.</p>
  53416. <p>If the tool has no way to convey out-of-band information, then the tool may drop the following
  53417. information:</p>
  53418. <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
  53419. <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>
  53420. 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>
  53421. <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
  53422. parser</a>'s rules have been applied. For example, a <code>&lt;a::></code> start tag
  53423. will be closed by a <code>&lt;/a::></code> end tag, and never by a <code>&lt;/aU00003AU00003A></code> end tag, even if the user agent is using the rules above to
  53424. then generate an actual element in the DOM with the name <code>aU00003AU00003A</code> for
  53425. that start tag.</p>
  53426. <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>
  53427. <p><i>This section is non-normative.</i></p>
  53428. <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>
  53429. handles these cases.</p>
  53430. <h5 id=misnested-tags:-b-i-/b-/i>12.2.8.1 Misnested tags: &lt;b>&lt;i>&lt;/b>&lt;/i></h5>
  53431. <p><i>This section is non-normative.</i></p>
  53432. <p>The most-often discussed example of erroneous markup is as follows:</p>
  53433. <pre>&lt;p>1&lt;b>2&lt;i>3&lt;/b>4&lt;/i>5&lt;/p></pre>
  53434. <p>The parsing of this markup is straightforward up to the "3". At this point, the DOM looks like
  53435. this:</p>
  53436. <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>
  53437. <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>,
  53438. <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
  53439. 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
  53440. mode</a> is "<a href=#parsing-main-inbody id=misnested-tags:-b-i-/b-/i:parsing-main-inbody>in body</a>".</p>
  53441. <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption
  53442. agency algorithm</a>" is invoked. This is a simple case, in that the <var>formatting
  53443. 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>.
  53444. 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>,
  53445. <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>
  53446. 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>
  53447. <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
  53448. 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"
  53449. <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"
  53450. <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>
  53451. <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>
  53452. <h5 id=misnested-tags:-b-p-/b-/p>12.2.8.2 Misnested tags: &lt;b>&lt;p>&lt;/b>&lt;/p></h5>
  53453. <p><i>This section is non-normative.</i></p>
  53454. <p>A case similar to the previous one is the following:</p>
  53455. <pre>&lt;b>1&lt;p>2&lt;/b>3&lt;/p></pre>
  53456. <p>Up to the "2" the parsing here is straightforward:</p>
  53457. <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>
  53458. <p>The interesting part is when the end tag token with the tag name "b" is parsed.</p>
  53459. <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:
  53460. <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
  53461. 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
  53462. "<a href=#parsing-main-inbody id=misnested-tags:-b-p-/b-/p:parsing-main-inbody>in body</a>".</p>
  53463. <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption
  53464. agency algorithm</a>" is invoked, as in the previous example. However, in this case, there
  53465. <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
  53466. time the adoption agency algorithm isn't skipped over.</p>
  53467. <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
  53468. "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
  53469. elements</a>, but since that list has only one element in it, the bookmark won't have much
  53470. effect.</p>
  53471. <p>As the algorithm progresses, <var>node</var> ends up set to the formatting element
  53472. (<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
  53473. block</var> (<code id=misnested-tags:-b-p-/b-/p:the-p-element-4><a href=#the-p-element>p</a></code>).</p>
  53474. <p>The <var>last node</var> gets appended (moved) to the <var>common
  53475. ancestor</var>, so that the DOM looks like:</p>
  53476. <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>
  53477. <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
  53478. moved to it:</p>
  53479. <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>
  53480. <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>
  53481. <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
  53482. DOM looks like:</p>
  53483. <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>
  53484. <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>
  53485. 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
  53486. <code id=misnested-tags:-b-p-/b-/p:the-p-element-10><a href=#the-p-element>p</a></code> element:</p>
  53487. <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>
  53488. <h5 id=unexpected-markup-in-tables>12.2.8.3 Unexpected markup in tables</h5>
  53489. <p><i>This section is non-normative.</i></p>
  53490. <p>Error handling in tables is, for historical reasons, especially strange. For example, consider
  53491. the following markup:</p>
  53492. <pre>&lt;table><strong>&lt;b></strong>&lt;tr>&lt;td>aaa&lt;/td>&lt;/tr><strong>bbb</strong>&lt;/table>ccc</pre>
  53493. <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
  53494. that, and the parser handles this case by placing the element <em>before</em> the table. (This is
  53495. 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
  53496. 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>
  53497. <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>
  53498. <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>
  53499. <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>
  53500. <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
  53501. <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,
  53502. 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
  53503. <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>
  53504. <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
  53505. 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
  53506. 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>
  53507. <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>
  53508. <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>,
  53509. <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
  53510. 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
  53511. <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>
  53512. <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
  53513. 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
  53514. formatting elements</a> (it also switches to the "<a href=#parsing-main-intd id=unexpected-markup-in-tables:parsing-main-intd>in
  53515. cell</a>" <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode-3>insertion mode</a>).</p>
  53516. <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>
  53517. <p>The <a href=#concept-parser-marker id=unexpected-markup-in-tables:concept-parser-marker-2>marker</a> means that when the "aaa" character
  53518. 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>
  53519. node:</p>
  53520. <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>
  53521. <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
  53522. 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>,
  53523. <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>
  53524. 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>
  53525. 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>
  53526. <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
  53527. insertion mode</a> set to "<a href=#parsing-main-intbody id=unexpected-markup-in-tables:parsing-main-intbody-3>in table body</a>").
  53528. 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
  53529. tag) is seen, they are processed as a group. Since they are not all spaces, they are handled as
  53530. per the "anything else" rules in the "<a href=#parsing-main-intable id=unexpected-markup-in-tables:parsing-main-intable-2>in table</a>"
  53531. insertion mode, which defer to the "<a href=#parsing-main-inbody id=unexpected-markup-in-tables:parsing-main-inbody>in body</a>"
  53532. insertion mode but with <a href=#foster-parent id=unexpected-markup-in-tables:foster-parent-2>foster parenting</a>.</p>
  53533. <p>When <a href=#reconstruct-the-active-formatting-elements id=unexpected-markup-in-tables:reconstruct-the-active-formatting-elements>the active formatting elements
  53534. 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>
  53535. <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>
  53536. <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>,
  53537. <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
  53538. 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>
  53539. 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>
  53540. <p>Had the character tokens been only <a href=#space-character id=unexpected-markup-in-tables:space-character>space characters</a>
  53541. instead of "bbb", then those <a href=#space-character id=unexpected-markup-in-tables:space-character-2>space characters</a> would just be
  53542. appended to the <code id=unexpected-markup-in-tables:the-tbody-element-10><a href=#the-tbody-element>tbody</a></code> element.</p>
  53543. <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
  53544. 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
  53545. 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
  53546. 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
  53547. table:</p>
  53548. <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>
  53549. <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>
  53550. <p><i>This section is non-normative.</i></p>
  53551. <p>Consider the following markup, which for this example we will assume is the document with
  53552. <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
  53553. 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>
  53554. <pre>&lt;div id=a>
  53555. &lt;script>
  53556. var div = document.getElementById('a');
  53557. parent.document.body.appendChild(div);
  53558. &lt;/script>
  53559. &lt;script>
  53560. alert(document.URL);
  53561. &lt;/script>
  53562. &lt;/div>
  53563. &lt;script>
  53564. alert(document.URL);
  53565. &lt;/script></pre>
  53566. <p>Up to the first "script" end tag, before the script is parsed, the result is relatively
  53567. straightforward:</p>
  53568. <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>
  53569. </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>
  53570. <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
  53571. <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>
  53572. <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>
  53573. <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
  53574. <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
  53575. 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>
  53576. <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
  53577. <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document-2><a href=#document>Document</a></code> object</em>.</p>
  53578. <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
  53579. not execute, so the first alert does not show.</p>
  53580. <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
  53581. 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
  53582. <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document-4><a href=#document>Document</a></code>:</p>
  53583. <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>
  53584. <p>This script does execute, resulting in an alert that says "http://example.com/inner".</p>
  53585. <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>
  53586. <p><i>This section is non-normative.</i></p>
  53587. <p>Elaborating on the example in the previous section, consider the case where the second
  53588. <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
  53589. <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>
  53590. <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>
  53591. 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
  53592. script is being downloaded, the element is moved to another document, the script continues to
  53593. download, but does not execute.</p>
  53594. <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
  53595. considered a bad practice.</p>
  53596. <h5 id=unclosed-formatting-elements>12.2.8.6 Unclosed formatting elements</h5>
  53597. <p><i>This section is non-normative.</i></p>
  53598. <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
  53599. collected and continue to be applied even as the elements they are contained in are closed, but
  53600. that excessive duplicates are thrown away.</p>
  53601. <pre>&lt;!DOCTYPE html>
  53602. &lt;p>&lt;b class=x>&lt;b class=x>&lt;b>&lt;b class=x>&lt;b class=x>&lt;b>X
  53603. &lt;p>X
  53604. &lt;p>&lt;b>&lt;b class=x>&lt;b>X
  53605. &lt;p>&lt;/b>&lt;/b>&lt;/b>&lt;/b>&lt;/b>&lt;/b>X</pre>
  53606. <p>The resulting DOM tree is as follows:</p>
  53607. <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>
  53608. <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>
  53609. elements, but in the resulting DOM, up to three of each kind of formatting element (in this case
  53610. 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)
  53611. get reconstructed before the element's "X".</p>
  53612. <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
  53613. 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
  53614. <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>
  53615. <h3 id=serialising-html-fragments>12.3 Serialising HTML fragments</h3>
  53616. <p>The following steps form the <dfn id=html-fragment-serialisation-algorithm>HTML fragment serialisation algorithm</dfn>. The algorithm
  53617. 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>
  53618. referred to as <var>the node</var>, and either returns a string or throws an
  53619. exception.</p>
  53620. <p class=note>This algorithm serialises the <em>children</em> of the node being serialised, not
  53621. the node itself.</p>
  53622. <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
  53623. contents</a> (a <code id=serialising-html-fragments:documentfragment-2><a href=#documentfragment>DocumentFragment</a></code> node).<li>
  53624. <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
  53625. following steps:
  53626. <ol><li><p>Let <var>current node</var> be the child node being processed.<li>
  53627. <p>Append the appropriate string from the following list to <var>s</var>:</p>
  53628. <dl class=switch><dt>If <var>current node</var> is an <code>Element</code><dd>
  53629. <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
  53630. <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>
  53631. <p>Append a U+003C LESS-THAN SIGN character (&lt;), followed by <var>tagname</var>.</p>
  53632. <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
  53633. <code>Document.createElement()</code>, <var>tagname</var> will be
  53634. lowercase.</p>
  53635. <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
  53636. U+003D EQUALS SIGN character (=), a U+0022 QUOTATION MARK character ("), the
  53637. attribute's value, <a href=#escapingString id=serialising-html-fragments:escapingString>escaped as described below</a> in
  53638. <i>attribute mode</i>, and a second U+0022 QUOTATION MARK character (").</p>
  53639. <p>An <dfn id="attribute's-serialised-name">attribute's serialised name</dfn> for the purposes of the previous paragraph must
  53640. be determined as follows:</p>
  53641. <dl class=switch><dt>If the attribute has no namespace<dd>
  53642. <p>The attribute's serialised name is the attribute's local name.</p>
  53643. <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
  53644. parser</a> or by <code>Element.setAttribute()</code>, the local name will be
  53645. lowercase.</p>
  53646. <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
  53647. 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
  53648. 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
  53649. is not <code>xmlns</code><dd><p>The attribute's serialised name is the string "<code>xmlns:</code>"
  53650. 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>"
  53651. 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>
  53652. <p>While the exact order of attributes is UA-defined, and may depend on factors such as the
  53653. order that the attributes were given in the original markup, the sort order must be stable,
  53654. such that consecutive invocations of this algorithm serialise an element's attributes in the
  53655. same order.</p>
  53656. <p>Append a U+003E GREATER-THAN SIGN character (>).</p>
  53657. <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>,
  53658. <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>,
  53659. <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>,
  53660. <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>,
  53661. <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
  53662. <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>
  53663. <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
  53664. <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
  53665. <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
  53666. (LF) character, then append a U+000A LINE FEED (LF) character.</p>
  53667. <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
  53668. <var>current node</var> element (thus recursing into this algorithm for that
  53669. element), followed by a U+003C LESS-THAN SIGN character (&lt;), a U+002F SOLIDUS character
  53670. (/), <var>tagname</var> again, and finally a U+003E GREATER-THAN SIGN character
  53671. (>).</p>
  53672. <dt>If <var>current node</var> is a <code>Text</code> node<dd>
  53673. <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>,
  53674. <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>,
  53675. <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
  53676. <var>current node</var>'s <code>data</code> IDL attribute literally.</p>
  53677. <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
  53678. below</a>.</p>
  53679. <dt>If <var>current node</var> is a <code>Comment</code><dd>
  53680. <p>Append the literal string "<code>&lt;!--</code>" (U+003C LESS-THAN SIGN, U+0021
  53681. 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
  53682. literal string "<code>--></code>" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
  53683. U+003E GREATER-THAN SIGN).</p>
  53684. <dt>If <var>current node</var> is a <code>ProcessingInstruction</code><dd>
  53685. <p>Append the literal string "<code>&lt;?</code>" (U+003C LESS-THAN SIGN, U+003F
  53686. 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
  53687. by the value of <var>current node</var>'s <code>data</code> IDL
  53688. attribute, followed by a single U+003E GREATER-THAN SIGN character (>).</p>
  53689. <dt>If <var>current node</var> is a <code>DocumentType</code><dd>
  53690. <p>Append the literal string "<code>&lt;!DOCTYPE</code>" (U+003C LESS-THAN SIGN, U+0021
  53691. EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN
  53692. CAPITAL LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050 LATIN
  53693. CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E), followed by a space (U+0020 SPACE),
  53694. followed by the value of <var>current node</var>'s <code>name</code> IDL
  53695. attribute, followed by the literal string "<code>></code>" (U+003E GREATER-THAN SIGN).</p>
  53696. </dl>
  53697. </ol>
  53698. <li><p>The result of the algorithm is the string <var>s</var>.</ol>
  53699. <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
  53700. parser</a>, will not return the original tree structure.</p>
  53701. <div class=example>
  53702. <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
  53703. has been appended is serialised and the output is then reparsed, the comment will end up being
  53704. displayed in the text field. Similarly, if, as a result of DOM manipulation, an element contains
  53705. a comment that contains the literal string "<code>--></code>", then when the result
  53706. of serialising the element is parsed, the comment will be truncated at that point and the rest of
  53707. 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>
  53708. element contain a <code id=serialising-html-fragments:text-2><a href=#text>Text</a></code> node with the text string "<code>&lt;/script></code>", or
  53709. 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>
  53710. element's <a href=#syntax-start-tag id=serialising-html-fragments:syntax-start-tag>start tag</a> would imply the end tag for the
  53711. <code id=serialising-html-fragments:the-p-element-2><a href=#the-p-element>p</a></code>).</p>
  53712. <p>This can enable cross-site scripting attacks. An example of this would be a page that lets the
  53713. 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
  53714. 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
  53715. 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
  53716. "<code>&lt;/style>&lt;script>attack&lt;/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,
  53717. 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
  53718. original DOM.</p>
  53719. </div>
  53720. <p><dfn id=escapingString>Escaping a string</dfn> (for the purposes of the algorithm above)
  53721. consists of running the following steps:</p>
  53722. <ol><li><p>Replace any occurrence of the "<code>&amp;</code>" character by the string "<code>&amp;amp;</code>".<li><p>Replace any occurrences of the U+00A0 NO-BREAK SPACE character by the string "<code>&amp;nbsp;</code>".<li><p>If the algorithm was invoked in the <i>attribute mode</i>, replace any occurrences of the
  53723. "<code>"</code>" character by the string "<code>&amp;quot;</code>".<li><p>If the algorithm was <em>not</em> invoked in the <i>attribute mode</i>, replace any
  53724. occurrences of the "<code>&lt;</code>" character by the string "<code>&amp;lt;</code>", and any occurrences of the "<code>></code>" character by
  53725. the string "<code>&amp;gt;</code>".</ol>
  53726. <h3 id=parsing-html-fragments>12.4 Parsing HTML fragments</h3>
  53727. <p>The following steps form the <dfn id=html-fragment-parsing-algorithm>HTML fragment parsing algorithm</dfn>. The algorithm
  53728. 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
  53729. the parser, as well as <var>input</var>, a string to parse, and returns a list of zero or
  53730. more nodes.</p>
  53731. <p class=note>Parts marked <dfn id=fragment-case>fragment case</dfn> in algorithms in the parser section are
  53732. parts that only occur if the parser was created for the purposes of this algorithm (and with a
  53733. <var id=parsing-html-fragments:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element). The algorithms have been annotated
  53734. with such markings for informational purposes only; such markings have no normative weight. If it
  53735. 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
  53736. parser wasn't created for the purposes of handling this algorithm, then that is an error in the
  53737. specification.</p>
  53738. <ol><li>
  53739. <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>
  53740. <li>
  53741. <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
  53742. <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
  53743. <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>.
  53744. 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
  53745. <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
  53746. <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
  53747. 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>
  53748. <li>
  53749. <p>Create a new <a href=#html-parser id=parsing-html-fragments:html-parser>HTML parser</a>, and associate it with the just created
  53750. <code id=parsing-html-fragments:document-5><a href=#document>Document</a></code> node.</p>
  53751. <li>
  53752. <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
  53753. substeps:</p>
  53754. <ol><li>
  53755. <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
  53756. follows:</p>
  53757. <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>,
  53758. <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
  53759. 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>
  53760. <p class=note>For performance reasons, an implementation that does not report errors and
  53761. that uses the actual state machine described in this specification directly could use the
  53762. PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned in the
  53763. list above. Except for rules regarding parse errors, they are equivalent, since there is no
  53764. <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
  53765. transitions.</p>
  53766. <li>
  53767. <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>
  53768. <li>
  53769. <p>Append the element <var>root</var> to the <code id=parsing-html-fragments:document-6><a href=#document>Document</a></code> node created
  53770. above.</p>
  53771. <li>
  53772. <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
  53773. element <var>root</var>.</p>
  53774. <li>
  53775. <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
  53776. <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
  53777. 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
  53778. <a href=#current-template-insertion-mode id=parsing-html-fragments:current-template-insertion-mode>current template insertion mode</a>.</p>
  53779. <li>
  53780. <p><a href=#reset-the-insertion-mode-appropriately id=parsing-html-fragments:reset-the-insertion-mode-appropriately>Reset the parser's insertion mode
  53781. appropriately</a>.</p>
  53782. <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>
  53783. <li>
  53784. <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
  53785. <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>
  53786. element (going straight up the ancestor chain, and including the element itself, if it is a
  53787. <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
  53788. <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>
  53789. </ol>
  53790. <li>
  53791. <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
  53792. 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>
  53793. <li>
  53794. <p>Start the parser and let it run until it has consumed all the characters just inserted into
  53795. the input stream.</p>
  53796. <li>
  53797. <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
  53798. nodes of <var>root</var>, in <a href=#tree-order id=parsing-html-fragments:tree-order>tree order</a>.</p>
  53799. <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
  53800. order</a>.</p>
  53801. </ol>
  53802. <h3 id=named-character-references>12.5 <dfn>Named character references</dfn></h3>
  53803. <p>This table lists the character reference names that are supported by HTML, and the code points
  53804. to which they refer. It is referenced by the previous sections.</p>
  53805. <div id=named-character-references-table>
  53806. <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>&amp;</span> <tr id=entity-AMP-legacy class=impl><td> <code>AMP</code> <td> U+00026 <td> <span>&amp;</span> <tr id=entity-amp><td> <code>amp;</code> <td> U+00026 <td> <span class=glyph>&amp;</span> <tr id=entity-amp-legacy class=impl><td> <code>amp</code> <td> U+00026 <td> <span>&amp;</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>&lt;</span> <tr id=entity-LT-legacy class=impl><td> <code>LT</code> <td> U+0003C <td> <span>&lt;</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>&lt;</span> <tr id=entity-lt-legacy class=impl><td> <code>lt</code> <td> U+0003C <td> <span>&lt;</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">&lt;⃒</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>
  53807. </div>
  53808. <p>This data is also available <a href=entities.json>as a JSON file</a>.</p>
  53809. <p><i>The glyphs displayed above are non-normative. Refer to the Unicode specifications for formal
  53810. definitions of the characters listed above.</i></p>
  53811. <h2 id=the-xhtml-syntax>13 <dfn id=xhtml>The XHTML syntax</dfn></h2>
  53812. <p class=note>This section only describes the rules for XML resources. Rules for
  53813. <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
  53814. syntax</a>".</p>
  53815. <h3 id=writing-xhtml-documents>13.1 Writing XHTML documents</h3>
  53816. <p>The syntax for using HTML with XML, whether in XHTML documents or embedded in other XML
  53817. documents, is defined in the XML and Namespaces in XML specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
  53818. <p>This specification does not define any syntax-level requirements beyond those defined for XML
  53819. proper.</p>
  53820. <p>XML documents may contain a <code>DOCTYPE</code> if desired, but this is not required
  53821. to conform to this specification. This specification does not define a public or system
  53822. identifier, nor provide a formal DTD.</p>
  53823. <p class=note>According to the XML specification, XML processors are not guaranteed to process
  53824. 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
  53825. is unsafe if they are defined in an external file (except for <code>&amp;lt;</code>,
  53826. <code>&amp;gt;</code>, <code>&amp;amp;</code>, <code>&amp;quot;</code>
  53827. and <code>&amp;apos;</code>).</p>
  53828. <h3 id=parsing-xhtml-documents>13.2 Parsing XHTML documents</h3>
  53829. <p>This section describes the relationship between XML and the DOM, with a particular emphasis on
  53830. how this interacts with HTML.</p>
  53831. <p>An <dfn id=xml-parser>XML parser</dfn>, for the purposes of this specification, is a construct that follows
  53832. the rules given in the XML specification to map a string of bytes or characters into a
  53833. <code id=parsing-xhtml-documents:document><a href=#document>Document</a></code> object.</p>
  53834. <p class=note>At the time of writing, no such rules actually exist.</p>
  53835. <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
  53836. created, or creates one implicitly.</p>
  53837. <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
  53838. structure of the input passed to the parser, as defined by the XML specification, the Namespaces
  53839. in XML specification, and the DOM specification. DOM mutation events must not fire for the
  53840. 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
  53841. user agent must act as if elements and attributes were individually appended and set respectively
  53842. so as to trigger rules in this specification regarding what happens when an element is inserted
  53843. into a document or has its attributes set, and the DOM specification's requirements regarding
  53844. 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>
  53845. <p>Between the time an element's start tag is parsed and the time either the element's end tag is
  53846. parsed or the parser detects a well-formedness error, the user agent must act as if the element
  53847. was in a <a href=#stack-of-open-elements id=parsing-xhtml-documents:stack-of-open-elements>stack of open elements</a>.</p>
  53848. <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
  53849. before the <code id=parsing-xhtml-documents:the-param-element><a href=#the-param-element>param</a></code> element children have been parsed.</p>
  53850. <p>This specification provides the following additional information that user agents should use
  53851. when retrieving an external entity: the public identifiers given in the following list all
  53852. 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
  53853. URL is a DTD containing the <a href=http://www.w3.org/TR/xml/#sec-entity-decl>entity
  53854. 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>
  53855. <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>
  53856. <p>Furthermore, user agents should attempt to retrieve the above external entity's content when
  53857. one of the above public identifiers is used, and should not attempt to retrieve any other external
  53858. entity's content.</p>
  53859. <p class=note>This is not strictly a <a href=#willful-violation id=parsing-xhtml-documents:willful-violation>violation</a> of the XML
  53860. specification, but it does contradict the spirit of the XML specification's requirements. This is
  53861. motivated by a desire for user agents to all handle entities in an interoperable fashion without
  53862. requiring any network access for handling external subsets. <a href=#refsXML>[XML]</a></p>
  53863. <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
  53864. invoked with <a href=#xml-scripting-support-enabled id=parsing-xhtml-documents:xml-scripting-support-enabled>XML scripting support enabled</a>.</p>
  53865. <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>
  53866. creates a <code id=parsing-xhtml-documents:the-script-element><a href=#the-script-element>script</a></code> element, it
  53867. 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
  53868. 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
  53869. 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
  53870. 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
  53871. 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
  53872. 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
  53873. the following steps:</p>
  53874. <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>
  53875. 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
  53876. 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
  53877. 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
  53878. 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>
  53879. <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
  53880. 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>
  53881. is not needed in the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-6>XML parser</a>.</p>
  53882. <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>,
  53883. none of this happens.</p>
  53884. <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
  53885. <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
  53886. <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>
  53887. <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,
  53888. 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.
  53889. <a href=#refsXML>[XML]</a></p>
  53890. <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>
  53891. 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
  53892. the node into which the newly created node is to be inserted.</p>
  53893. <p>Certain algorithms in this specification <dfn id=feed-the-parser>spoon-feed the
  53894. 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
  53895. as it would have if faced with a single string consisting of the concatenation of all those
  53896. characters.</p>
  53897. <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
  53898. 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
  53899. 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
  53900. the same way as for an <a href=#html-parser id=parsing-xhtml-documents:html-parser-3>HTML parser</a>.</p>
  53901. <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
  53902. syntax</a>, then it is an <a href=#xml-documents id=parsing-xhtml-documents:xml-documents-2>XML document</a>.</p>
  53903. <h3 id=serialising-xhtml-fragments>13.3 Serialising XHTML fragments</h3>
  53904. <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
  53905. <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
  53906. exception.</p>
  53907. <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
  53908. below apply.</p>
  53909. <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
  53910. error cases below apply.</p>
  53911. <p>In both cases, the string returned must be XML namespace-well-formed and must be an isomorphic
  53912. 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>.
  53913. User agents may adjust prefixes and namespace declarations in the serialisation (and indeed might
  53914. be forced to do so in some cases to obtain namespace-well-formed XML). User agents may use a
  53915. combination of regular text and character references to represent <code id=serialising-xhtml-fragments:text><a href=#text>Text</a></code> nodes in the
  53916. DOM.</p>
  53917. <p>A node's <dfn id=relevant-child-nodes>relevant child nodes</dfn> are those that apply given the following rules:</p>
  53918. <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>
  53919. 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>
  53920. <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
  53921. 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>
  53922. <a href=#refsXMLNS>[XMLNS]</a></p>
  53923. <p>For the purposes of this section, an internal general parsed entity is considered XML
  53924. namespace-well-formed if a document consisting of an element with no namespace declarations whose
  53925. contents are the internal general parsed entity would itself be XML namespace-well-formed.</p>
  53926. <p>If any of the following error cases are found in the DOM subtree being serialised, then the
  53927. algorithm must throw an <code id=serialising-xhtml-fragments:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception instead of returning a
  53928. string:</p>
  53929. <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
  53930. 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
  53931. both a U+0022 QUOTATION MARK (") and a U+0027 APOSTROPHE (') or that contains characters that are
  53932. 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
  53933. 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
  53934. <code id=serialising-xhtml-fragments:processinginstruction><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains characters that are not matched by
  53935. 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
  53936. (-) 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
  53937. 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>
  53938. <p class=note>These are the only ways to make a DOM unserialisable. The DOM enforces all the
  53939. 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
  53940. will throw a <code id=serialising-xhtml-fragments:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
  53941. <h3 id=parsing-xhtml-fragments>13.4 Parsing XHTML fragments</h3>
  53942. <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
  53943. a <code id=parsing-xhtml-fragments:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception. Given a string <var>input</var> and an optional
  53944. context element <var id=parsing-xhtml-fragments:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var>, the algorithm is as
  53945. follows:</p>
  53946. <ol><li>
  53947. <p>Create a new <a href=#xml-parser id=parsing-xhtml-fragments:xml-parser>XML parser</a>.</p>
  53948. <li>
  53949. <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
  53950. parser</a> just created the string corresponding to the start tag of that element, declaring
  53951. all the namespace prefixes that are in scope on that element in the DOM, as well as declaring
  53952. the default namespace (if any) that is in scope on that element in the DOM.</p>
  53953. <p>A namespace prefix is in scope if the DOM <code>lookupNamespaceURI()</code> method
  53954. on the element would return a non-null value for that prefix.</p>
  53955. <p>The default namespace is the namespace for which the DOM <code>isDefaultNamespace()</code> method on the element would return true.</p>
  53956. <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
  53957. <code>DOCTYPE</code> is passed to the parser, and therefore no external subset is
  53958. referenced, and therefore no entities will be recognized.</p>
  53959. <li>
  53960. <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>
  53961. <li>
  53962. <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
  53963. parser</a> just created the string corresponding to the end tag of that element.</p>
  53964. <li>
  53965. <p>If there is an XML well-formedness or XML namespace well-formedness error, then throw a
  53966. <code id=parsing-xhtml-fragments:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
  53967. <li>
  53968. <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
  53969. element of the resulting <code id=parsing-xhtml-fragments:document-2><a href=#document>Document</a></code> has any sibling nodes, then throw a
  53970. <code id=parsing-xhtml-fragments:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
  53971. <li>
  53972. <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
  53973. 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
  53974. order</a>.</p>
  53975. <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
  53976. order</a>.</p>
  53977. </ol>
  53978. <h2 id=rendering>14 Rendering</h2>
  53979. <p><i>User agents are not required to present HTML documents in any particular way. However, this
  53980. section provides a set of suggestions for rendering HTML documents that, if followed, are likely
  53981. to lead to a user experience that closely resembles the experience intended by the documents'
  53982. authors. So as to avoid confusion regarding the normativity of this section, RFC2119 terms have
  53983. not been used. Instead, the term "expected" is used to indicate behavior that will lead to this
  53984. 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
  53985. section has the same conformance implications as the RFC2119-defined term "must".</i></p>
  53986. <h3 id=introduction-17>14.1 Introduction</h3>
  53987. <p>In general, user agents are expected to support CSS, and many of the suggestions in this
  53988. section are expressed in CSS terms. User agents that use other presentation mechanisms can derive
  53989. their expected behavior by translating from the CSS rules given in this section.</p>
  53990. <p>In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are
  53991. expected to render an element so that it conveys to the user the meaning that the element
  53992. <a href=#represents id=introduction-17:represents>represents</a>, as described by this specification.</p>
  53993. <p>The suggestions in this section generally assume a visual output medium with a resolution of
  53994. 96dpi or greater, but HTML is intended to apply to multiple media (it is a
  53995. <i>media-independent</i> language). User agent implementors are encouraged to adapt the
  53996. suggestions in this section to their target media.</p>
  53997. <hr>
  53998. <p>An element is <dfn id=being-rendered>being rendered</dfn> if it has any associated CSS layout boxes, SVG layout
  53999. boxes, or some equivalent in other styling languages.</p>
  54000. <p class=note>Just being off-screen does not mean the element is not <a href=#being-rendered id=introduction-17:being-rendered>being
  54001. rendered</a>. The presence of the <code id=introduction-17:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute normally
  54002. 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
  54003. sheets.</p>
  54004. <hr>
  54005. <p>User agents that do not honor author-level CSS style sheets are nonetheless expected to act as
  54006. if they applied the CSS rules given in these sections in a manner consistent with this
  54007. specification and the relevant CSS and Unicode specifications. <a href=#refsCSS>[CSS]</a> <a href=#refsUNICODE>[UNICODE]</a> <a href=#refsBIDI>[BIDI]</a></p>
  54008. <p class=note>This is especially important for issues relating to the 'display', 'unicode-bidi',
  54009. and 'direction' properties.</p>
  54010. <h3 id=the-css-user-agent-style-sheet-and-presentational-hints>14.2 The CSS user agent style sheet and presentational hints</h3>
  54011. <p>The CSS rules given in these subsections are, except where otherwise specified, expected to be
  54012. used as part of the user-agent level style sheet defaults for all documents that contain
  54013. <a href=#html-elements id=the-css-user-agent-style-sheet-and-presentational-hints:html-elements>HTML elements</a>.</p>
  54014. <p>Some rules are intended for the author-level zero-specificity presentational hints part of the
  54015. CSS cascade; these are explicitly called out as <dfn id=presentational-hints>presentational hints</dfn>.</p>
  54016. <p>Some of the rules regarding left and right margins are given here as appropriate for elements
  54017. whose 'direction' property is 'ltr', and are expected to be flipped around on elements whose
  54018. 'direction' property is 'rtl'. These are marked "<dfn id=ltr-specific>LTR-specific</dfn>".</p>
  54019. <p class=note>These markings only affect the handling of attribute <em>values</em>, not
  54020. attribute names or element names.</p>
  54021. <hr>
  54022. <p>When the text below says that an attribute <var>attribute</var> on an element
  54023. <var>element</var> <dfn id=maps-to-the-pixel-length-property>maps to the pixel length property</dfn> (or properties)
  54024. <var>properties</var>, it means that if <var>element</var> has an attribute <var>attribute</var>
  54025. 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
  54026. integers</a> doesn't generate an error, then the user agent is expected to use the parsed value
  54027. 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
  54028. <var>properties</var>.</p>
  54029. <p>When the text below says that an attribute <var>attribute</var> on an element
  54030. <var>element</var> <dfn id=maps-to-the-dimension-property>maps to the dimension property</dfn> (or properties)
  54031. <var>properties</var>, it means that if <var>element</var> has an attribute <var>attribute</var>
  54032. 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>
  54033. doesn't generate an error, then the user agent is expected to use the parsed dimension as the
  54034. value for a <a href=#presentational-hints id=the-css-user-agent-style-sheet-and-presentational-hints:presentational-hints-2>presentational hint</a> for
  54035. <var>properties</var>, with the value given as a pixel length if the dimension was an integer, and
  54036. with the value given as a percentage if the dimension was a percentage.</p>
  54037. <p>When a user agent is to <dfn id=align-descendants>align descendants</dfn> of a node, the user agent is expected to
  54038. align only those descendants that have both their 'margin-left' and 'margin-right' properties
  54039. computing to a value other than 'auto', that are over-constrained and that have one of those two
  54040. margins with a used value forced to a greater value, and that do not themselves have an applicable
  54041. <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
  54042. element is expected to override the others. Aligned elements are expected to be aligned by having
  54043. the used values of their left and right margins be set accordingly.</p>
  54044. <h3 id=non-replaced-elements>14.3 Non-replaced elements</h3>
  54045. <h4 id=hidden-elements>14.3.1 Hidden elements</h4>
  54046. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54047. <span id=hiddenCSS>[hidden]</span>, area, base, basefont, datalist, head, link, menu[type=popup i], meta,
  54048. noembed, noframes, param, rp, script, source, style, template, track, title {
  54049. display: none;
  54050. }
  54051. embed[hidden] { display: inline; height: 0; width: 0; }</pre>
  54052. <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
  54053. for whom <a href=#concept-n-script id=hidden-elements:concept-n-script>scripting is enabled</a> to compute to 'none',
  54054. irrespective of CSS rules.</p>
  54055. <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
  54056. <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
  54057. rules.</p>
  54058. <h4 id=the-page>14.3.2 The page</h4>
  54059. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54060. html, body { display: block; }</pre>
  54061. <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
  54062. 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
  54063. none of the attributes for a property are found, or if the value of the attribute that was found
  54064. 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
  54065. <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
  54066. default value of 8px is expected to be used for that property instead.</p>
  54067. <table><thead><tr><th>Property
  54068. <th>Source
  54069. <tbody><tr><td rowspan=3>'margin-top'
  54070. <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
  54071. <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
  54072. <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
  54073. <tbody><tr><td rowspan=3>'margin-right'
  54074. <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
  54075. <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
  54076. <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
  54077. <tbody><tr><td rowspan=3>'margin-bottom'
  54078. <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
  54079. <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
  54080. <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
  54081. <tbody><tr><td rowspan=3>'margin-left'
  54082. <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
  54083. <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
  54084. <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
  54085. </table>
  54086. <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
  54087. <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
  54088. <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
  54089. 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>
  54090. 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>
  54091. <p class=warning>The above requirements imply that a page can change the margins of another page
  54092. (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
  54093. is potentially a security risk, as it might in some cases allow an attack to contrive a situation
  54094. in which a page is rendered not as the author intended, possibly for the purposes of phishing or
  54095. otherwise misleading the user.</p>
  54096. <hr>
  54097. <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
  54098. 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>.
  54099. 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
  54100. viewport with zero width and zero height.</p>
  54101. <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
  54102. <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
  54103. <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
  54104. case-insensitive</a> match for the string "<code>off</code>", "<code>noscroll</code>", or "<code>no</code>", then the user agent is expected to
  54105. 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
  54106. context</a>, regardless of the 'overflow' property that applies to that viewport.</p>
  54107. <hr>
  54108. <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>
  54109. 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
  54110. expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints>presentational hint</a>
  54111. setting the element's 'background-image' property to the resulting <a href=#absolute-url id=the-page:absolute-url>absolute URL</a>.</p>
  54112. <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
  54113. 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
  54114. value</a>, and if that does not return an error, the user agent is expected to treat the
  54115. attribute as a <a href=#presentational-hints id=the-page:presentational-hints-2>presentational hint</a> setting the element's
  54116. 'background-color' property to the resulting colour.</p>
  54117. <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
  54118. 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
  54119. 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
  54120. the resulting colour.</p>
  54121. <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
  54122. 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
  54123. 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
  54124. 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>
  54125. <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,
  54126. 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>,
  54127. 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
  54128. element in the <code id=the-page:document-4><a href=#document>Document</a></code> matching the ':visited' pseudo-class to the resulting
  54129. colour.</p>
  54130. <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,
  54131. 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>,
  54132. 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
  54133. element in the <code id=the-page:document-5><a href=#document>Document</a></code> matching the ':active' pseudo-class and either the ':link'
  54134. pseudo-class or the ':visited' pseudo-class to the resulting colour.</p>
  54135. <h4 id=flow-content-3>14.3.3 Flow content</h4>
  54136. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54137. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  54138. legend, listing, main, p, plaintext, pre, summary, xmp {
  54139. display: block;
  54140. }
  54141. blockquote, figure, listing, p, plaintext, pre, xmp {
  54142. margin-top: 1em; margin-bottom: 1em;
  54143. }
  54144. blockquote, figure { margin-left: 40px; margin-right: 40px; }
  54145. address { font-style: italic; }
  54146. listing, plaintext, pre, xmp {
  54147. font-family: monospace; white-space: pre;
  54148. }
  54149. dialog:not([open]) { display: none; }
  54150. dialog {
  54151. position: absolute;
  54152. left: 0; right: 0;
  54153. width: fit-content;
  54154. height: fit-content;
  54155. margin: auto;
  54156. border: solid;
  54157. padding: 1em;
  54158. background: white;
  54159. color: black;
  54160. }
  54161. dialog::backdrop {
  54162. position: fixed;
  54163. top: 0; right: 0; bottom: 0; left: 0;
  54164. background: rgba(0,0,0,0.1);
  54165. }
  54166. /* for small devices, modal dialogs go full-screen */
  54167. @media screen and (max-width: 540px) {
  54168. dialog:modal {
  54169. top: 0;
  54170. width: auto;
  54171. margin: 1em;
  54172. }
  54173. }
  54174. </pre>
  54175. <p>The following rules are also expected to apply, as <a href=#presentational-hints id=flow-content-3:presentational-hints>presentational hints</a>:</p>
  54176. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54177. pre[wrap] { white-space: pre-wrap; }</pre>
  54178. <p>In <a href=#quirks-mode id=flow-content-3:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
  54179. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54180. form { margin-bottom: 1em; }</pre>
  54181. <hr>
  54182. <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
  54183. case-insensitive</a> match for either the string "<code>center</code>" or the string
  54184. "<code>middle</code>", are expected to center text within themselves, as if they had
  54185. 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>
  54186. <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>
  54187. 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
  54188. 'text-align' property set to 'left' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-3>presentational
  54189. hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-2>align descendants</a> to the left.</p>
  54190. <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>
  54191. 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
  54192. 'text-align' property set to 'right' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-4>presentational
  54193. hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-3>align descendants</a> to the right.</p>
  54194. <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>
  54195. 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
  54196. 'text-align' property set to 'justify' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-5>presentational
  54197. hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-4>align descendants</a> to the left.</p>
  54198. <h4 id=phrasing-content-3>14.3.4 Phrasing content</h4>
  54199. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54200. cite, dfn, em, i, var { font-style: italic; }
  54201. b, strong { font-weight: bolder; }
  54202. code, kbd, samp, tt { font-family: monospace; }
  54203. big { font-size: larger; }
  54204. small { font-size: smaller; }
  54205. sub { vertical-align: sub; }
  54206. sup { vertical-align: super; }
  54207. sub, sup { line-height: normal; font-size: smaller; }
  54208. ruby { display: ruby; }
  54209. rt { display: ruby-text; }
  54210. :link { color: #0000EE; }
  54211. :visited { color: #551A8B; }
  54212. :link, :visited { text-decoration: underline; }
  54213. a:link[rel~=help], a:visited[rel~=help],
  54214. area:link[rel~=help], area:visited[rel~=help] { cursor: help; }
  54215. :focus { outline: auto; }
  54216. mark { background: yellow; color: black; } /* this colour is just a suggestion and can be changed based on implementation feedback */
  54217. abbr[title], acronym[title] { text-decoration: dotted underline; }
  54218. ins, u { text-decoration: underline; }
  54219. del, s, strike { text-decoration: line-through; }
  54220. blink { text-decoration: blink; }
  54221. q::before { content: open-quote; }
  54222. q::after { content: close-quote; }
  54223. <span id=br-wbr-content>br { display-outside: newline; } /* <a href=#bidi-rendering>this also has bidi implications</a> */
  54224. nobr { white-space: nowrap; }
  54225. wbr { content: '\200B'; } /* <a href=#bidi-rendering>this also has bidi implications</a> */
  54226. nobr wbr { white-space: normal; }</span></pre>
  54227. <p>The following rules are also expected to apply, as
  54228. <a href=#presentational-hints id=phrasing-content-3:presentational-hints>presentational hints</a>:</p>
  54229. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54230. br[clear=left i] { clear: left; }
  54231. br[clear=right i] { clear: right; }
  54232. br[clear=all i], br[clear=both i] { clear: both; }</pre>
  54233. <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
  54234. 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
  54235. whose 'display' property has the value 'ruby-base'. <a href=#refsCSSRUBY>[CSSRUBY]</a></p>
  54236. <p>When a particular part of a ruby has more than one annotation, the annotations should be
  54237. distributed on both sides of the base text so as to minimise the stacking of ruby annotations on
  54238. one side.</p>
  54239. <p class=note>When it becomes possible to do so, the preceding requirement will be updated to be
  54240. 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>
  54241. 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
  54242. expressed.)</p>
  54243. <p>User agents that do not support correct ruby rendering are expected to render parentheses
  54244. 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>
  54245. <hr>
  54246. <p>User agents are expected to support the 'clear' property on inline elements (in order to render
  54247. <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
  54248. described in the non-normative note to this effect in CSS2.1.</p>
  54249. <p>The initial value for the 'color' property is expected to be black. The initial value for the
  54250. 'background-color' property is expected to be 'transparent'. The canvas' background is expected to
  54251. be white.</p>
  54252. <hr>
  54253. <p>When a <code id=phrasing-content-3:font><a href=#font>font</a></code> element has a <code>color</code>
  54254. 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
  54255. value</a>, and if that does not return an error, the user agent is expected to treat the
  54256. attribute as a <a href=#presentational-hints id=phrasing-content-3:presentational-hints-2>presentational hint</a> setting the
  54257. element's 'color' property to the resulting colour.</p>
  54258. <p>When a <code id=phrasing-content-3:font-2><a href=#font>font</a></code> element has a <code>face</code>
  54259. 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
  54260. value.</p>
  54261. <p>When a <code id=phrasing-content-3:font-3><a href=#font>font</a></code> element has a <code>size</code>
  54262. 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
  54263. 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>
  54264. <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
  54265. 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
  54266. <var>mode</var> be <i>relative-plus</i>, and advance <var>position</var> to the next character.
  54267. Otherwise, if the character at <var>position</var> is a U+002D HYPHEN-MINUS character (-), then
  54268. let <var>mode</var> be <i>relative-minus</i>, and advance <var>position</var> to the next
  54269. 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
  54270. 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
  54271. number.<li>
  54272. <p>If <var>mode</var> is <i>relative-plus</i>, then increment <var>value</var> by 3. If
  54273. <var>mode</var> is <i>relative-minus</i>, then let <var>value</var> be the result of subtracting
  54274. <var>value</var> from 3.</p>
  54275. <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>
  54276. <p>Set 'font-size' to the keyword corresponding to the value of <var>value</var> according to
  54277. the following table:</p>
  54278. <table><thead><tr><th><var>value</var>
  54279. <th>'font-size' keyword
  54280. <th>Notes
  54281. <tbody><tr><td>1
  54282. <td>x-small
  54283. <td>
  54284. <tr><td>2
  54285. <td>small
  54286. <td>
  54287. <tr><td>3
  54288. <td>medium
  54289. <td>
  54290. <tr><td>4
  54291. <td>large
  54292. <td>
  54293. <tr><td>5
  54294. <td>x-large
  54295. <td>
  54296. <tr><td>6
  54297. <td>xx-large
  54298. <td>
  54299. <tr><td>7
  54300. <td>xxx-large
  54301. <td><i>see below</i>
  54302. </table>
  54303. <p class=tablenote><small>The 'xxx-large' value is a non-CSS value used here to
  54304. indicate a font size 50% larger than 'xx-large'.</small></p>
  54305. </ol>
  54306. <h4 id=bidi-rendering>14.3.5 Bidirectional text</h4>
  54307. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54308. [dir]:dir(ltr), bdi:dir(ltr), input[type=tel]:dir(ltr) { direction: ltr; }
  54309. [dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; }
  54310. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  54311. legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
  54312. h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
  54313. tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
  54314. [dir=ltr i], [dir=rtl i], [dir=auto i] {
  54315. unicode-bidi: isolate;
  54316. }
  54317. bdo, bdo[dir] { unicode-bidi: isolate-override; }
  54318. textarea[dir=auto i], pre[dir=auto i] { unicode-bidi: plaintext; }
  54319. /* 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>
  54320. <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
  54321. <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>,
  54322. <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>,
  54323. 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
  54324. user interface with a directionality that matches the element's 'direction' property.</p>
  54325. <p>When the document's character encoding is ISO-8859-8, the following rules are additionally
  54326. expected to apply, following those above: <a href=#refsENCODING>[ENCODING]</a></p>
  54327. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54328. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  54329. legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
  54330. h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
  54331. tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, [dir=ltr i],
  54332. [dir=rtl i], [dir=auto i], *|* {
  54333. unicode-bidi: bidi-override;
  54334. }
  54335. input:not([type=submit i]):not([type=reset i]):not([type=button i]),
  54336. textarea, keygen {
  54337. unicode-bidi: normal;
  54338. }</pre>
  54339. <h4 id=quotes>14.3.6 Quotes</h4>
  54340. <p>This block is automatically generated from the Unicode Common Locale Data Repository. <a href=#refsCLDR>[CLDR]</a></p>
  54341. <p>User agents are expected to use either the block below (which will be regularly updated) or to
  54342. automatically generate their own copy directly from the source material. The language codes are
  54343. derived from the CLDR file names. The quotes are derived from the <code>delimiter</code>
  54344. blocks, with fallback handled as specified in the CLDR documentation.</p>
  54345. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54346. :root { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54347. :root:lang(af), :not(:lang(af)) > :lang(af) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54348. :root:lang(agq), :not(:lang(agq)) > :lang(agq) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
  54349. :root:lang(ak), :not(:lang(ak)) > :lang(ak) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54350. :root:lang(am), :not(:lang(am)) > :lang(am) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54351. :root:lang(ar), :not(:lang(ar)) > :lang(ar) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
  54352. :root:lang(asa), :not(:lang(asa)) > :lang(asa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54353. :root:lang(ast), :not(:lang(ast)) > :lang(ast) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54354. :root:lang(az), :not(:lang(az)) > :lang(az) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54355. :root:lang(az-Cyrl), :not(:lang(az-Cyrl)) > :lang(az-Cyrl) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54356. :root:lang(bas), :not(:lang(bas)) > :lang(bas) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
  54357. :root:lang(bem), :not(:lang(bem)) > :lang(bem) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54358. :root:lang(bez), :not(:lang(bez)) > :lang(bez) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54359. :root:lang(bg), :not(:lang(bg)) > :lang(bg) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
  54360. :root:lang(bm), :not(:lang(bm)) > :lang(bm) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54361. :root:lang(bn), :not(:lang(bn)) > :lang(bn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54362. :root:lang(br), :not(:lang(br)) > :lang(br) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54363. :root:lang(brx), :not(:lang(brx)) > :lang(brx) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54364. :root:lang(bs), :not(:lang(bs)) > :lang(bs) { quotes: '\201e' '\201c' '\2018' '\2019' } /* „ “ ‘ ’ */
  54365. :root:lang(bs-Cyrl), :not(:lang(bs-Cyrl)) > :lang(bs-Cyrl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54366. :root:lang(ca), :not(:lang(ca)) > :lang(ca) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54367. :root:lang(cgg), :not(:lang(cgg)) > :lang(cgg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54368. :root:lang(chr), :not(:lang(chr)) > :lang(chr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54369. :root:lang(cs), :not(:lang(cs)) > :lang(cs) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54370. :root:lang(cy), :not(:lang(cy)) > :lang(cy) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
  54371. :root:lang(da), :not(:lang(da)) > :lang(da) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54372. :root:lang(dav), :not(:lang(dav)) > :lang(dav) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54373. :root:lang(de), :not(:lang(de)) > :lang(de) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54374. :root:lang(de-CH), :not(:lang(de-CH)) > :lang(de-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54375. :root:lang(dje), :not(:lang(dje)) > :lang(dje) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54376. :root:lang(dsb), :not(:lang(dsb)) > :lang(dsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54377. :root:lang(dua), :not(:lang(dua)) > :lang(dua) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
  54378. :root:lang(dyo), :not(:lang(dyo)) > :lang(dyo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54379. :root:lang(dz), :not(:lang(dz)) > :lang(dz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54380. :root:lang(ebu), :not(:lang(ebu)) > :lang(ebu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54381. :root:lang(ee), :not(:lang(ee)) > :lang(ee) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54382. :root:lang(el), :not(:lang(el)) > :lang(el) { quotes: '\00ab' '\00bb' '\0022' '\0022' } /* « » " " */
  54383. :root:lang(en), :not(:lang(en)) > :lang(en) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54384. :root:lang(es), :not(:lang(es)) > :lang(es) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54385. :root:lang(et), :not(:lang(et)) > :lang(et) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54386. :root:lang(eu), :not(:lang(eu)) > :lang(eu) { quotes: '\0022' '\0022' '\0022' '\0022' } /* " " " " */
  54387. :root:lang(ewo), :not(:lang(ewo)) > :lang(ewo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54388. :root:lang(fa), :not(:lang(fa)) > :lang(fa) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54389. :root:lang(ff), :not(:lang(ff)) > :lang(ff) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
  54390. :root:lang(fi), :not(:lang(fi)) > :lang(fi) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
  54391. :root:lang(fil), :not(:lang(fil)) > :lang(fil) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54392. :root:lang(fr), :not(:lang(fr)) > :lang(fr) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
  54393. :root:lang(fr-CA), :not(:lang(fr-CA)) > :lang(fr-CA) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54394. :root:lang(fr-CH), :not(:lang(fr-CH)) > :lang(fr-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54395. :root:lang(ga), :not(:lang(ga)) > :lang(ga) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54396. :root:lang(gd), :not(:lang(gd)) > :lang(gd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54397. :root:lang(gl), :not(:lang(gl)) > :lang(gl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54398. :root:lang(gsw), :not(:lang(gsw)) > :lang(gsw) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54399. :root:lang(gu), :not(:lang(gu)) > :lang(gu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54400. :root:lang(guz), :not(:lang(guz)) > :lang(guz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54401. :root:lang(ha), :not(:lang(ha)) > :lang(ha) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54402. :root:lang(he), :not(:lang(he)) > :lang(he) { quotes: '\05f4' '\05f4' '\05f3' '\05f3' } /* ״ ״ ׳ ׳ */
  54403. :root:lang(hi), :not(:lang(hi)) > :lang(hi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54404. :root:lang(hr), :not(:lang(hr)) > :lang(hr) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54405. :root:lang(hsb), :not(:lang(hsb)) > :lang(hsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54406. :root:lang(hu), :not(:lang(hu)) > :lang(hu) { quotes: '\201e' '\201d' '\00bb' '\00ab' } /* „ ” » « */
  54407. :root:lang(hy), :not(:lang(hy)) > :lang(hy) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
  54408. :root:lang(id), :not(:lang(id)) > :lang(id) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54409. :root:lang(ig), :not(:lang(ig)) > :lang(ig) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54410. :root:lang(is), :not(:lang(is)) > :lang(is) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54411. :root:lang(it), :not(:lang(it)) > :lang(it) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54412. :root:lang(ja), :not(:lang(ja)) > :lang(ja) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
  54413. :root:lang(jgo), :not(:lang(jgo)) > :lang(jgo) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54414. :root:lang(jmc), :not(:lang(jmc)) > :lang(jmc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54415. :root:lang(ka), :not(:lang(ka)) > :lang(ka) { quotes: '\201e' '\201c' '\00ab' '\00bb' } /* „ “ « » */
  54416. :root:lang(kab), :not(:lang(kab)) > :lang(kab) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54417. :root:lang(kam), :not(:lang(kam)) > :lang(kam) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54418. :root:lang(kde), :not(:lang(kde)) > :lang(kde) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54419. :root:lang(kea), :not(:lang(kea)) > :lang(kea) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54420. :root:lang(khq), :not(:lang(khq)) > :lang(khq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54421. :root:lang(ki), :not(:lang(ki)) > :lang(ki) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54422. :root:lang(kk), :not(:lang(kk)) > :lang(kk) { quotes: '\201c' '\0022' '\2018' '\2019' } /* “ " ‘ ’ */
  54423. :root:lang(kkj), :not(:lang(kkj)) > :lang(kkj) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
  54424. :root:lang(kln), :not(:lang(kln)) > :lang(kln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54425. :root:lang(km), :not(:lang(km)) > :lang(km) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54426. :root:lang(kn), :not(:lang(kn)) > :lang(kn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54427. :root:lang(ko), :not(:lang(ko)) > :lang(ko) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54428. :root:lang(ksb), :not(:lang(ksb)) > :lang(ksb) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54429. :root:lang(ksf), :not(:lang(ksf)) > :lang(ksf) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
  54430. :root:lang(ky), :not(:lang(ky)) > :lang(ky) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
  54431. :root:lang(lag), :not(:lang(lag)) > :lang(lag) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
  54432. :root:lang(lb), :not(:lang(lb)) > :lang(lb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54433. :root:lang(lg), :not(:lang(lg)) > :lang(lg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54434. :root:lang(ln), :not(:lang(ln)) > :lang(ln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54435. :root:lang(lo), :not(:lang(lo)) > :lang(lo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54436. :root:lang(lt), :not(:lang(lt)) > :lang(lt) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
  54437. :root:lang(lu), :not(:lang(lu)) > :lang(lu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54438. :root:lang(luo), :not(:lang(luo)) > :lang(luo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54439. :root:lang(luy), :not(:lang(luy)) > :lang(luy) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54440. :root:lang(lv), :not(:lang(lv)) > :lang(lv) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54441. :root:lang(mas), :not(:lang(mas)) > :lang(mas) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54442. :root:lang(mer), :not(:lang(mer)) > :lang(mer) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54443. :root:lang(mfe), :not(:lang(mfe)) > :lang(mfe) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54444. :root:lang(mg), :not(:lang(mg)) > :lang(mg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54445. :root:lang(mgo), :not(:lang(mgo)) > :lang(mgo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54446. :root:lang(mk), :not(:lang(mk)) > :lang(mk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54447. :root:lang(ml), :not(:lang(ml)) > :lang(ml) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54448. :root:lang(mn), :not(:lang(mn)) > :lang(mn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54449. :root:lang(mr), :not(:lang(mr)) > :lang(mr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54450. :root:lang(ms), :not(:lang(ms)) > :lang(ms) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54451. :root:lang(mt), :not(:lang(mt)) > :lang(mt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54452. :root:lang(mua), :not(:lang(mua)) > :lang(mua) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54453. :root:lang(my), :not(:lang(my)) > :lang(my) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54454. :root:lang(naq), :not(:lang(naq)) > :lang(naq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54455. :root:lang(nb), :not(:lang(nb)) > :lang(nb) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
  54456. :root:lang(nd), :not(:lang(nd)) > :lang(nd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54457. :root:lang(ne), :not(:lang(ne)) > :lang(ne) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54458. :root:lang(nl), :not(:lang(nl)) > :lang(nl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54459. :root:lang(nmg), :not(:lang(nmg)) > :lang(nmg) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
  54460. :root:lang(nn), :not(:lang(nn)) > :lang(nn) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
  54461. :root:lang(nnh), :not(:lang(nnh)) > :lang(nnh) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54462. :root:lang(nus), :not(:lang(nus)) > :lang(nus) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54463. :root:lang(nyn), :not(:lang(nyn)) > :lang(nyn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54464. :root:lang(pa), :not(:lang(pa)) > :lang(pa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54465. :root:lang(pl), :not(:lang(pl)) > :lang(pl) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
  54466. :root:lang(pt), :not(:lang(pt)) > :lang(pt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54467. :root:lang(pt-PT), :not(:lang(pt-PT)) > :lang(pt-PT) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54468. :root:lang(rn), :not(:lang(rn)) > :lang(rn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
  54469. :root:lang(ro), :not(:lang(ro)) > :lang(ro) { quotes: '\201c' '\201d' '\00ab' '\00bb' } /* “ ” « » */
  54470. :root:lang(rof), :not(:lang(rof)) > :lang(rof) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54471. :root:lang(ru), :not(:lang(ru)) > :lang(ru) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
  54472. :root:lang(rw), :not(:lang(rw)) > :lang(rw) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
  54473. :root:lang(rwk), :not(:lang(rwk)) > :lang(rwk) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54474. :root:lang(saq), :not(:lang(saq)) > :lang(saq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54475. :root:lang(sbp), :not(:lang(sbp)) > :lang(sbp) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54476. :root:lang(seh), :not(:lang(seh)) > :lang(seh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54477. :root:lang(ses), :not(:lang(ses)) > :lang(ses) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54478. :root:lang(sg), :not(:lang(sg)) > :lang(sg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54479. :root:lang(shi), :not(:lang(shi)) > :lang(shi) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
  54480. :root:lang(shi-Latn), :not(:lang(shi-Latn)) > :lang(shi-Latn) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
  54481. :root:lang(si), :not(:lang(si)) > :lang(si) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54482. :root:lang(sk), :not(:lang(sk)) > :lang(sk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54483. :root:lang(sl), :not(:lang(sl)) > :lang(sl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
  54484. :root:lang(sn), :not(:lang(sn)) > :lang(sn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
  54485. :root:lang(so), :not(:lang(so)) > :lang(so) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54486. :root:lang(sq), :not(:lang(sq)) > :lang(sq) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
  54487. :root:lang(sr), :not(:lang(sr)) > :lang(sr) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
  54488. :root:lang(sr-Latn), :not(:lang(sr-Latn)) > :lang(sr-Latn) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
  54489. :root:lang(sv), :not(:lang(sv)) > :lang(sv) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
  54490. :root:lang(sw), :not(:lang(sw)) > :lang(sw) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54491. :root:lang(swc), :not(:lang(swc)) > :lang(swc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54492. :root:lang(ta), :not(:lang(ta)) > :lang(ta) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54493. :root:lang(te), :not(:lang(te)) > :lang(te) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54494. :root:lang(teo), :not(:lang(teo)) > :lang(teo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54495. :root:lang(th), :not(:lang(th)) > :lang(th) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54496. :root:lang(ti-ER), :not(:lang(ti-ER)) > :lang(ti-ER) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
  54497. :root:lang(to), :not(:lang(to)) > :lang(to) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54498. :root:lang(tr), :not(:lang(tr)) > :lang(tr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54499. :root:lang(twq), :not(:lang(twq)) > :lang(twq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54500. :root:lang(tzm), :not(:lang(tzm)) > :lang(tzm) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54501. :root:lang(uk), :not(:lang(uk)) > :lang(uk) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
  54502. :root:lang(ur), :not(:lang(ur)) > :lang(ur) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
  54503. :root:lang(ur-IN), :not(:lang(ur-IN)) > :lang(ur-IN) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
  54504. :root:lang(uz), :not(:lang(uz)) > :lang(uz) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
  54505. :root:lang(uz-Cyrl), :not(:lang(uz-Cyrl)) > :lang(uz-Cyrl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54506. :root:lang(vai), :not(:lang(vai)) > :lang(vai) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54507. :root:lang(vai-Latn), :not(:lang(vai-Latn)) > :lang(vai-Latn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54508. :root:lang(vi), :not(:lang(vi)) > :lang(vi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54509. :root:lang(vun), :not(:lang(vun)) > :lang(vun) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54510. :root:lang(xog), :not(:lang(xog)) > :lang(xog) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54511. :root:lang(yav), :not(:lang(yav)) > :lang(yav) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
  54512. :root:lang(yo), :not(:lang(yo)) > :lang(yo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54513. :root:lang(zgh), :not(:lang(zgh)) > :lang(zgh) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
  54514. :root:lang(zh), :not(:lang(zh)) > :lang(zh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54515. :root:lang(zh-Hant), :not(:lang(zh-Hant)) > :lang(zh-Hant) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
  54516. :root:lang(zu), :not(:lang(zu)) > :lang(zu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
  54517. </pre>
  54518. <h4 id=sections-and-headings>14.3.7 Sections and headings</h4>
  54519. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54520. article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
  54521. display: block;
  54522. }
  54523. h1 { margin-top: 0.67em; margin-bottom: 0.67em; font-size: 2.00em; font-weight: bold; }
  54524. h2 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; font-weight: bold; }
  54525. h3 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; font-weight: bold; }
  54526. h4 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; font-weight: bold; }
  54527. h5 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; font-weight: bold; }
  54528. h6 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; font-weight: bold; }</pre>
  54529. <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>
  54530. 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
  54531. <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
  54532. <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
  54533. 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>,
  54534. 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>
  54535. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54536. <var>x</var> h1 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; }
  54537. <var>x</var> <var>x</var> h1 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
  54538. <var>x</var> <var>x</var> <var>x</var> h1 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
  54539. <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; }
  54540. <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; }
  54541. <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
  54542. <var>x</var> <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
  54543. <var>x</var> <var>x</var> <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
  54544. <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; }
  54545. <var>x</var> hgroup > h1 ~ h3 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
  54546. <var>x</var> <var>x</var> hgroup > h1 ~ h3 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
  54547. <var>x</var> <var>x</var> <var>x</var> hgroup > h1 ~ h3 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
  54548. <var>x</var> hgroup > h1 ~ h4 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
  54549. <var>x</var> <var>x</var> hgroup > h1 ~ h4 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
  54550. <var>x</var> hgroup > h1 ~ h5 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }</pre>
  54551. <h4 id=lists>14.3.8 Lists</h4>
  54552. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54553. dir, dd, dl, dt, menu, ol, ul { display: block; }
  54554. li { display: list-item; }
  54555. dir, dl, menu, ol, ul { margin-top: 1em; margin-bottom: 1em; }
  54556. dir dir, dir dl, dir menu, dir ol, dir ul,
  54557. dl dir, dl dl, dl menu, dl ol, dl ul,
  54558. menu dir, menu dl, menu menu, menu ol, menu ul,
  54559. ol dir, ol dl, ol menu, ol ol, ol ul,
  54560. ul dir, ul dl, ul menu, ul ol, ul ul {
  54561. margin-top: 0; margin-bottom: 0;
  54562. }
  54563. dd { margin-left: 40px; } /* <a href=#ltr-specific id=lists:ltr-specific>LTR-specific</a>: use 'margin-right' for rtl elements */
  54564. 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 */
  54565. ol { list-style-type: decimal; }
  54566. dir, menu, ul { list-style-type: disc; }
  54567. dir dir, dir menu, dir ul,
  54568. menu dir, menu menu, menu ul,
  54569. ol dir, ol menu, ol ul,
  54570. ul dir, ul menu, ul ul {
  54571. list-style-type: circle;
  54572. }
  54573. dir dir dir, dir dir menu, dir dir ul,
  54574. dir menu dir, dir menu menu, dir menu ul,
  54575. dir ol dir, dir ol menu, dir ol ul,
  54576. dir ul dir, dir ul menu, dir ul ul,
  54577. menu dir dir, menu dir menu, menu dir ul,
  54578. menu menu dir, menu menu menu, menu menu ul,
  54579. menu ol dir, menu ol menu, menu ol ul,
  54580. menu ul dir, menu ul menu, menu ul ul,
  54581. ol dir dir, ol dir menu, ol dir ul,
  54582. ol menu dir, ol menu menu, ol menu ul,
  54583. ol ol dir, ol ol menu, ol ol ul,
  54584. ol ul dir, ol ul menu, ol ul ul,
  54585. ul dir dir, ul dir menu, ul dir ul,
  54586. ul menu dir, ul menu menu, ul menu ul,
  54587. ul ol dir, ul ol menu, ul ol ul,
  54588. ul ul dir, ul ul menu, ul ul ul {
  54589. list-style-type: square;
  54590. }</pre>
  54591. <p id=decohints>The following rules are also expected to apply, as <a href=#presentational-hints id=lists:presentational-hints>presentational
  54592. hints</a>:</p>
  54593. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54594. ol[type=1], li[type=1] { list-style-type: decimal; }
  54595. ol[type=a], li[type=a] { list-style-type: lower-alpha; }
  54596. ol[type=A], li[type=A] { list-style-type: upper-alpha; }
  54597. ol[type=i], li[type=i] { list-style-type: lower-roman; }
  54598. ol[type=I], li[type=I] { list-style-type: upper-roman; }
  54599. ul[type=none i], li[type=none i] { list-style-type: none; }
  54600. ul[type=disc i], li[type=disc i] { list-style-type: disc; }
  54601. ul[type=circle i], li[type=circle i] { list-style-type: circle; }
  54602. ul[type=square i], li[type=square i] { list-style-type: square; }</pre>
  54603. <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
  54604. <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
  54605. marker.</p>
  54606. <p id=css-list-rendering class=critical>This specification does not yet define the
  54607. 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
  54608. sufficient hooks for this purpose.</p>
  54609. <h4 id=tables-2>14.3.9 Tables</h4>
  54610. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54611. table { display: table; }
  54612. caption { display: table-caption; }
  54613. colgroup, colgroup[hidden] { display: table-column-group; }
  54614. col, col[hidden] { display: table-column; }
  54615. thead, thead[hidden] { display: table-header-group; }
  54616. tbody, tbody[hidden] { display: table-row-group; }
  54617. tfoot, tfoot[hidden] { display: table-footer-group; }
  54618. tr, tr[hidden] { display: table-row; }
  54619. td, th, td[hidden], th[hidden] { display: table-cell; }
  54620. colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
  54621. tfoot[hidden], tr[hidden], td[hidden], th[hidden] {
  54622. visibility: collapse;
  54623. }
  54624. table {
  54625. box-sizing: border-box;
  54626. border-spacing: 2px;
  54627. border-collapse: separate;
  54628. text-indent: initial;
  54629. }
  54630. td, th { padding: 1px; }
  54631. th { font-weight: bold; }
  54632. thead, tbody, tfoot, table > tr { vertical-align: middle; }
  54633. tr, td, th { vertical-align: inherit; }
  54634. table, td, th { border-color: gray; }
  54635. thead, tbody, tfoot, tr { border-color: inherit; }
  54636. table[rules=none i], table[rules=groups i], table[rules=rows i],
  54637. table[rules=cols i], table[rules=all i], table[frame=void i],
  54638. table[frame=above i], table[frame=below i], table[frame=hsides i],
  54639. table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
  54640. table[frame=box i], table[frame=border i],
  54641. table[rules=none i] > tr > td, table[rules=none i] > tr > th,
  54642. table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
  54643. table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
  54644. table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
  54645. table[rules=all i] > tr > td, table[rules=all i] > tr > th,
  54646. table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
  54647. table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
  54648. table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
  54649. table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
  54650. table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
  54651. table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
  54652. table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
  54653. table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
  54654. table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
  54655. table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
  54656. table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
  54657. table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
  54658. table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th,
  54659. table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
  54660. table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
  54661. border-color: black;
  54662. }</pre>
  54663. <p>The following rules are also expected to apply, as <a href=#presentational-hints id=tables-2:presentational-hints>presentational hints</a>:</p>
  54664. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54665. table[align=left i] { float: left; }
  54666. table[align=right i] { float: right; }
  54667. table[align=center i] { margin-left: auto; margin-right: auto; }
  54668. thead[align=absmiddle i], tbody[align=absmiddle i], tfoot[align=absmiddle i],
  54669. tr[align=absmiddle i], td[align=absmiddle i], th[align=absmiddle i] {
  54670. text-align: center;
  54671. }
  54672. caption[align=bottom i] { caption-side: bottom; }
  54673. p[align=left i], h1[align=left i], h2[align=left i], h3[align=left i],
  54674. h4[align=left i], h5[align=left i], h6[align=left i] {
  54675. text-align: left;
  54676. }
  54677. p[align=right i], h1[align=right i], h2[align=right i], h3[align=right i],
  54678. h4[align=right i], h5[align=right i], h6[align=right i] {
  54679. text-align: right;
  54680. }
  54681. p[align=center i], h1[align=center i], h2[align=center i], h3[align=center i],
  54682. h4[align=center i], h5[align=center i], h6[align=center i] {
  54683. text-align: center;
  54684. }
  54685. p[align=justify i], h1[align=justify i], h2[align=justify i], h3[align=justify i],
  54686. h4[align=justify i], h5[align=justify i], h6[align=justify i] {
  54687. text-align: justify;
  54688. }
  54689. thead[valign=top i], tbody[valign=top i], tfoot[valign=top i],
  54690. tr[valign=top i], td[valign=top i], th[valign=top i] {
  54691. vertical-align: top;
  54692. }
  54693. thead[valign=middle i], tbody[valign=middle i], tfoot[valign=middle i],
  54694. tr[valign=middle i], td[valign=middle i], th[valign=middle i] {
  54695. vertical-align: middle;
  54696. }
  54697. thead[valign=bottom i], tbody[valign=bottom i], tfoot[valign=bottom i],
  54698. tr[valign=bottom i], td[valign=bottom i], th[valign=bottom i] {
  54699. vertical-align: bottom;
  54700. }
  54701. thead[valign=baseline i], tbody[valign=baseline i], tfoot[valign=baseline i],
  54702. tr[valign=baseline i], td[valign=baseline i], th[valign=baseline i] {
  54703. vertical-align: baseline;
  54704. }
  54705. td[nowrap], th[nowrap] { white-space: nowrap; }
  54706. table[rules=none i], table[rules=groups i], table[rules=rows i],
  54707. table[rules=cols i], table[rules=all i] {
  54708. border-style: hidden;
  54709. border-collapse: collapse;
  54710. }
  54711. 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> */
  54712. table[frame=void i] { border-style: hidden; }
  54713. table[frame=above i] { border-style: outset hidden hidden hidden; }
  54714. table[frame=below i] { border-style: hidden hidden outset hidden; }
  54715. table[frame=hsides i] { border-style: outset hidden outset hidden; }
  54716. table[frame=lhs i] { border-style: hidden hidden hidden outset; }
  54717. table[frame=rhs i] { border-style: hidden outset hidden hidden; }
  54718. table[frame=vsides i] { border-style: hidden outset; }
  54719. table[frame=box i], table[frame=border i] { border-style: outset; }
  54720. table[border] > tr > td, table[border] > tr > th,
  54721. table[border] > thead > tr > td, table[border] > thead > tr > th,
  54722. table[border] > tbody > tr > td, table[border] > tbody > tr > th,
  54723. table[border] > tfoot > tr > td, table[border] > tfoot > tr > th {
  54724. /* <a href=#magic-border-selector id=tables-2:magic-border-selector-2>only if border is not equivalent to zero</a> */
  54725. border-width: 1px;
  54726. border-style: inset;
  54727. }
  54728. table[rules=none i] > tr > td, table[rules=none i] > tr > th,
  54729. table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
  54730. table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
  54731. table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
  54732. table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
  54733. table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
  54734. table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
  54735. table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
  54736. table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
  54737. table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
  54738. table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
  54739. table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th {
  54740. border-width: 1px;
  54741. border-style: none;
  54742. }
  54743. table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
  54744. table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
  54745. table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
  54746. table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th {
  54747. border-width: 1px;
  54748. border-style: none solid;
  54749. }
  54750. table[rules=all i] > tr > td, table[rules=all i] > tr > th,
  54751. table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
  54752. table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
  54753. table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
  54754. border-width: 1px;
  54755. border-style: solid;
  54756. }
  54757. table[rules=groups i] > colgroup {
  54758. border-left-width: 1px;
  54759. border-left-style: solid;
  54760. border-right-width: 1px;
  54761. border-right-style: solid;
  54762. }
  54763. table[rules=groups i] > thead,
  54764. table[rules=groups i] > tbody,
  54765. table[rules=groups i] > tfoot {
  54766. border-top-width: 1px;
  54767. border-top-style: solid;
  54768. border-bottom-width: 1px;
  54769. border-bottom-style: solid;
  54770. }
  54771. table[rules=rows i] > tr, table[rules=rows i] > thead > tr,
  54772. table[rules=rows i] > tbody > tr, table[rules=rows i] > tfoot > tr {
  54773. border-top-width: 1px;
  54774. border-top-style: solid;
  54775. border-bottom-width: 1px;
  54776. border-bottom-style: solid;
  54777. }</pre>
  54778. <p>In <a href=#quirks-mode id=tables-2:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
  54779. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54780. table {
  54781. font-weight: initial;
  54782. font-style: initial;
  54783. font-variant: initial;
  54784. font-size: initial;
  54785. line-height: initial;
  54786. white-space: initial;
  54787. text-align: initial;
  54788. }</pre>
  54789. <hr>
  54790. <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
  54791. 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>
  54792. <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
  54793. <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
  54794. <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>
  54795. <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
  54796. <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>
  54797. 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
  54798. <i>special knowledge</i> regarding cells spanning rows and columns.</p>
  54799. <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
  54800. <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>,
  54801. <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',
  54802. irrespective of CSS rules.</p>
  54803. <hr>
  54804. <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>
  54805. 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>
  54806. <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>
  54807. attribute <a href=#maps-to-the-pixel-length-property id=tables-2:maps-to-the-pixel-length-property-2>maps to the pixel length
  54808. properties</a> 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left' of any
  54809. <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
  54810. the <code id=tables-2:the-table-element-4><a href=#the-table-element>table</a></code> element.</p>
  54811. <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
  54812. 'margin-right' on the <code id=tables-2:the-table-element-6><a href=#the-table-element>table</a></code> element.</p>
  54813. <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
  54814. 'margin-bottom' on the <code id=tables-2:the-table-element-8><a href=#the-table-element>table</a></code> element.</p>
  54815. <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
  54816. <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>
  54817. <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
  54818. <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>
  54819. <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
  54820. 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>
  54821. <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
  54822. 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>
  54823. <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>
  54824. attributes <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-7>map to the dimension property</a>
  54825. 'height' on the element.</p>
  54826. <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>
  54827. attributes <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-8>map to the dimension property</a>
  54828. 'width' on the element.</p>
  54829. <hr>
  54830. <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>,
  54831. <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>
  54832. 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
  54833. case-insensitive</a> match for either the string "<code>center</code>" or the string
  54834. "<code>middle</code>", are expected to center text within themselves, as if they had
  54835. 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>
  54836. <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>,
  54837. <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
  54838. the string "<code>left</code>", are expected to left-align text within themselves, as if
  54839. 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>
  54840. <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>,
  54841. <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
  54842. the string "<code>right</code>", are expected to right-align text within themselves, as
  54843. 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>
  54844. <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>,
  54845. <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
  54846. the string "<code>justify</code>", are expected to full-justify text within themselves,
  54847. 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>
  54848. <p>User agents are expected to have a rule in their user agent stylesheet that matches
  54849. <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'
  54850. property is its initial value, whose declaration block consists of just a single declaration that
  54851. sets the 'text-align' property to the value 'center'.</p>
  54852. <hr>
  54853. <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>,
  54854. <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
  54855. expected to be <a href=#resolve-a-url id=tables-2:resolve-a-url>resolved</a> relative to the element, and if this is
  54856. 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
  54857. resulting <a href=#absolute-url id=tables-2:absolute-url>absolute URL</a>.</p>
  54858. <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>,
  54859. <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>
  54860. 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
  54861. colour value</a>, and if that does not return an error, the user agent is expected to treat the
  54862. attribute as a <a href=#presentational-hints id=tables-2:presentational-hints-7>presentational hint</a> setting the element's
  54863. 'background-color' property to the resulting colour.</p>
  54864. <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>
  54865. 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
  54866. value</a>, and if that does not return an error, the user agent is expected to treat the
  54867. attribute as a <a href=#presentational-hints id=tables-2:presentational-hints-8>presentational hint</a> setting the element's
  54868. 'border-top-color', 'border-right-color', 'border-bottom-color', and 'border-right-color'
  54869. properties to the resulting colour.</p>
  54870. <hr>
  54871. <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>
  54872. 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width' on the
  54873. 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
  54874. parsing non-negative integers</a> generates an error, a default value of 1px is expected to be
  54875. used for that property instead.</p>
  54876. <p>Rules marked "<dfn id=magic-border-selector>only if border is not equivalent to zero</dfn>"
  54877. 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
  54878. 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
  54879. also found to have a value other than zero or to generate an error.</p>
  54880. <hr>
  54881. <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
  54882. <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
  54883. parsing dimension values</a>, is found to be a length (not an error or a number classified as a
  54884. percentage), is expected to have a <a href=#presentational-hints id=tables-2:presentational-hints-9>presentational hint</a>
  54885. setting the element's 'white-space' property to 'normal', overriding the rule in the CSS block
  54886. above that sets it to 'nowrap'.</p>
  54887. <hr>
  54888. <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
  54889. activating the elements will cause the table to be sorted.</p>
  54890. <h4 id=margin-collapsing-quirks>14.3.10 Margin collapsing quirks</h4>
  54891. <p>A node is <dfn id=concept-rendering-substantial>substantial</dfn> if it is a text node
  54892. 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>
  54893. <p>A node is <dfn id=concept-rendering-blank>blank</dfn> if it is an element that contains no
  54894. <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial>substantial</a> nodes.</p>
  54895. <p>The <dfn id=concept-rendering-elements-with-margins>elements with default margins</dfn>
  54896. 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>,
  54897. <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>,
  54898. <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>,
  54899. <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>
  54900. <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
  54901. 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
  54902. <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>
  54903. previous siblings is expected to have a user-agent level style sheet rule that sets its
  54904. 'margin-top' property to zero.</p>
  54905. <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
  54906. 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
  54907. <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>
  54908. previous siblings, and is <a href=#concept-rendering-blank id=margin-collapsing-quirks:concept-rendering-blank>blank</a>, is expected to have
  54909. a user-agent level style sheet rule that sets its 'margin-bottom' property to zero also.</p>
  54910. <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
  54911. 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
  54912. 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
  54913. rule that sets its 'margin-top' property to zero.</p>
  54914. <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>
  54915. 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
  54916. user-agent level style sheet rule that sets its 'margin-bottom' property to zero.</p>
  54917. <h4 id=form-controls>14.3.11 Form controls</h4>
  54918. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54919. input, select, option, optgroup, button, textarea, keygen {
  54920. text-indent: initial;
  54921. }
  54922. textarea { white-space: pre-wrap; }
  54923. input[type="radio"], input[type="checkbox"], input[type="reset"], input[type="button"],
  54924. input[type="submit"], select, button {
  54925. box-sizing: border-box;
  54926. }</pre>
  54927. <p>In <a href=#quirks-mode id=form-controls:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
  54928. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54929. input:not([type=image]), textarea { box-sizing: border-box; }</pre>
  54930. <p>Each kind of form control is also given a specific default binding, as described in subsequent
  54931. sections, which implements the look and feel of the control.</p>
  54932. <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>
  54933. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54934. hr { color: gray; border-style: inset; border-width: 1px; margin: 0.5em auto; }</pre>
  54935. <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>
  54936. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54937. hr[align=left] { margin-left: 0; margin-right: auto; }
  54938. hr[align=right] { margin-left: auto; margin-right: 0; }
  54939. hr[align=center] { margin-left: auto; margin-right: auto; }
  54940. hr[color], hr[noshade] { border-style: solid; }</pre>
  54941. <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
  54942. 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
  54943. <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
  54944. agent is expected to use the parsed value divided by two as a pixel length for
  54945. <a href=#presentational-hints id=the-hr-element-2:presentational-hints-2>presentational hints</a> for the properties 'border-top-width', 'border-right-width',
  54946. 'border-bottom-width', and 'border-left-width' on the element.</p>
  54947. <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>
  54948. 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
  54949. <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
  54950. 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
  54951. 'border-bottom-width' to 0; otherwise, if the parsed value is greater than one, then the user
  54952. 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
  54953. hints</a> for the 'height' property on the element.</p>
  54954. <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
  54955. to the dimension property</a> 'width' on the element.</p>
  54956. <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
  54957. 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
  54958. 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
  54959. the resulting colour.</p>
  54960. <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>
  54961. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  54962. fieldset {
  54963. margin-left: 2px; margin-right: 2px;
  54964. border: groove 2px ThreeDFace;
  54965. padding: 0.35em 0.625em 0.75em;
  54966. min-width: min-content;
  54967. }
  54968. legend {
  54969. padding-left: 2px; padding-right: 2px;
  54970. }</pre>
  54971. <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>
  54972. <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,
  54973. 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>
  54974. <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>
  54975. <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
  54976. 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
  54977. (overriding any explicit 'display' value). In the absence of an explicit width, the box should
  54978. 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
  54979. case-insensitive</a> match for one of the strings in the first column of the following table,
  54980. 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
  54981. in the position given in the corresponding cell on the same row in the second column. If the
  54982. attribute is absent or has a value that doesn't match any of the cases in the table, then the
  54983. position is expected to be on the right if the 'direction' property on this element has a computed
  54984. value of 'rtl', and on the left otherwise.</p>
  54985. <table><thead><tr><th>Attribute value
  54986. <th>Alignment position
  54987. <tbody><tr><td><code>left</code>
  54988. <td>On the left
  54989. <tr><td><code>right</code>
  54990. <td>On the right
  54991. <tr><td><code>center</code>
  54992. <td>In the middle
  54993. </table>
  54994. <h3 id=replaced-elements>14.4 Replaced elements</h3>
  54995. <h4 id=embedded-content-rendering-rules>14.4.1 Embedded content</h4>
  54996. <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
  54997. treated as replaced elements.</p>
  54998. <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
  54999. expected to be treated as a replaced element; the contents of such elements are the element's
  55000. bitmap, if any, or else a transparent black bitmap with the same intrinsic dimensions as the
  55001. 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
  55002. rendering model.</p>
  55003. <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
  55004. 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>
  55005. elements are expected to be treated as ordinary elements in the rendering model.</p>
  55006. <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
  55007. 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
  55008. as ordinary elements in the rendering model.</p>
  55009. <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
  55010. line high, as wide as is necessary to expose the user agent's user interface features. When an
  55011. <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
  55012. user interface</a>, the user agent is expected to force its 'display' property to compute to
  55013. 'none', irrespective of CSS rules.</p>
  55014. <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;
  55015. controls are expected to be overlaid above the page content without causing any layout changes,
  55016. and are expected to disappear when the user does not need them.</p>
  55017. <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
  55018. or frame of video is expected to be rendered at the largest size that maintains the aspect ratio
  55019. 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>
  55020. 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>
  55021. <p>Any subtitles or captions are expected to be overlayed directly on top of their
  55022. <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
  55023. <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>
  55024. <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
  55025. 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
  55026. updating the text track rendering</a> of each of the <a href=#text-track id=embedded-content-rendering-rules:text-track>text
  55027. 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
  55028. 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
  55029. tracks</a>). <a href=#refsWEBVTT>[WEBVTT]</a></p>
  55030. <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
  55031. video playback or clear the canvas.</p>
  55032. <hr>
  55033. <p>The following CSS rules are expected to apply:</p>
  55034. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55035. iframe:not([seamless]) { border: 2px inset; }
  55036. iframe[seamless] { display: block; }
  55037. <span id=video-object-fit>video { object-fit: contain; }</span></pre>
  55038. <h4 id=images-2>14.4.2 Images</h4>
  55039. <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
  55040. 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
  55041. from the following list:</p>
  55042. <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
  55043. according to the rules for doing so defined in CSS.<dt>
  55044. If the element does not <a href=#represents id=images-2:represents-2>represent</a> an image, but the element
  55045. already has intrinsic dimensions (e.g. from the <a href=#dimension-attributes id=images-2:dimension-attributes>dimension attributes</a> or CSS rules),
  55046. and either:
  55047. <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
  55048. course, or
  55049. <li>the element has no <code>alt</code> attribute, or
  55050. <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>
  55051. </ul>
  55052. <dd>The user agent is expected to treat the element as a replaced element whose content is the
  55053. text that the element represents, if any, optionally alongside an icon indicating that the image
  55054. 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
  55055. 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
  55056. 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
  55057. content is the text, optionally with an icon indicating that an image is missing, so that the
  55058. user can request the image be displayed or investigate why it is not rendering. In non-graphical
  55059. 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
  55060. 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
  55061. 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
  55062. whose content is the element's alternative text. The intrinsic dimensions of the button are
  55063. expected to be about one line in height and whatever width is necessary to render the text on one
  55064. line.</dl>
  55065. <p>The icons mentioned above are expected to be relatively small so as not to disrupt most text
  55066. but be easily clickable. In a visual environment, for instance, icons could be 16 pixels by 16
  55067. pixels square, or 1em by 1em if the images are scalable. In an audio environment, the icon could
  55068. be a short bleep. The icons are intended to indicate to the user that they can be used to get to
  55069. whatever options the UA provides for images, and, where appropriate, are expected to provide
  55070. access to the context menu that would have come up if the user interacted with the actual
  55071. image.</p>
  55072. <hr>
  55073. <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
  55074. expected to be rendered synchronised to the same timeline as a group, with the timeline starting
  55075. at the time of the least recent addition to the group.</p>
  55076. <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
  55077. animated image data is inserted into a document, it jumps to the point in the animation cycle that
  55078. is currently being displayed by the first image.</p>
  55079. <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
  55080. 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
  55081. 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
  55082. their animation from the beginning.</p>
  55083. <hr>
  55084. <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
  55085. mode</a>:</p>
  55086. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55087. img[align=left i] { margin-right: 3px; }
  55088. img[align=right i] { margin-left: 3px; }</pre>
  55089. <h4 id=attributes-for-embedded-content-and-images>14.4.3 Attributes for embedded content and images</h4>
  55090. <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>
  55091. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55092. iframe[frameborder=0], iframe[frameborder=no i] { border: none; }
  55093. applet[align=left i], embed[align=left i], iframe[align=left i],
  55094. img[align=left i], input[type=image i][align=left i], object[align=left i] {
  55095. float: left;
  55096. }
  55097. applet[align=right i], embed[align=right i], iframe[align=right i],
  55098. img[align=right i], input[type=image i][align=right i], object[align=right i] {
  55099. float: right;
  55100. }
  55101. applet[align=top i], embed[align=top i], iframe[align=top i],
  55102. img[align=top i], input[type=image i][align=top i], object[align=top i] {
  55103. vertical-align: top;
  55104. }
  55105. applet[align=baseline i], embed[align=baseline i], iframe[align=baseline i],
  55106. img[align=baseline i], input[type=image i][align=baseline i], object[align=baseline i] {
  55107. vertical-align: baseline;
  55108. }
  55109. applet[align=texttop i], embed[align=texttop i], iframe[align=texttop i],
  55110. img[align=texttop i], input[type=image i][align=texttop i], object[align=texttop i] {
  55111. vertical-align: text-top;
  55112. }
  55113. applet[align=absmiddle i], embed[align=absmiddle i], iframe[align=absmiddle i],
  55114. img[align=absmiddle i], input[type=image i][align=absmiddle i], object[align=absmiddle i],
  55115. applet[align=abscenter i], embed[align=abscenter i], iframe[align=abscenter i],
  55116. img[align=abscenter i], input[type=image i][align=abscenter i], object[align=abscenter i] {
  55117. vertical-align: middle;
  55118. }
  55119. applet[align=bottom i], embed[align=bottom i], iframe[align=bottom i],
  55120. img[align=bottom i], input[type=image i][align=bottom i],
  55121. object[align=bottom i] {
  55122. vertical-align: bottom;
  55123. }</pre>
  55124. <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
  55125. <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>
  55126. 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
  55127. to act as if the element's 'vertical-align' property was set to a value that aligns the vertical
  55128. middle of the element with the parent element's baseline.</p>
  55129. <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>,
  55130. <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>
  55131. 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
  55132. element.</p>
  55133. <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>,
  55134. <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>
  55135. 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
  55136. element.</p>
  55137. <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
  55138. 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
  55139. parsing non-negative integers</a>, is found to be a number greater than zero, the user agent is
  55140. 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
  55141. parsed value as a pixel length for the element's 'border-top-width', 'border-right-width',
  55142. 'border-bottom-width', and 'border-left-width' properties, and four setting the element's
  55143. 'border-top-style', 'border-right-style', 'border-bottom-style', and 'border-left-style'
  55144. properties to the value 'solid'.</p>
  55145. <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>,
  55146. <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
  55147. <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
  55148. <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
  55149. 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
  55150. respectively.</p>
  55151. <h4 id=image-maps-2>14.4.4 Image maps</h4>
  55152. <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
  55153. 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
  55154. 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>
  55155. <p>For the purposes of the rendering, only the 'cursor' property is expected to have any effect on
  55156. the shape.</p>
  55157. <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
  55158. user designates that shape, the cursor would change to a Help cursor.</p>
  55159. <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'
  55160. property to 'inherit' (or if no rule setting the 'cursor' property matched the element at all),
  55161. 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
  55162. 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>
  55163. <h3 id=bindings>14.5 Bindings</h3>
  55164. <h4 id=introduction-18>14.5.1 Introduction</h4>
  55165. <p>A number of elements have their rendering defined in terms of the 'binding' property. <a href=#refsBECSS>[BECSS]</a></p>
  55166. <p>The CSS snippets below set the 'binding' property to a user-agent-defined value, represented
  55167. below by keywords like <code><i>button</i></code>. The rules then described for
  55168. these bindings are only expected to apply if the element's 'binding' property has not been
  55169. overridden (e.g. by the author) to have another value.</p>
  55170. <p>Exactly how the bindings are implemented is not specified by this specification. User agents
  55171. are encouraged to make their bindings set the 'appearance' CSS property appropriately to achieve
  55172. platform-native appearances for widgets, and are expected to implement any relevant animations,
  55173. etc, that are appropriate for the platform. <a href=#refsCSSUI>[CSSUI]</a></p>
  55174. <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>
  55175. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55176. button { binding: <i>button</i>; }</pre>
  55177. <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
  55178. is expected to render as an 'inline-block' box rendered as a button whose contents are the
  55179. contents of the element.</p>
  55180. <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
  55181. 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
  55182. indicate that activating the element will display a menu, e.g. by displaying a down-pointing
  55183. triangle after the button's label.</p>
  55184. <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>
  55185. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55186. details { binding: <i>details</i>; }</pre>
  55187. <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
  55188. is expected to render as a 'block' box with its 'padding-left' property set to '40px' for
  55189. 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
  55190. '40px' for right-to-left elements. The element's shadow tree is expected to take the element's
  55191. 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,
  55192. and then take the element's remaining descendants, if any, and place them in a second 'block' box
  55193. container.</p>
  55194. <p>The first container is expected to contain at least one line box, and that line box is expected
  55195. to contain a disclosure widget (typically a triangle), horizontally positioned within the left
  55196. 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
  55197. that the details be shown or hidden.</p>
  55198. <p>The second container is expected to have its 'overflow' property set to 'hidden'. When the
  55199. <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>
  55200. attribute, this second container is expected to be removed from the rendering.</p>
  55201. <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>
  55202. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55203. input { binding: <i>input-textfield</i>; }
  55204. input[type=password i] { binding: <i>input-password</i>; }
  55205. /* later rules override this for other values of type="" */</pre>
  55206. <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
  55207. <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>,
  55208. <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>,
  55209. 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
  55210. an 'inline-block' box rendered as a text field.</p>
  55211. <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
  55212. <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
  55213. 'inline-block' box rendered as a text field whose contents are obscured.</p>
  55214. <p>If these text fields provide a text selection, then, when the user changes the currect
  55215. 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
  55216. 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,
  55217. 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>
  55218. <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
  55219. 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
  55220. 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
  55221. 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,
  55222. 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>
  55223. algorithm to the value of the attribute.</p>
  55224. <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
  55225. 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>
  55226. attribute, then the user agent is expected to act as if it had a user-agent-level style sheet rule
  55227. setting the 'width' property on the element to the value obtained from applying the
  55228. <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>
  55229. <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>,
  55230. where <var>size</var> is the character width to convert, <var>avg</var> is the
  55231. average character width of the primary font for the element for which the algorithm is being run,
  55232. in pixels, and <var>max</var> is the maximum character width of that same font, also in
  55233. pixels. (The element's 'letter-spacing' property does not affect the result.)</p>
  55234. <p>When the <i>input-textfield</i> binding applies to an element, the 'line-height'
  55235. property, if it has a computed value equivalent to a value that is less than 1.0, must have a used
  55236. value of 1.0.</p>
  55237. <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>
  55238. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55239. input[type=datetime i] { binding: <i>input-datetime</i>; }
  55240. input[type=date i] { binding: <i>input-date</i>; }
  55241. input[type=month i] { binding: <i>input-month</i>; }
  55242. input[type=week i] { binding: <i>input-week</i>; }
  55243. input[type=time i] { binding: <i>input-time</i>; }
  55244. input[type=datetime-local i] { binding: <i>input-datetime-local</i>; }
  55245. input[type=number i] { binding: <i>input-number</i>; }</pre>
  55246. <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
  55247. <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
  55248. an 'inline-block' box depicting a Date and Time control.</p>
  55249. <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
  55250. <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
  55251. 'inline-block' box depicting a Date control.</p>
  55252. <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
  55253. <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
  55254. 'inline-block' box depicting a Month control.</p>
  55255. <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
  55256. <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
  55257. 'inline-block' box depicting a Week control.</p>
  55258. <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
  55259. <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
  55260. 'inline-block' box depicting a Time control.</p>
  55261. <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
  55262. 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
  55263. to render as an 'inline-block' box depicting a Local Date and Time control.</p>
  55264. <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
  55265. <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
  55266. 'inline-block' box depicting a Number control.</p>
  55267. <p>These controls are all expected to be about one line high, and about as wide as necessary to
  55268. show the widest possible value.</p>
  55269. <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>
  55270. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55271. input[type=range i] { binding: <i>input-range</i>; }</pre>
  55272. <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
  55273. <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
  55274. 'inline-block' box depicting a slider control.</p>
  55275. <p>When the control is wider than it is tall (or square), the control is expected to be a
  55276. horizontal slider, with the lowest value on the right if the 'direction' property on this element
  55277. has a computed value of 'rtl', and on the left otherwise. When the control is taller than it is
  55278. wide, it is expected to be a vertical slider, with the lowest value on the bottom.</p>
  55279. <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>
  55280. attribute) are expected to be shown as tick marks on the slider, which the slider can snap to.</p>
  55281. <p>User agents are expected to use the used value of the 'direction' property on the element to
  55282. determine the direction in which the slider operates. Typically, a left-to-right ('ltr')
  55283. horizontal control would have the lowest value on the left and the highest value on the right, and
  55284. vice versa.</p>
  55285. <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>
  55286. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55287. input[type=color i] { binding: <i>input-color</i>; }</pre>
  55288. <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
  55289. <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
  55290. 'inline-block' box depicting a colour well, which, when activated, provides the user with a colour
  55291. picker (e.g. a colour wheel or colour palette) from which the colour can be changed.</p>
  55292. <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>
  55293. attribute) are expected to be shown in the colour picker interface, not on the colour well
  55294. itself.</p>
  55295. <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>
  55296. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55297. input[type=checkbox i] { binding: <i>input-checkbox</i>; }
  55298. input[type=radio i] { binding: <i>input-radio</i>; }</pre>
  55299. <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
  55300. <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
  55301. 'inline-block' box containing a single checkbox control, with no label.</p>
  55302. <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
  55303. <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
  55304. 'inline-block' box containing a single radio button control, with no label.</p>
  55305. <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>
  55306. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55307. input[type=file i] { binding: <i>input-file</i>; }</pre>
  55308. <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
  55309. <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
  55310. '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,
  55311. when activated, provides the user with a file picker from which the selection can be changed.</p>
  55312. <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>
  55313. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55314. input[type=submit i], input[type=reset i], input[type=button i] {
  55315. binding: <i>input-button</i>;
  55316. }</pre>
  55317. <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
  55318. <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
  55319. 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
  55320. expected to render as an 'inline-block' box rendered as a button, about one line high, containing
  55321. 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
  55322. 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
  55323. user-agent-defined (and probably locale-specific) fashion, if not.</p>
  55324. <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>
  55325. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55326. marquee { binding: <i>marquee</i>; }</pre>
  55327. <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
  55328. element is <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on>turned on</a>, the element is expected to render in
  55329. an animated fashion according to its attributes as follows:</p>
  55330. <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
  55331. <a href=#attr-marquee-behavior-scroll id=the-marquee-element:attr-marquee-behavior-scroll>scroll</a> state<dd>
  55332. <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
  55333. 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>
  55334. <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-2><a href=#attr-marquee-direction>direction</a></code>
  55335. attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left>left</a> (the default), then the
  55336. contents would start such that their left edge are off the side of the right edge of the
  55337. <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
  55338. 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
  55339. content area.</p>
  55340. <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
  55341. current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-2>turned
  55342. on</a> after this, then the user agent is expected to restart the animation.</p>
  55343. <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
  55344. <a href=#attr-marquee-behavior-slide id=the-marquee-element:attr-marquee-behavior-slide>slide</a> state<dd>
  55345. <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
  55346. 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
  55347. <code id=the-marquee-element:the-marquee-element-2-7><a href=#the-marquee-element-2>marquee</a></code>.</p>
  55348. <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-4><a href=#attr-marquee-direction>direction</a></code>
  55349. attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-2>left</a> (the default), then the
  55350. contents would start such that their left edge are off the side of the right edge of the
  55351. <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
  55352. <em>right</em> edge of the contents are flush with the left inner edge of the
  55353. <code id=the-marquee-element:the-marquee-element-2-9><a href=#the-marquee-element-2>marquee</a></code>'s content area.</p>
  55354. <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
  55355. current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-3>turned
  55356. on</a> after this, then the user agent is expected to restart the animation.</p>
  55357. <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
  55358. <a href=#attr-marquee-behavior-alternate id=the-marquee-element:attr-marquee-behavior-alternate>alternate</a> state<dd>
  55359. <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
  55360. element in the direction described by the <code id=the-marquee-element:attr-marquee-direction-5><a href=#attr-marquee-direction>direction</a></code>
  55361. attribute as defined below, such that it begins flush with the start side of the
  55362. <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>
  55363. <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
  55364. 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
  55365. 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
  55366. <code id=the-marquee-element:the-marquee-element-2-13><a href=#the-marquee-element-2>marquee</a></code>.</p>
  55367. <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-7><a href=#attr-marquee-direction>direction</a></code>
  55368. attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-3>left</a> (the default), then the
  55369. contents would with their right edge flush with the right inner edge of the
  55370. <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
  55371. <em>left</em> edge of the contents are flush with the left inner edge of the
  55372. <code id=the-marquee-element:the-marquee-element-2-15><a href=#the-marquee-element-2>marquee</a></code>'s content area.</p>
  55373. <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
  55374. current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-4>turned
  55375. on</a> after this, then the user agent is expected to continue the animation.</p>
  55376. </dl>
  55377. <p>The <code id=the-marquee-element:attr-marquee-direction-8><a href=#attr-marquee-direction>direction</a></code> attribute has the meanings described
  55378. in the following table:</p>
  55379. <table><thead><tr><th><code id=the-marquee-element:attr-marquee-direction-9><a href=#attr-marquee-direction>direction</a></code> attribute state
  55380. <th>Direction of animation
  55381. <th>Start edge
  55382. <th>End edge
  55383. <th>Opposite direction
  55384. <tbody><tr><td><a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-4>left</a>
  55385. <td>← Right to left
  55386. <td>Right
  55387. <td>Left
  55388. <td>→ Left to Right
  55389. <tr><td><a href=#attr-marquee-direction-right id=the-marquee-element:attr-marquee-direction-right>right</a>
  55390. <td>→ Left to Right
  55391. <td>Left
  55392. <td>Right
  55393. <td>← Right to left
  55394. <tr><td><a href=#attr-marquee-direction-up id=the-marquee-element:attr-marquee-direction-up>up</a>
  55395. <td>↑ Up (Bottom to Top)
  55396. <td>Bottom
  55397. <td>Top
  55398. <td>↓ Down (Top to Bottom)
  55399. <tr><td><a href=#attr-marquee-direction-down id=the-marquee-element:attr-marquee-direction-down>down</a>
  55400. <td>↓ Down (Top to Bottom)
  55401. <td>Top
  55402. <td>Bottom
  55403. <td>↑ Up (Bottom to Top)
  55404. </table>
  55405. <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
  55406. scroll interval</a> between each frame, and such that the content moves at most the distance
  55407. given by the <a href=#marquee-scroll-distance id=the-marquee-element:marquee-scroll-distance>marquee scroll distance</a> with each frame.</p>
  55408. <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>
  55409. 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
  55410. value</a>, and if that does not return an error, the user agent is expected to treat the
  55411. attribute as a <a href=#presentational-hints id=the-marquee-element:presentational-hints>presentational hint</a> setting the element's
  55412. 'background-color' property to the resulting colour.</p>
  55413. <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'
  55414. on the element respectively.</p>
  55415. <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>
  55416. <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
  55417. <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'
  55418. and 'margin-bottom' on the element. The <code>hspace</code> attribute
  55419. 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
  55420. dimension properties</a> 'margin-left' and 'margin-right' on the element.</p>
  55421. <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
  55422. is expected to always be hidden.</p>
  55423. <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>
  55424. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55425. meter { binding: <i>meter</i>; }</pre>
  55426. <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
  55427. expected to render as an 'inline-block' box with a 'height' of '1em' and a 'width' of '5em', a
  55428. 'vertical-align' of '-0.2em', and with its contents depicting a gauge.</p>
  55429. <p>When the element is wider than it is tall (or square), the depiction is expected to be of a
  55430. horizontal gauge, with the minimum value on the right if the 'direction' property on this element
  55431. has a computed value of 'rtl', and on the left otherwise. When the element is taller than it is
  55432. wide, it is expected to depict a vertical gauge, with the minimum value on the bottom.</p>
  55433. <p>User agents are expected to use a presentation consistent with platform conventions for gauges,
  55434. if any.</p>
  55435. <p class=note>Requirements for what must be depicted in the gauge are included in the definition
  55436. of the <code id=the-meter-element-2:the-meter-element-3><a href=#the-meter-element>meter</a></code> element.</p>
  55437. <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>
  55438. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55439. progress { binding: <i>progress</i>; }</pre>
  55440. <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
  55441. element is expected to render as an 'inline-block' box with a 'height' of '1em' and a 'width' of
  55442. '10em', and a 'vertical-align' of '-0.2em'.</p>
  55443. <p> <img class=extra width=157 src=http://images.whatwg.org/sample-progress.png height=103 alt=""> When the
  55444. element is wider than it is tall, the element is expected to be depicted as a horizontal progress
  55445. bar, with the start on the right and the end on the left if the 'direction' property on this
  55446. element has a computed value of 'rtl', and with the start on the left and the end on the right
  55447. otherwise. When the element is taller than it is wide, it is expected to depicted as a vertical
  55448. progress bar, with the lowest value on the bottom. When the element is square, it is expected to
  55449. be depicted as a direction-independent progress widget (e.g. a circular progress ring).</p>
  55450. <p>User agents are expected to use a presentation consistent with platform conventions for
  55451. progress bars. In particular, user agents are expected to use different presentations for
  55452. determinate and indeterminate progress bars. User agents are also expected to vary the
  55453. presentation based on the dimensions of the element.</p>
  55454. <p class=example>For example, on some platforms for showing indeterminate progress there is an
  55455. asynchronous progress indicator with square dimensions, which could be used when the element is
  55456. square, and an indeterminate progress bar, which could be used when the element is wide.</p>
  55457. <p class=note>Requirements for how to determine if the progress bar is determinate or
  55458. indeterminate, and what progress a determinate progress bar is to show, are included in the
  55459. definition of the <code id=the-progress-element-2:the-progress-element-3><a href=#the-progress-element>progress</a></code> element.</p>
  55460. <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>
  55461. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55462. select { binding: <i>select</i>; }</pre>
  55463. <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
  55464. render as a multi-select list box.</p>
  55465. <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
  55466. render as a single-select list box.</p>
  55467. <p>When the element renders as a list box, it is expected to render as an 'inline-block' box whose
  55468. '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
  55469. 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
  55470. scrollbar.</p>
  55471. <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
  55472. 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
  55473. labels</a>.</p>
  55474. <p>In either case (list box or drop-down box), the element's items are expected to be the
  55475. 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
  55476. <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
  55477. applicable.</p>
  55478. <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>
  55479. <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
  55480. has one.</p>
  55481. <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
  55482. 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
  55483. <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
  55484. options</a> (including its indent, if any).</p>
  55485. <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
  55486. 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,
  55487. 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
  55488. 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
  55489. option</a>'s <a href=#concept-option-selectedness id=the-select-element-2:concept-option-selectedness>selectedness</a> is true, the control
  55490. is expected to be displayed in a fashion that indicates that no valid option is currently
  55491. selected.</p>
  55492. <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
  55493. any alignment remains consistent whether the label is being displayed as part of the page or in a
  55494. menu control.</p>
  55495. <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>
  55496. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55497. textarea { binding: <i>textarea</i>; white-space: pre-wrap; }</pre>
  55498. <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
  55499. element is expected to render as an 'inline-block' box rendered as a multiline text field. If this
  55500. text field provides a selection, then, when the user changes the currect selection in such a
  55501. 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
  55502. event</a> that bubbles named <code id=the-textarea-element-2:event-select><a href=#event-select>select</a></code> at the element, using
  55503. 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>
  55504. <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
  55505. 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
  55506. 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
  55507. 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
  55508. expected to act as if it had a user-agent-level style sheet rule setting the 'width' property on
  55509. the element to the <a href=#textarea-effective-width id=the-textarea-element-2:textarea-effective-width-2>textarea effective width</a>.</p>
  55510. <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
  55511. character width of the primary font of the element, in CSS pixels, and <var>sbw</var> is
  55512. the width of a scroll bar, in CSS pixels. (The element's 'letter-spacing' property does not affect
  55513. the result.)</p>
  55514. <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
  55515. 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
  55516. 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
  55517. 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
  55518. expected to act as if it had a user-agent-level style sheet rule setting the 'height' property on
  55519. the element to the <a href=#textarea-effective-height id=the-textarea-element-2:textarea-effective-height-2>textarea effective height</a>.</p>
  55520. <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
  55521. 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
  55522. pixels.</p>
  55523. <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>
  55524. 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
  55525. 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'
  55526. property to 'pre'.</p>
  55527. <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>
  55528. <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
  55529. keygen { binding: <i>keygen</i>; }</pre>
  55530. <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
  55531. is expected to render as an 'inline-block' box containing a user interface to configure the key
  55532. pair to be generated.</p>
  55533. <h3 id=frames-and-framesets>14.6 Frames and framesets</h3>
  55534. <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
  55535. width of the viewport, with a surface rendered according to the following layout algorithm:</p>
  55536. <ol><li>
  55537. <p>The <var>cols</var> and <var>rows</var> variables are lists of zero or more pairs consisting
  55538. of a number and a unit, the unit being one of <i>percentage</i>, <i>relative</i>, and
  55539. <i>absolute</i>.</p>
  55540. <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
  55541. element's <code>cols</code> attribute, if there is one.
  55542. Let <var>cols</var> be the result, or an empty list if there is no such attribute.</p>
  55543. <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
  55544. element's <code>rows</code> attribute, if there is one.
  55545. Let <var>rows</var> be the result, or an empty list if there is no such attribute.</p>
  55546. <li>
  55547. <p>For any of the entries in <var>cols</var> or <var>rows</var> that have the number zero and
  55548. the unit <i>relative</i>, change the entry's number to one.</p>
  55549. <li>
  55550. <p>If <var>cols</var> has no entries, then add a single entry consisting of the value 1 and the
  55551. unit <i>relative</i> to <var>cols</var>.</p>
  55552. <p>If <var>rows</var> has no entries, then add a single entry consisting of the value 1 and the
  55553. unit <i>relative</i> to <var>rows</var>.</p>
  55554. <li>
  55555. <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
  55556. values</a> using <var>cols</var> as the input list, and the width of the surface that the
  55557. <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
  55558. <var>sized cols</var> be the resulting list.</p>
  55559. <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
  55560. values</a> using <var>rows</var> as the input list, and the height of the surface that the
  55561. <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
  55562. <var>sized rows</var> be the resulting list.</p>
  55563. <li>
  55564. <p>Split the surface into a grid of <span><var>w</var>×<var>h</var></span>
  55565. rectangles, where <var>w</var> is the number of entries in <var>sized cols</var> and
  55566. <var>h</var> is the number of entries in <var>sized rows</var>.</p>
  55567. <p>Size the columns so that each column in the grid is as many CSS pixels wide as the
  55568. corresponding entry in the <var>sized cols</var> list.</p>
  55569. <p>Size the rows so that each row in the grid is as many CSS pixels high as the corresponding
  55570. entry in the <var>sized rows</var> list.</p>
  55571. <li>
  55572. <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
  55573. 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>
  55574. <li>
  55575. <p>For each row of the grid of rectangles created in the previous step, from top to bottom, run
  55576. these substeps:</p>
  55577. <ol><li>
  55578. <p>For each rectangle in the row, from left to right, run these substeps:</p>
  55579. <ol><li>
  55580. <p>If there are any elements left in <var>children</var>, take the first element in the
  55581. list, and assign it to the rectangle.</p>
  55582. <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>
  55583. layout algorithm for that <code id=frames-and-framesets:frameset-8><a href=#frameset>frameset</a></code> element, with the rectangle as the
  55584. surface.</p>
  55585. <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
  55586. context</a>, positoned and sized to fit the rectangle.</p>
  55587. <li>
  55588. <p>If there are any elements left in <var>children</var>, remove the first element from
  55589. <var>children</var>.</p>
  55590. </ol>
  55591. </ol>
  55592. <li>
  55593. <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
  55594. around the rectangles, using the element's <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour>frame border colour</a>.</p>
  55595. <p>For each rectangle, if there is an element assigned to that rectangle, and that element
  55596. <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
  55597. element's <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour-2>frame border colour</a>.</p>
  55598. <p>For each (visible) border that does not abut a rectangle that is assigned a
  55599. <code id=frames-and-framesets:frame-3><a href=#frame>frame</a></code> element with a <code>noresize</code>
  55600. attribute (including rectangles in further nested <code id=frames-and-framesets:frameset-10><a href=#frameset>frameset</a></code> elements), the user
  55601. agent is expected to allow the user to move the border, resizing the rectangles within, keeping
  55602. the proportions of any nested <code id=frames-and-framesets:frameset-11><a href=#frameset>frameset</a></code> grids.</p>
  55603. <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
  55604. following algorithm returns true:</p>
  55605. <ol><li><p>If the element has a <code>frameborder</code> attribute whose value is not the
  55606. empty string and whose first character is either a U+0031 DIGIT ONE (1) character, a U+0079
  55607. LATIN SMALL LETTER Y character (y), or a U+0059 LATIN CAPITAL LETTER Y character (Y), then
  55608. return true.<li><p>Otherwise, if the element has a <code>frameborder</code> attribute, return
  55609. 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,
  55610. 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
  55611. not.<li><p>Otherwise, return true.</ol>
  55612. <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
  55613. is the colour obtained from the following algorithm:</p>
  55614. <ol><li><p>If the element has a <code>bordercolor</code> attribute, and applying the
  55615. <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
  55616. 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,
  55617. then return the <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour-3>frame border colour</a> of that element.</p>
  55618. <li><p>Otherwise, return gray.</ol>
  55619. </ol>
  55620. <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
  55621. the following steps:</p>
  55622. <ol><li>
  55623. <p>Let <var>input list</var> be the list of numbers and units passed to the algorithm.</p>
  55624. <p>Let <var>output list</var> be a list of numbers the same length as <var>input list</var>, all
  55625. zero.</p>
  55626. <p>Entries in <var>output list</var> correspond to the entries in <var>input list</var> that
  55627. have the same position.</p>
  55628. <li><p>Let <var>input dimension</var> be the size passed to the algorithm.</p>
  55629. <li>
  55630. <p>Let <var>count percentage</var> be the number of entries in <var>input list</var> whose unit
  55631. is <i>percentage</i>.</p>
  55632. <p>Let <var>total percentage</var> be the sum of all the numbers in <var>input list</var> whose
  55633. unit is <i>percentage</i>.</p>
  55634. <p>Let <var>count relative</var> be the number of entries in <var>input list</var> whose unit is
  55635. <i>relative</i>.</p>
  55636. <p>Let <var>total relative</var> be the sum of all the numbers in <var>input list</var> whose
  55637. unit is <i>relative</i>.</p>
  55638. <p>Let <var>count absolute</var> be the number of entries in <var>input list</var> whose unit is
  55639. <i>absolute</i>.</p>
  55640. <p>Let <var>total absolute</var> be the sum of all the numbers in <var>input list</var> whose
  55641. unit is <i>absolute</i>.</p>
  55642. <p>Let <var>remaining space</var> be the value of <var>input dimension</var>.</p>
  55643. <li>
  55644. <p>If <var>total absolute</var> is greater than <var>remaining space</var>, then for each entry
  55645. in <var>input list</var> whose unit is <i>absolute</i>, set the corresponding value in
  55646. <var>output list</var> to the number of the entry in <var>input list</var> multiplied by
  55647. <var>remaining space</var> and divided by <var>total absolute</var>. Then, set <var>remaining
  55648. space</var> to zero.</p>
  55649. <p>Otherwise, for each entry in <var>input list</var> whose unit is <i>absolute</i>, set the
  55650. corresponding value in <var>output list</var> to the number of the entry in <var>input
  55651. list</var>. Then, decrement <var>remaining space</var> by <var>total absolute</var>.</p>
  55652. <li>
  55653. <p>If <var>total percentage</var> multiplied by the <var>input dimension</var> and divided by
  55654. 100 is greater than <var>remaining space</var>, then for each entry in <var>input list</var>
  55655. whose unit is <i>percentage</i>, set the corresponding value in <var>output list</var> to the
  55656. number of the entry in <var>input list</var> multiplied by <var>remaining space</var> and
  55657. divided by <var>total percentage</var>. Then, set <var>remaining space</var> to zero.</p>
  55658. <p>Otherwise, for each entry in <var>input list</var> whose unit is <i>percentage</i>, set the
  55659. corresponding value in <var>output list</var> to the number of the entry in <var>input
  55660. list</var> multiplied by the <var>input dimension</var> and divided by 100. Then, decrement
  55661. <var>remaining space</var> by <var>total percentage</var> multiplied by the <var>input
  55662. dimension</var> and divided by 100.</p>
  55663. <li>
  55664. <p>For each entry in <var>input list</var> whose unit is <i>relative</i>, set the corresponding
  55665. value in <var>output list</var> to the number of the entry in <var>input list</var> multiplied
  55666. by <var>remaining space</var> and divided by <var>total relative</var>.</p>
  55667. <li><p>Return <var>output list</var>.</ol>
  55668. <p>User agents working with integer values for frame widths (as opposed to user agents that can
  55669. lay frames out with subpixel accuracy) are expected to distribute the remainder first to the last
  55670. entry whose unit is <i>relative</i>, then equally (not proportionally) to each entry whose unit is
  55671. <i>percentage</i>, then equally (not proportionally) to each entry whose unit is <i>absolute</i>,
  55672. and finally, failing all else, to the last entry.</p>
  55673. <hr>
  55674. <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
  55675. are expected to be rendered as transparent black; the user agent is expected to not render the
  55676. <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>
  55677. is expected to have a viewport with zero width and zero height.</p>
  55678. <h3 id=interactive-media>14.7 Interactive media</h3>
  55679. <h4 id=links,-forms,-and-navigation>14.7.1 Links, forms, and navigation</h4>
  55680. <p>User agents are expected to allow the user to control aspects of <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink>hyperlink</a>
  55681. 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
  55682. used for the subsequent <a href=#navigate id=links,-forms,-and-navigation:navigate>navigation</a>.</p>
  55683. <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
  55684. <a href=#navigate id=links,-forms,-and-navigation:navigate-2>navigation</a>.</p>
  55685. <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
  55686. <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
  55687. as part of such auditing.</p>
  55688. <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
  55689. 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>,
  55690. <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>
  55691. <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>
  55692. elements in their user interface.</p>
  55693. <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
  55694. react to clicks if visible, and so forth, this does not extend to any browser interface constructs
  55695. that expose those same links. Activating a link through the browser's interface, rather than in
  55696. 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>
  55697. <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>
  55698. <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
  55699. request, and to make the user aware of the presence of such information.</p>
  55700. <p>On interactive graphical systems where the user can use a pointing device, this could take the
  55701. form of a tooltip. When the user is unable to use a pointing device, then the user agent is
  55702. expected to make the content available in some other fashion, e.g. by making the element a
  55703. <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
  55704. <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
  55705. under the user's finger on a touch device as the user pans around the screen.</p>
  55706. <p>U+000A LINE FEED (LF) characters are expected to cause line breaks in the tooltip; U+0009
  55707. CHARACTER TABULATION (tab) characters are expected to render as a non-zero horizontal shift that
  55708. lines up the next glyph with the next tab stop, with tab stops occurring at points that are
  55709. multiples of 8 times the width of a U+0020 SPACE character.</p>
  55710. <div class=example>
  55711. <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
  55712. <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
  55713. element has focus. This would allow a user to tab around the document to find all the advisory
  55714. text.</p>
  55715. </div>
  55716. <div class=example>
  55717. <p>As another example, a screen reader could provide an audio cue when reading an element with a
  55718. tooltip, with an associated key to read the last tooltip for which a cue was played.</p>
  55719. </div>
  55720. <h4 id=editing-hosts>14.7.3 Editing hosts</h4>
  55721. <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
  55722. <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
  55723. vertical dimensions of the caret and with zero width for the purposes of the CSS rendering
  55724. model.</p>
  55725. <p class=note>This means that even an empty block can have the caret inside it, and that when
  55726. the caret is in such an element, it prevents margins from collapsing through the element.</p>
  55727. <h4 id=text-rendered-in-native-user-interfaces>14.7.4 Text rendered in native user interfaces</h4>
  55728. <p>User agents are expected to honor the Unicode semantics of text that is exposed in user
  55729. interfaces, for example supporting the bidirectional algorithm in text shown in dialogs, title
  55730. bars, pop-up menus, and tooltips. Text from the contents of elements is expected to be rendered in
  55731. 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
  55732. obtained. Text from attributes is expected to be rendered in a manner that honours the
  55733. <a href=#directionality-of-the-attribute id=text-rendered-in-native-user-interfaces:directionality-of-the-attribute>directionality of the attribute</a>.</p>
  55734. <div class=example>
  55735. <p>Consider the following markup, which has Hebrew text asking for a programming language, the
  55736. languages being text for which a left-to-right direction is important given the punctuation in
  55737. some of their names:</p>
  55738. <pre>&lt;p dir="rtl" lang="he">
  55739. &lt;label>
  55740. <span dir=rtl lang=he>בחר שפת תכנות:</span>
  55741. &lt;select>
  55742. &lt;option dir="ltr">C++&lt;/option>
  55743. &lt;option dir="ltr">C#&lt;/option>
  55744. &lt;option dir="ltr">FreePascal&lt;/option>
  55745. &lt;option dir="ltr">F#&lt;/option>
  55746. &lt;/select>
  55747. &lt;/label>
  55748. &lt;/p></pre>
  55749. <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
  55750. ensure that the punctuation was the same both in the drop down, and in the box showing the
  55751. current selection.</p>
  55752. <p><img src=http://images.whatwg.org/bidiselect.png width=206 alt="" height=105></p>
  55753. </div>
  55754. <div class=example>
  55755. <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
  55756. markup:</p>
  55757. <pre><bdo dir=ltr>&lt;table>
  55758. &lt;tr>
  55759. &lt;th abbr="(א" dir=ltr>A
  55760. &lt;th abbr="(א" dir=rtl>A
  55761. &lt;th abbr="(א" dir=auto>A
  55762. &lt;/table></bdo></pre>
  55763. <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
  55764. other user interface, the first will have a left parenthesis (because the direction is 'ltr'),
  55765. the second will have a right parenthesis (because the direction is 'rtl'), and the third will
  55766. have a right parenthesis (because the direction is determined <em>from the attribute value</em>
  55767. to be 'rtl').</p>
  55768. <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
  55769. results would be different:</p>
  55770. <pre><bdo dir=ltr>&lt;table>
  55771. &lt;tr>
  55772. &lt;th data-abbr="(א" dir=ltr>A
  55773. &lt;th data-abbr="(א" dir=rtl>A
  55774. &lt;th data-abbr="(א" dir=auto>A
  55775. &lt;/table></bdo></pre>
  55776. <p>In this case, if the user agent were to expose the <code>data-abbr</code> attribute
  55777. in the user interface (e.g. in a debugging environment), the last case would be rendered with a
  55778. <em>left</em> parenthesis, because the direction would be determined from the element's
  55779. contents.</p>
  55780. </div>
  55781. <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
  55782. more bidirectional algorithm paragraphs when displayed, as defined by the bidirectional algorithm,
  55783. including, for instance, supporting the paragraph-breaking behaviour of U+000A LINE FEED (LF)
  55784. characters. For the purposes of determining the paragraph level of such text in the bidirectional
  55785. algorithm, this specification does <em>not</em> provide a higher-level override of rules P2 and
  55786. P3. <a href=#refsBIDI>[BIDI]</a></p>
  55787. <p>When necessary, authors can enforce a particular direction for a given paragraph by starting it
  55788. with the Unicode U+200E LEFT-TO-RIGHT MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>
  55789. <div class=example>
  55790. <p>Thus, the following script:</p>
  55791. <pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>
  55792. <p>...would always result in a message reading
  55793. "<bdo dir=rtl lang="">למד LMTH היום!</bdo>"
  55794. (not "<bdo dir=ltr lang="">דמל HTML םויה!</bdo>"),
  55795. regardless of the language of the user agent interface or the
  55796. direction of the page or any of its elements.</p>
  55797. </div>
  55798. <div class=example>
  55799. <p>For a more complex example, consider the following script:</p>
  55800. <pre class=bad>/* Warning: this script does not handle right-to-left scripts correctly */
  55801. var s;
  55802. if (s = prompt('What is your name?')) {
  55803. alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
  55804. }</pre>
  55805. <p>When the user enters "<kbd>Kitty</kbd>", the user agent would alert "<samp>Kitty! Ok, Fred,
  55806. Kitty, and Wilma will get the car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>لا أفهم</kbd>", then the bidirectional
  55807. algorithm will determine that the direction of the paragraph is right-to-left, and so the output
  55808. will be the following unintended mess: "<samp lang=""><bdo dir=rtl>لا أفهم! derF ,kO, لا أفهم, rac eht teg lliw amliW dna.</bdo></samp>"</p>
  55809. <p>To force an alert that starts with user-provided text (or other text of unknown
  55810. directionality) to render left-to-right, the string can be prefixed with a U+200E LEFT-TO-RIGHT
  55811. MARK character:</p>
  55812. <pre>var s;
  55813. if (s = prompt('What is your name?')) {
  55814. alert('<strong>\u200E</strong>' + s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
  55815. }</pre>
  55816. </div>
  55817. <h3 id=print-media>14.8 Print media</h3>
  55818. <p>User agents are expected to allow the user to request the opportunity to <dfn id=obtain-a-physical-form>obtain a physical
  55819. form</dfn> (or a representation of a physical form) of a <code id=print-media:document><a href=#document>Document</a></code>. For example,
  55820. selecting the option to print a page or convert it to PDF format. <a href=#refsPDF>[PDF]</a></p>
  55821. <p>When the user actually <a href=#obtain-a-physical-form id=print-media:obtain-a-physical-form>obtains a physical form</a> (or
  55822. 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
  55823. create a new rendering of the <code id=print-media:document-3><a href=#document>Document</a></code> for the print media.</p>
  55824. <h3 id=unstyled-xml-documents>14.9 Unstyled XML documents</h3>
  55825. <p>HTML user agents may, in certain circumstances, find themselves rendering non-HTML documents
  55826. that use vocabularies for which they lack any built-in knowledge. This section provides for a way
  55827. for user agents to handle such documents in a somewhat useful manner.</p>
  55828. <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
  55829. to render <a href=#an-unstyled-document-view id=unstyled-xml-documents:an-unstyled-document-view>an unstyled document view</a>.</p>
  55830. <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
  55831. conditions:</p>
  55832. <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).
  55833. <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>.
  55834. <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>.
  55835. <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>
  55836. <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.
  55837. <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).
  55838. <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>.
  55839. <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.
  55840. </ul>
  55841. <p><dfn id=an-unstyled-document-view>An unstyled document view</dfn> is one where the DOM is not rendered according to CSS
  55842. (which would, since there are no applicable styles in this context, just result in a wall of
  55843. text), but is instead rendered in a manner that is useful for a developer. This could consist of
  55844. 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
  55845. could consist of displaying just the DOM tree, or simply a message saying that the page is not a
  55846. styled document.</p>
  55847. <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
  55848. conditions above stop applying, and thus a user agent following these requirements will switch to
  55849. using the regular CSS rendering.</p>
  55850. <h2 id=obsolete>15 Obsolete features</h2>
  55851. <h3 id=obsolete-but-conforming-features>15.1 Obsolete but conforming features</h3>
  55852. <p>Features listed in this section will trigger warnings in conformance checkers.</p>
  55853. <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
  55854. <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>
  55855. <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
  55856. <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
  55857. case-insensitive</a> match for the string "<code>JavaScript</code>" and either the
  55858. <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
  55859. <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>".
  55860. 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>
  55861. <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
  55862. <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
  55863. 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
  55864. 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
  55865. 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
  55866. a way to specify possible targets for fragment identifiers in <a href=#url id=obsolete-but-conforming-features:url>URLs</a>. The
  55867. <code id=obsolete-but-conforming-features:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute should be used instead.</p>
  55868. <p>Authors should not, but may despite requirements to the contrary elsewhere in this
  55869. 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
  55870. 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
  55871. <code>type="number"</code> to still render the text field with a useful width.</p>
  55872. <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
  55873. trigger a warning.</p>
  55874. <h4 id=warnings-for-obsolete-but-conforming-features>15.1.1 Warnings for obsolete but conforming features</h4>
  55875. <p>To ease the transition from HTML4 Transitional documents to the language defined in
  55876. <em>this</em> specification, and to discourage certain features that are only allowed in very few
  55877. circumstances, conformance checkers must warn the user when the following features are used in a
  55878. document. These are generally old obsolete features that have no effect, and are allowed only to
  55879. distinguish between likely mistakes (regular conformance errors) and mere vestigial markup or
  55880. unusual and discouraged practices (these warnings).</p>
  55881. <p>The following features must be categorised as described
  55882. above:</p>
  55883. <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
  55884. <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
  55885. <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
  55886. 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
  55887. 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>
  55888. 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
  55889. <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
  55890. <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
  55891. <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
  55892. <a href="#number-state-(type=number)" id="warnings-for-obsolete-but-conforming-features:number-state-(type=number)-2">Number</a> state.</ul>
  55893. <p>Conformance checkers must distinguish between pages that have no conformance errors and have
  55894. none of these obsolete features, and pages that have no conformance errors but do have some of
  55895. these obsolete features.</p>
  55896. <p class=example>For example, a validator could report some pages as "Valid HTML" and others as
  55897. "Valid HTML with warnings".</p>
  55898. <h3 id=non-conforming-features>15.2 Non-conforming features</h3>
  55899. <p>Elements in the following list are entirely obsolete, and must not be used by authors:</p>
  55900. <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>&lt;</code>" and "<code>&amp;</code>" characters as "<code>&amp;lt;</code>" and "<code>&amp;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>
  55901. <p>Use appropriate elements or CSS instead.</p>
  55902. <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,
  55903. 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
  55904. 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
  55905. <code id=non-conforming-features:the-samp-element><a href=#the-samp-element>samp</a></code> element.</p>
  55906. <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
  55907. 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
  55908. <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
  55909. purposes, consider the <code id=non-conforming-features:the-mark-element><a href=#the-mark-element>mark</a></code> element.</p>
  55910. <p>See also the <a href=#usage-summary>text-level semantics usage summary</a> for more
  55911. suggestions with examples.</p>
  55912. </dl>
  55913. <hr>
  55914. <p>The following attributes are obsolete (though the elements are still part of the language), and
  55915. must not be used by authors:</p>
  55916. <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>
  55917. attribute instead, with an opposite term. (For example, instead of
  55918. <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>
  55919. attribute is sufficient; the <code id=non-conforming-features:attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> attribute is
  55920. 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
  55921. 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
  55922. 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
  55923. 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
  55924. description, or (in the case of images) use an <a href=#image-map id=non-conforming-features:image-map>image
  55925. map</a> to provide a link from the image to the image's
  55926. 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),
  55927. 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
  55928. 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
  55929. 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
  55930. 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
  55931. 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>
  55932. <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>
  55933. <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>
  55934. <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>
  55935. <h3 id=requirements-for-implementations>15.3 Requirements for implementations</h3>
  55936. <h4 id=the-applet-element>15.3.1 The <dfn><code>applet</code></dfn> element</h4>
  55937. <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.
  55938. 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,
  55939. Flash, etc) are handled in a consistent manner.</p>
  55940. <p>When the element matches any of the following conditions, it <a href=#represents id=the-applet-element:represents>represents</a> its
  55941. contents:</p>
  55942. <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
  55943. 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
  55944. 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
  55945. <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>
  55946. <p>Otherwise, the user agent should instantiate a Java Language runtime <a href=#plugin id=the-applet-element:plugin-3>plugin</a>, and
  55947. should pass the names and values of all the attributes on the element, in the order they were
  55948. added to the element, with the attributes added by the parser being ordered in source order, and
  55949. 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
  55950. 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
  55951. <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
  55952. <code id=the-applet-element:htmlappletelement><a href=#htmlappletelement>HTMLAppletElement</a></code> object representing the element should expose that interface. The
  55953. <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>
  55954. <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
  55955. Java Language runtime is instantiated even if the element is hidden with a 'display:none' CSS
  55956. style.</p>
  55957. <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>
  55958. interface.</p>
  55959. <pre class=idl>interface <dfn id=htmlappletelement>HTMLAppletElement</dfn> : <a href=#htmlelement id=the-applet-element:htmlelement>HTMLElement</a> {
  55960. attribute DOMString <a href=#dom-applet-align id=the-applet-element:dom-applet-align>align</a>;
  55961. attribute DOMString <a href=#dom-applet-alt id=the-applet-element:dom-applet-alt>alt</a>;
  55962. attribute DOMString <a href=#dom-applet-archive id=the-applet-element:dom-applet-archive>archive</a>;
  55963. attribute DOMString <a href=#dom-applet-code id=the-applet-element:dom-applet-code>code</a>;
  55964. attribute DOMString <a href=#dom-applet-codebase id=the-applet-element:dom-applet-codebase>codeBase</a>;
  55965. attribute DOMString <a href=#dom-applet-height id=the-applet-element:dom-applet-height>height</a>;
  55966. attribute unsigned long <a href=#dom-applet-hspace id=the-applet-element:dom-applet-hspace>hspace</a>;
  55967. attribute DOMString <a href=#dom-applet-name id=the-applet-element:dom-applet-name>name</a>;
  55968. attribute DOMString _<a href=#dom-applet-object id=the-applet-element:dom-applet-object>object</a>; // the underscore is not part of the identifier
  55969. attribute unsigned long <a href=#dom-applet-vspace id=the-applet-element:dom-applet-vspace>vspace</a>;
  55970. attribute DOMString <a href=#dom-applet-width id=the-applet-element:dom-applet-width>width</a>;
  55971. };</pre>
  55972. <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
  55973. respective content attributes of the same name. For the purposes of reflection, the
  55974. <code id=the-applet-element:the-applet-element-7><a href=#the-applet-element>applet</a></code> element's <code>object</code> content
  55975. attribute is defined as containing a <a href=#url id=the-applet-element:url>URL</a>.</p>
  55976. <p>The <dfn id=dom-applet-codebase><code>codeBase</code></dfn> IDL attribute must
  55977. <a href=#reflect id=the-applet-element:reflect-2>reflect</a> the <code>codebase</code> content
  55978. attribute, which for the purposes of reflection is defined as containing a <a href=#url id=the-applet-element:url-2>URL</a>.</p>
  55979. <h4 id=the-marquee-element-2>15.3.2 The <dfn><code>marquee</code></dfn> element</h4>
  55980. <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
  55981. transitions and animations are a more appropriate mechanism. <a href=#refsCSSANIMATIONS>[CSSANIMATIONS]</a> <a href=#refsCSSTRANSITIONS>[CSSTRANSITIONS]</a></p>
  55982. <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
  55983. task source</a>.</p>
  55984. <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>
  55985. interface.</p>
  55986. <pre class=idl>interface <dfn id=htmlmarqueeelement>HTMLMarqueeElement</dfn> : <a href=#htmlelement id=the-marquee-element-2:htmlelement>HTMLElement</a> {
  55987. attribute DOMString <a href=#dom-marquee-behavior id=the-marquee-element-2:dom-marquee-behavior>behavior</a>;
  55988. attribute DOMString <a href=#dom-marquee-bgcolor id=the-marquee-element-2:dom-marquee-bgcolor>bgColor</a>;
  55989. attribute DOMString <a href=#dom-marquee-direction id=the-marquee-element-2:dom-marquee-direction>direction</a>;
  55990. attribute DOMString <a href=#dom-marquee-height id=the-marquee-element-2:dom-marquee-height>height</a>;
  55991. attribute unsigned long <a href=#dom-marquee-hspace id=the-marquee-element-2:dom-marquee-hspace>hspace</a>;
  55992. attribute long <a href=#dom-marquee-loop id=the-marquee-element-2:dom-marquee-loop>loop</a>;
  55993. attribute unsigned long <a href=#dom-marquee-scrollamount id=the-marquee-element-2:dom-marquee-scrollamount>scrollAmount</a>;
  55994. attribute unsigned long <a href=#dom-marquee-scrolldelay id=the-marquee-element-2:dom-marquee-scrolldelay>scrollDelay</a>;
  55995. attribute boolean <a href=#dom-marquee-truespeed id=the-marquee-element-2:dom-marquee-truespeed>trueSpeed</a>;
  55996. attribute unsigned long <a href=#dom-marquee-vspace id=the-marquee-element-2:dom-marquee-vspace>vspace</a>;
  55997. attribute DOMString <a href=#dom-marquee-width id=the-marquee-element-2:dom-marquee-width>width</a>;
  55998. 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>;
  55999. 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>;
  56000. 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>;
  56001. void <a href=#dom-marquee-start id=the-marquee-element-2:dom-marquee-start>start</a>();
  56002. void <a href=#dom-marquee-stop id=the-marquee-element-2:dom-marquee-stop>stop</a>();
  56003. };</pre>
  56004. <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>
  56005. <p>When the <dfn id=dom-marquee-start><code>start()</code></dfn> method is called, the
  56006. <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>
  56007. <p>When the <dfn id=dom-marquee-stop><code>stop()</code></dfn> method is called, the
  56008. <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>
  56009. <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>
  56010. 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>
  56011. <hr>
  56012. <p>The <dfn id=attr-marquee-behavior><code>behavior</code></dfn> content attribute on
  56013. <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
  56014. (all non-conforming):</p>
  56015. <table><thead><tr><th>Keyword
  56016. <th>State
  56017. <tbody><tr><td><code>scroll</code>
  56018. <td><dfn id=attr-marquee-behavior-scroll>scroll</dfn>
  56019. <tr><td><code>slide</code>
  56020. <td><dfn id=attr-marquee-behavior-slide>slide</dfn>
  56021. <tr><td><code>alternate</code>
  56022. <td><dfn id=attr-marquee-behavior-alternate>alternate</dfn>
  56023. </table>
  56024. <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>
  56025. <hr>
  56026. <p>The <dfn id=attr-marquee-direction><code>direction</code></dfn> content attribute on
  56027. <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
  56028. (all non-conforming):</p>
  56029. <table><thead><tr><th>Keyword
  56030. <th>State
  56031. <tbody><tr><td><code>left</code>
  56032. <td><dfn id=attr-marquee-direction-left>left</dfn>
  56033. <tr><td><code>right</code>
  56034. <td><dfn id=attr-marquee-direction-right>right</dfn>
  56035. <tr><td><code>up</code>
  56036. <td><dfn id=attr-marquee-direction-up>up</dfn>
  56037. <tr><td><code>down</code>
  56038. <td><dfn id=attr-marquee-direction-down>down</dfn>
  56039. </table>
  56040. <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>
  56041. state.</p>
  56042. <hr>
  56043. <p>The <dfn id=attr-marquee-truespeed><code>truespeed</code></dfn> content attribute on
  56044. <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>
  56045. <hr>
  56046. <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
  56047. follows:</p>
  56048. <ol><li><p>If the element has a <code>scrolldelay</code> attribute,
  56049. 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
  56050. return an error, then let <var>delay</var> be the parsed value. Otherwise, let <var>delay</var>
  56051. 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>
  56052. attribute, and the <var>delay</var> value is less than 60, then let <var>delay</var> be 60
  56053. 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
  56054. milliseconds.</ol>
  56055. <hr>
  56056. <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
  56057. has a <code>scrollamount</code> attribute, and
  56058. 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
  56059. an error, is the parsed value interpreted in CSS pixels, and otherwise is 6 CSS pixels.</p>
  56060. <hr>
  56061. <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
  56062. <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
  56063. for parsing integers</a> does not return an error or a number less than 1, is the parsed value,
  56064. and otherwise is −1.</p>
  56065. <p>The <dfn id=dom-marquee-loop><code>loop</code></dfn> IDL attribute, on getting, must
  56066. 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
  56067. 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
  56068. 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
  56069. (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
  56070. values are ignored.)</p>
  56071. <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
  56072. when the element is created.</p>
  56073. <p>The rendering layer will occasionally <dfn id=increment-the-marquee-current-loop-index>increment the marquee current loop index</dfn>,
  56074. which must cause the following steps to be run:</p>
  56075. <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>
  56076. <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>
  56077. <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
  56078. <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
  56079. <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>
  56080. 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>
  56081. <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
  56082. <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
  56083. 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>
  56084. at the <code id=the-marquee-element-2:the-marquee-element-2-16><a href=#the-marquee-element-2>marquee</a></code> element.</p>
  56085. <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>
  56086. </ol>
  56087. <hr>
  56088. <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
  56089. 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>
  56090. <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>
  56091. <tbody><tr><td><dfn id=handler-marquee-onbounce><code>onbounce</code></dfn> <td> <code>bounce</code>
  56092. <tr><td><dfn id=handler-marquee-onfinish><code>onfinish</code></dfn> <td> <code>finish</code>
  56093. <tr><td><dfn id=handler-marquee-onstart><code>onstart</code></dfn> <td> <code>start</code>
  56094. </table>
  56095. <hr>
  56096. <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
  56097. respective content attributes of the same name.</p>
  56098. <p>The <dfn id=dom-marquee-bgcolor><code>bgColor</code></dfn> IDL attribute must
  56099. <a href=#reflect id=the-marquee-element-2:reflect-2>reflect</a> the <code>bgcolor</code> content attribute.</p>
  56100. <p>The <dfn id=dom-marquee-scrollamount><code>scrollAmount</code></dfn> IDL attribute must
  56101. <a href=#reflect id=the-marquee-element-2:reflect-3>reflect</a> the <code>scrollamount</code> content
  56102. attribute. The default value is 6.</p>
  56103. <p>The <dfn id=dom-marquee-scrolldelay><code>scrollDelay</code></dfn> IDL attribute must
  56104. <a href=#reflect id=the-marquee-element-2:reflect-4>reflect</a> the <code>scrolldelay</code> content
  56105. attribute. The default value is 85.</p>
  56106. <p>The <dfn id=dom-marquee-truespeed><code>trueSpeed</code></dfn> IDL attribute must
  56107. <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
  56108. attribute.</p>
  56109. <h4 id=frames>15.3.3 Frames</h4>
  56110. <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
  56111. that use frames.</p>
  56112. <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>
  56113. interface.</p>
  56114. <pre class=idl>interface <dfn id=htmlframesetelement>HTMLFrameSetElement</dfn> : <a href=#htmlelement id=frames:htmlelement>HTMLElement</a> {
  56115. attribute DOMString <a href=#dom-frameset-cols id=frames:dom-frameset-cols>cols</a>;
  56116. attribute DOMString <a href=#dom-frameset-rows id=frames:dom-frameset-rows>rows</a>;
  56117. };
  56118. <a href=#htmlframesetelement id=frames:htmlframesetelement-2>HTMLFrameSetElement</a> implements <a href=#windoweventhandlers id=frames:windoweventhandlers>WindowEventHandlers</a>;</pre>
  56119. <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>
  56120. element must <a href=#reflect id=frames:reflect>reflect</a> the respective content attributes of the same name.</p>
  56121. <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
  56122. 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
  56123. <a href=#event-handler-idl-attributes id=frames:event-handler-idl-attributes>event handler IDL attributes</a>.</p>
  56124. <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>,
  56125. <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>
  56126. <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
  56127. <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
  56128. normally supported by <a href=#html-elements id=frames:html-elements>HTML elements</a>.</p>
  56129. <hr>
  56130. <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>
  56131. 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>
  56132. element.</p>
  56133. <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
  56134. it is <a href=#in-a-document id=frames:in-a-document>in a <code>Document</code></a>.</p>
  56135. <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>
  56136. 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
  56137. 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
  56138. <code>frame</code> attributes</a> for the first time.</p>
  56139. <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>
  56140. element</a>, the user agent must <a href=#a-browsing-context-is-discarded id=frames:a-browsing-context-is-discarded>discard</a>
  56141. the <a href=#nested-browsing-context id=frames:nested-browsing-context-3>nested browsing context</a>.</p>
  56142. <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
  56143. <a href=#process-the-frame-attributes id=frames:process-the-frame-attributes-2>process the <code>frame</code> attributes</a>.</p>
  56144. <p>When the user agent is to <dfn id=process-the-frame-attributes>process the <code>frame</code> attributes</dfn>, it must run the
  56145. first appropriate steps from the following list:</p>
  56146. <dl class=switch><dt>If the element has no <code>src</code> attribute specified, and the
  56147. user agent is processing the <code id=frames:frame-5><a href=#frame>frame</a></code>'s attributes for the first time<dd>
  56148. <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>
  56149. <dt>Otherwise<dd>
  56150. <ol><li>
  56151. <p>If the value of the <code>src</code> attribute is the empty string,
  56152. let <var>url</var> be the string "<code id=frames:about:blank><a href=#about:blank>about:blank</a></code>".</p>
  56153. <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>
  56154. <p>If that is not successful, then let <var>url</var> be the string
  56155. "<code id=frames:about:blank-2><a href=#about:blank>about:blank</a></code>". Otherwise, let <var>url</var> be the resulting
  56156. <a href=#absolute-url id=frames:absolute-url>absolute URL</a>.</p>
  56157. <li>
  56158. <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>
  56159. to <var>url</var>.</p>
  56160. </ol>
  56161. </dl>
  56162. <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
  56163. 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
  56164. 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
  56165. <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>
  56166. <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
  56167. 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
  56168. 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>
  56169. <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
  56170. 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>
  56171. 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
  56172. 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
  56173. with <a href=#replacement-enabled id=frames:replacement-enabled-2>replacement enabled</a>.</p>
  56174. <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
  56175. 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>
  56176. 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>
  56177. <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
  56178. <a href=#dom-manipulation-task-source id=frames:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
  56179. <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
  56180. 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
  56181. <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>
  56182. 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
  56183. load event</a> of its document.</p>
  56184. <p>When the browsing context is created, if a <code>name</code> attribute
  56185. 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;
  56186. 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>
  56187. <p>Whenever the <code>name</code> attribute is set, the nested
  56188. <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
  56189. 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
  56190. the empty string.</p>
  56191. <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>
  56192. <pre class=idl>interface <dfn id=htmlframeelement>HTMLFrameElement</dfn> : <a href=#htmlelement id=frames:htmlelement-2>HTMLElement</a> {
  56193. attribute DOMString <a href=#dom-frame-name id=frames:dom-frame-name>name</a>;
  56194. attribute DOMString <a href=#dom-frame-scrolling id=frames:dom-frame-scrolling>scrolling</a>;
  56195. attribute DOMString <a href=#dom-frame-src id=frames:dom-frame-src>src</a>;
  56196. attribute DOMString <a href=#dom-frame-frameborder id=frames:dom-frame-frameborder>frameBorder</a>;
  56197. attribute DOMString <a href=#dom-frame-longdesc id=frames:dom-frame-longdesc>longDesc</a>;
  56198. attribute boolean <a href=#dom-frame-noresize id=frames:dom-frame-noresize>noResize</a>;
  56199. readonly attribute <a href=#document id=frames:document-4>Document</a>? <a href=#dom-frame-contentdocument id=frames:dom-frame-contentdocument>contentDocument</a>;
  56200. readonly attribute <a href=#windowproxy id=frames:windowproxy>WindowProxy</a>? <a href=#dom-frame-contentwindow id=frames:dom-frame-contentwindow>contentWindow</a>;
  56201. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginheight id=frames:dom-frame-marginheight>marginHeight</a>;
  56202. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginwidth id=frames:dom-frame-marginwidth>marginWidth</a>;
  56203. };</pre>
  56204. <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
  56205. <a href=#reflect id=frames:reflect-2>reflect</a> the respective content attributes of the same name. For the purposes of
  56206. reflection, the <code id=frames:frame-17><a href=#frame>frame</a></code> element's <code>src</code> content
  56207. attribute is defined as containing a <a href=#url id=frames:url>URL</a>.</p>
  56208. <p>The <dfn id=dom-frame-frameborder><code>frameBorder</code></dfn> IDL attribute of the
  56209. <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>
  56210. <p>The <dfn id=dom-frame-longdesc><code>longDesc</code></dfn> IDL attribute of the
  56211. <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
  56212. of reflection is defined as containing a <a href=#url id=frames:url-2>URL</a>.</p>
  56213. <p>The <dfn id=dom-frame-noresize><code>noResize</code></dfn> IDL attribute of the
  56214. <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>
  56215. <p>The <dfn id=dom-frame-contentdocument><code>contentDocument</code></dfn> IDL attribute of
  56216. 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
  56217. 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
  56218. 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
  56219. <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
  56220. null otherwise.</p>
  56221. <p>The <dfn id=dom-frame-contentwindow><code>contentWindow</code></dfn> IDL attribute must
  56222. 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
  56223. browsing context</a>.</p>
  56224. <p>The <dfn id=dom-frame-marginheight><code>marginHeight</code></dfn> IDL attribute of the
  56225. <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>
  56226. <p>The <dfn id=dom-frame-marginwidth><code>marginWidth</code></dfn> IDL attribute of the
  56227. <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>
  56228. <h4 id=other-elements,-attributes-and-apis>15.3.4 Other elements, attributes and APIs</h4>
  56229. <p>User agents must treat <code id=other-elements,-attributes-and-apis:acronym><a href=#acronym>acronym</a></code> elements in a manner
  56230. 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
  56231. for purposes of rendering.</p>
  56232. <hr>
  56233. <pre class=idl>partial interface <a href=#htmlanchorelement id=HTMLAnchorElement-partial>HTMLAnchorElement</a> {
  56234. attribute DOMString <a href=#dom-a-coords id=other-elements,-attributes-and-apis:dom-a-coords>coords</a>;
  56235. attribute DOMString <a href=#dom-a-charset id=other-elements,-attributes-and-apis:dom-a-charset>charset</a>;
  56236. attribute DOMString <a href=#dom-a-name id=other-elements,-attributes-and-apis:dom-a-name>name</a>;
  56237. attribute DOMString <a href=#dom-a-rev id=other-elements,-attributes-and-apis:dom-a-rev>rev</a>;
  56238. attribute DOMString <a href=#dom-a-shape id=other-elements,-attributes-and-apis:dom-a-shape>shape</a>;
  56239. };</pre>
  56240. <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
  56241. <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
  56242. content attributes of the same name.</p>
  56243. <hr>
  56244. <pre class=idl>partial interface <a href=#htmlareaelement id=HTMLAreaElement-partial>HTMLAreaElement</a> {
  56245. attribute boolean <a href=#dom-area-nohref id=other-elements,-attributes-and-apis:dom-area-nohref>noHref</a>;
  56246. };</pre>
  56247. <p>The <dfn id=dom-area-nohref><code>noHref</code></dfn> IDL attribute of the
  56248. <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>
  56249. <hr>
  56250. <pre class=idl>partial interface <a href=#htmlbodyelement id=HTMLBodyElement-partial>HTMLBodyElement</a> {
  56251. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-text id=other-elements,-attributes-and-apis:dom-body-text>text</a>;
  56252. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-link id=other-elements,-attributes-and-apis:dom-body-link>link</a>;
  56253. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-vlink id=other-elements,-attributes-and-apis:dom-body-vlink>vLink</a>;
  56254. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-alink id=other-elements,-attributes-and-apis:dom-body-alink>aLink</a>;
  56255. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-bgcolor id=other-elements,-attributes-and-apis:dom-body-bgcolor>bgColor</a>;
  56256. attribute DOMString <a href=#dom-body-background id=other-elements,-attributes-and-apis:dom-body-background>background</a>;
  56257. };</pre>
  56258. <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>
  56259. 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
  56260. attribute.</p>
  56261. <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>
  56262. 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
  56263. attribute.</p>
  56264. <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>
  56265. 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
  56266. attribute.</p>
  56267. <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>
  56268. 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
  56269. attribute.</p>
  56270. <p>The <dfn id=dom-body-bgcolor><code>bgColor</code></dfn> IDL attribute of the
  56271. <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>
  56272. <p>The <dfn id=dom-body-background><code>background</code></dfn> IDL attribute of the
  56273. <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
  56274. <a href=#url id=other-elements,-attributes-and-apis:url>URL</a>, despite rules regarding its handling in the rendering section above.)</p>
  56275. <hr>
  56276. <pre class=idl>partial interface <a href=#htmlbrelement id=HTMLBRElement-partial>HTMLBRElement</a> {
  56277. attribute DOMString <a href=#dom-br-clear id=other-elements,-attributes-and-apis:dom-br-clear>clear</a>;
  56278. };</pre>
  56279. <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>
  56280. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-9>reflect</a> the content attribute of the same name.</p>
  56281. <hr>
  56282. <pre class=idl>partial interface <a href=#htmltablecaptionelement id=HTMLTableCaptionElement-partial>HTMLTableCaptionElement</a> {
  56283. attribute DOMString <a href=#dom-caption-align id=other-elements,-attributes-and-apis:dom-caption-align>align</a>;
  56284. };</pre>
  56285. <p>The <dfn id=dom-caption-align><code>align</code></dfn> IDL attribute of the
  56286. <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>
  56287. <hr>
  56288. <pre class=idl>partial interface <a href=#htmltablecolelement id=HTMLTableColElement-partial>HTMLTableColElement</a> {
  56289. attribute DOMString <a href=#dom-col-align id=other-elements,-attributes-and-apis:dom-col-align>align</a>;
  56290. attribute DOMString <a href=#dom-col-ch id=other-elements,-attributes-and-apis:dom-col-ch>ch</a>;
  56291. attribute DOMString <a href=#dom-col-choff id=other-elements,-attributes-and-apis:dom-col-choff>chOff</a>;
  56292. attribute DOMString <a href=#dom-col-valign id=other-elements,-attributes-and-apis:dom-col-valign>vAlign</a>;
  56293. attribute DOMString <a href=#dom-col-width id=other-elements,-attributes-and-apis:dom-col-width>width</a>;
  56294. };</pre>
  56295. <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
  56296. <a href=#reflect id=other-elements,-attributes-and-apis:reflect-11>reflect</a> the respective content attributes of the same name.</p>
  56297. <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
  56298. 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
  56299. attribute.</p>
  56300. <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>
  56301. 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>
  56302. content attribute.</p>
  56303. <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>
  56304. 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>
  56305. content attribute.</p>
  56306. <hr>
  56307. <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>
  56308. elements in terms of semantics and for purposes of rendering.</p>
  56309. <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>
  56310. interface.</p>
  56311. <pre class=idl>interface <dfn id=htmldirectoryelement>HTMLDirectoryElement</dfn> : <a href=#htmlelement id=other-elements,-attributes-and-apis:htmlelement>HTMLElement</a> {
  56312. attribute boolean <a href=#dom-dir-compact id=other-elements,-attributes-and-apis:dom-dir-compact>compact</a>;
  56313. };</pre>
  56314. <p>The <dfn id=dom-dir-compact><code>compact</code></dfn> IDL attribute of the
  56315. <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>
  56316. <hr>
  56317. <pre class=idl>partial interface <a href=#htmldivelement id=HTMLDivElement-partial>HTMLDivElement</a> {
  56318. attribute DOMString <a href=#dom-div-align id=other-elements,-attributes-and-apis:dom-div-align>align</a>;
  56319. };</pre>
  56320. <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>
  56321. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-16>reflect</a> the content attribute of the same name.</p>
  56322. <hr>
  56323. <pre class=idl>partial interface <a href=#htmldlistelement id=HTMLDListElement-partial>HTMLDListElement</a> {
  56324. attribute boolean <a href=#dom-dl-compact id=other-elements,-attributes-and-apis:dom-dl-compact>compact</a>;
  56325. };</pre>
  56326. <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>
  56327. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-17>reflect</a> the content attribute of the same name.</p>
  56328. <hr>
  56329. <pre class=idl>partial interface <a href=#htmlembedelement id=HTMLEmbedElement-partial>HTMLEmbedElement</a> {
  56330. attribute DOMString <a href=#dom-embed-align id=other-elements,-attributes-and-apis:dom-embed-align>align</a>;
  56331. attribute DOMString <a href=#dom-embed-name id=other-elements,-attributes-and-apis:dom-embed-name>name</a>;
  56332. };</pre>
  56333. <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
  56334. must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-18>reflect</a> the respective content attributes of the same name.</p>
  56335. <hr>
  56336. <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>
  56337. <pre class=idl>interface <dfn id=htmlfontelement>HTMLFontElement</dfn> : <a href=#htmlelement id=other-elements,-attributes-and-apis:htmlelement-2>HTMLElement</a> {
  56338. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-font-color id=other-elements,-attributes-and-apis:dom-font-color>color</a>;
  56339. attribute DOMString <a href=#dom-font-face id=other-elements,-attributes-and-apis:dom-font-face>face</a>;
  56340. attribute DOMString <a href=#dom-font-size id=other-elements,-attributes-and-apis:dom-font-size>size</a>;
  56341. };</pre>
  56342. <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
  56343. <a href=#reflect id=other-elements,-attributes-and-apis:reflect-19>reflect</a> the respective content attributes of the same name.</p>
  56344. <hr>
  56345. <pre class=idl>partial interface <a href=#htmlheadingelement id=HTMLHeadingElement-partial>HTMLHeadingElement</a> {
  56346. attribute DOMString <a href=#dom-hx-align id=other-elements,-attributes-and-apis:dom-hx-align>align</a>;
  56347. };</pre>
  56348. <p>The <dfn id=dom-hx-align><code>align</code></dfn> IDL attribute of the
  56349. <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
  56350. the same name.</p>
  56351. <hr>
  56352. <p class=note>The <dfn id=dom-head-profile><code>profile</code></dfn> IDL attribute on
  56353. <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
  56354. omitted. Unless so required by <a href=#other-applicable-specifications id=other-elements,-attributes-and-apis:other-applicable-specifications>another applicable
  56355. specification</a>, implementations would therefore not support this attribute. (It is mentioned
  56356. here as it was defined in a previous version of the DOM specifications.)</p>
  56357. <hr>
  56358. <pre class=idl>partial interface <a href=#htmlhrelement id=HTMLHRElement-partial>HTMLHRElement</a> {
  56359. attribute DOMString <a href=#dom-hr-align id=other-elements,-attributes-and-apis:dom-hr-align>align</a>;
  56360. attribute DOMString <a href=#dom-hr-color id=other-elements,-attributes-and-apis:dom-hr-color>color</a>;
  56361. attribute boolean <a href=#dom-hr-noshade id=other-elements,-attributes-and-apis:dom-hr-noshade>noShade</a>;
  56362. attribute DOMString <a href=#dom-hr-size id=other-elements,-attributes-and-apis:dom-hr-size>size</a>;
  56363. attribute DOMString <a href=#dom-hr-width id=other-elements,-attributes-and-apis:dom-hr-width>width</a>;
  56364. };</pre>
  56365. <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>,
  56366. 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>
  56367. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-21>reflect</a> the respective content attributes of the same name.</p>
  56368. <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>
  56369. 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>
  56370. content attribute.</p>
  56371. <hr>
  56372. <pre class=idl>partial interface <a href=#htmlhtmlelement id=HTMLHtmlElement-partial>HTMLHtmlElement</a> {
  56373. attribute DOMString <a href=#dom-html-version id=other-elements,-attributes-and-apis:dom-html-version>version</a>;
  56374. };</pre>
  56375. <p>The <dfn id=dom-html-version><code>version</code></dfn> IDL attribute of the
  56376. <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>
  56377. <hr>
  56378. <pre class=idl>partial interface <a href=#htmliframeelement id=HTMLIFrameElement-partial>HTMLIFrameElement</a> {
  56379. attribute DOMString <a href=#dom-iframe-align id=other-elements,-attributes-and-apis:dom-iframe-align>align</a>;
  56380. attribute DOMString <a href=#dom-iframe-scrolling id=other-elements,-attributes-and-apis:dom-iframe-scrolling>scrolling</a>;
  56381. attribute DOMString <a href=#dom-iframe-frameborder id=other-elements,-attributes-and-apis:dom-iframe-frameborder>frameBorder</a>;
  56382. attribute DOMString <a href=#dom-iframe-longdesc id=other-elements,-attributes-and-apis:dom-iframe-longdesc>longDesc</a>;
  56383. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginheight id=other-elements,-attributes-and-apis:dom-iframe-marginheight>marginHeight</a>;
  56384. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginwidth id=other-elements,-attributes-and-apis:dom-iframe-marginwidth>marginWidth</a>;
  56385. };</pre>
  56386. <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
  56387. <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
  56388. same name.</p>
  56389. <p>The <dfn id=dom-iframe-frameborder><code>frameBorder</code></dfn> IDL attribute of the
  56390. <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>
  56391. <p>The <dfn id=dom-iframe-longdesc><code>longDesc</code></dfn> IDL attribute of the
  56392. <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
  56393. reflection is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-2>URL</a>.</p>
  56394. <p>The <dfn id=dom-iframe-marginheight><code>marginHeight</code></dfn> IDL attribute of the
  56395. <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>
  56396. <p>The <dfn id=dom-iframe-marginwidth><code>marginWidth</code></dfn> IDL attribute of the
  56397. <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>
  56398. <hr>
  56399. <pre class=idl>partial interface <a href=#htmlimageelement id=HTMLImageElement-partial>HTMLImageElement</a> {
  56400. attribute DOMString <a href=#dom-img-name id=other-elements,-attributes-and-apis:dom-img-name>name</a>;
  56401. attribute DOMString <a href=#dom-img-lowsrc id=other-elements,-attributes-and-apis:dom-img-lowsrc>lowsrc</a>;
  56402. attribute DOMString <a href=#dom-img-align id=other-elements,-attributes-and-apis:dom-img-align>align</a>;
  56403. attribute unsigned long <a href=#dom-img-hspace id=other-elements,-attributes-and-apis:dom-img-hspace>hspace</a>;
  56404. attribute unsigned long <a href=#dom-img-vspace id=other-elements,-attributes-and-apis:dom-img-vspace>vspace</a>;
  56405. attribute DOMString <a href=#dom-img-longdesc id=other-elements,-attributes-and-apis:dom-img-longdesc>longDesc</a>;
  56406. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-img-border id=other-elements,-attributes-and-apis:dom-img-border>border</a>;
  56407. };</pre>
  56408. <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
  56409. must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-29>reflect</a> the respective content attributes of the same name.</p>
  56410. <p>The <dfn id=dom-img-longdesc><code>longDesc</code></dfn> IDL attribute of the
  56411. <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
  56412. is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-3>URL</a>.</p>
  56413. <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>
  56414. 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>
  56415. content attribute, which for the purposes of reflection is defined as containing a
  56416. <a href=#url id=other-elements,-attributes-and-apis:url-4>URL</a>.</p>
  56417. <hr>
  56418. <pre class=idl>partial interface <a href=#htmlinputelement id=HTMLInputElement-partial>HTMLInputElement</a> {
  56419. attribute DOMString <a href=#dom-input-align id=other-elements,-attributes-and-apis:dom-input-align>align</a>;
  56420. attribute DOMString <a href=#dom-input-usemap id=other-elements,-attributes-and-apis:dom-input-usemap>useMap</a>;
  56421. };</pre>
  56422. <p>The <dfn id=dom-input-align><code>align</code></dfn> IDL attribute of the
  56423. <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>
  56424. <p>The <dfn id=dom-input-usemap><code>useMap</code></dfn> IDL attribute of the
  56425. <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>
  56426. <hr>
  56427. <pre class=idl>partial interface <a href=#htmllegendelement id=HTMLLegendElement-partial>HTMLLegendElement</a> {
  56428. attribute DOMString <a href=#dom-legend-align id=other-elements,-attributes-and-apis:dom-legend-align>align</a>;
  56429. };</pre>
  56430. <p>The <dfn id=dom-legend-align><code>align</code></dfn> IDL attribute of the
  56431. <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>
  56432. <hr>
  56433. <pre class=idl>partial interface <a href=#htmllielement id=HTMLLIElement-partial>HTMLLIElement</a> {
  56434. attribute DOMString <a href=#dom-li-type id=other-elements,-attributes-and-apis:dom-li-type>type</a>;
  56435. };</pre>
  56436. <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>
  56437. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-35>reflect</a> the content attribute of the same name.</p>
  56438. <hr>
  56439. <pre class=idl>partial interface <a href=#htmllinkelement id=HTMLLinkElement-partial>HTMLLinkElement</a> {
  56440. attribute DOMString <a href=#dom-link-charset id=other-elements,-attributes-and-apis:dom-link-charset>charset</a>;
  56441. attribute DOMString <a href=#dom-link-rev id=other-elements,-attributes-and-apis:dom-link-rev>rev</a>;
  56442. attribute DOMString <a href=#dom-link-target id=other-elements,-attributes-and-apis:dom-link-target>target</a>;
  56443. };</pre>
  56444. <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
  56445. must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-36>reflect</a> the respective content attributes of the same name.</p>
  56446. <hr>
  56447. <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>
  56448. elements in terms of semantics and for purposes of rendering.</p>
  56449. <hr>
  56450. <pre class=idl>partial interface <a href=#htmlmenuelement id=HTMLMenuElement-partial>HTMLMenuElement</a> {
  56451. attribute boolean <a href=#dom-menu-compact id=other-elements,-attributes-and-apis:dom-menu-compact>compact</a>;
  56452. };</pre>
  56453. <p>The <dfn id=dom-menu-compact><code>compact</code></dfn> IDL attribute of the
  56454. <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>
  56455. <hr>
  56456. <pre class=idl>partial interface <a href=#htmlmetaelement id=HTMLMetaElement-partial>HTMLMetaElement</a> {
  56457. attribute DOMString <a href=#dom-meta-scheme id=other-elements,-attributes-and-apis:dom-meta-scheme>scheme</a>;
  56458. };</pre>
  56459. <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
  56460. <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
  56461. 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
  56462. 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>
  56463. <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
  56464. and instead process the value given to the metadata name as if it had been specified for each
  56465. 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>
  56466. <div class=example>
  56467. <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
  56468. 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,
  56469. 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,
  56470. 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
  56471. 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
  56472. two different metadata names, one consisting of a combination of "eGMS.subject.keyword" and
  56473. "LGCL", and the other consisting of a combination of "eGMS.subject.keyword" and "ORLY":</p>
  56474. <pre class=bad>&lt;!-- this markup is invalid -->
  56475. &lt;meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles">
  56476. &lt;meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye"></pre>
  56477. <p>The suggested processing of this markup, however, would be equivalent to the following:</p>
  56478. <pre>&lt;meta name="eGMS.subject.keyword" content="Abandoned vehicles">
  56479. &lt;meta name="eGMS.subject.keyword" content="Mah car: kthxbye"></pre>
  56480. </div>
  56481. <p>The <dfn id=dom-meta-scheme><code>scheme</code></dfn> IDL attribute of the
  56482. <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>
  56483. <hr>
  56484. <pre class=idl>partial interface <a href=#htmlobjectelement id=HTMLObjectElement-partial>HTMLObjectElement</a> {
  56485. attribute DOMString <a href=#dom-object-align id=other-elements,-attributes-and-apis:dom-object-align>align</a>;
  56486. attribute DOMString <a href=#dom-object-archive id=other-elements,-attributes-and-apis:dom-object-archive>archive</a>;
  56487. attribute DOMString <a href=#dom-object-code id=other-elements,-attributes-and-apis:dom-object-code>code</a>;
  56488. attribute boolean <a href=#dom-object-declare id=other-elements,-attributes-and-apis:dom-object-declare>declare</a>;
  56489. attribute unsigned long <a href=#dom-object-hspace id=other-elements,-attributes-and-apis:dom-object-hspace>hspace</a>;
  56490. attribute DOMString <a href=#dom-object-standby id=other-elements,-attributes-and-apis:dom-object-standby>standby</a>;
  56491. attribute unsigned long <a href=#dom-object-vspace id=other-elements,-attributes-and-apis:dom-object-vspace>vspace</a>;
  56492. attribute DOMString <a href=#dom-object-codebase id=other-elements,-attributes-and-apis:dom-object-codebase>codeBase</a>;
  56493. attribute DOMString <a href=#dom-object-codetype id=other-elements,-attributes-and-apis:dom-object-codetype>codeType</a>;
  56494. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-object-border id=other-elements,-attributes-and-apis:dom-object-border>border</a>;
  56495. };</pre>
  56496. <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>
  56497. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-39>reflect</a> the respective content attributes of the same name.</p>
  56498. <p>The <dfn id=dom-object-codebase><code>codeBase</code></dfn> IDL attribute of the
  56499. <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
  56500. reflection is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-5>URL</a>.</p>
  56501. <p>The <dfn id=dom-object-codetype><code>codeType</code></dfn> IDL attribute of the
  56502. <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>
  56503. <hr>
  56504. <pre class=idl>partial interface <a href=#htmlolistelement id=HTMLOListElement-partial>HTMLOListElement</a> {
  56505. attribute boolean <a href=#dom-ol-compact id=other-elements,-attributes-and-apis:dom-ol-compact>compact</a>;
  56506. };</pre>
  56507. <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>
  56508. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-42>reflect</a> the content attribute of the same name.</p>
  56509. <hr>
  56510. <pre class=idl>partial interface <a href=#htmlparagraphelement id=HTMLParagraphElement-partial>HTMLParagraphElement</a> {
  56511. attribute DOMString <a href=#dom-p-align id=other-elements,-attributes-and-apis:dom-p-align>align</a>;
  56512. };</pre>
  56513. <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>
  56514. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-43>reflect</a> the content attribute of the same name.</p>
  56515. <hr>
  56516. <pre class=idl>partial interface <a href=#htmlparamelement id=HTMLParamElement-partial>HTMLParamElement</a> {
  56517. attribute DOMString <a href=#dom-param-type id=other-elements,-attributes-and-apis:dom-param-type>type</a>;
  56518. attribute DOMString <a href=#dom-param-valuetype id=other-elements,-attributes-and-apis:dom-param-valuetype>valueType</a>;
  56519. };</pre>
  56520. <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>
  56521. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-44>reflect</a> the content attribute of the same name.</p>
  56522. <p>The <dfn id=dom-param-valuetype><code>valueType</code></dfn> IDL attribute of the
  56523. <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>
  56524. <hr>
  56525. <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
  56526. <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
  56527. special behavior for this element, though.)</p>
  56528. <hr>
  56529. <pre class=idl>partial interface <a href=#htmlpreelement id=HTMLPreElement-partial>HTMLPreElement</a> {
  56530. attribute long <a href=#dom-pre-width id=other-elements,-attributes-and-apis:dom-pre-width>width</a>;
  56531. };</pre>
  56532. <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>
  56533. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-46>reflect</a> the content attribute of the same name.</p>
  56534. <hr>
  56535. <pre class=idl>partial interface <a href=#htmlscriptelement id=HTMLScriptElement-partial>HTMLScriptElement</a> {
  56536. attribute DOMString <a href=#dom-script-event id=other-elements,-attributes-and-apis:dom-script-event>event</a>;
  56537. attribute DOMString <a href=#dom-script-htmlfor id=other-elements,-attributes-and-apis:dom-script-htmlfor>htmlFor</a>;
  56538. };</pre>
  56539. <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>
  56540. element must return the empty string on getting, and do nothing on setting.</p>
  56541. <hr>
  56542. <pre class=idl>partial interface <a href=#htmltableelement id=HTMLTableElement-partial>HTMLTableElement</a> {
  56543. attribute DOMString <a href=#dom-table-align id=other-elements,-attributes-and-apis:dom-table-align>align</a>;
  56544. attribute DOMString <a href=#dom-table-border id=other-elements,-attributes-and-apis:dom-table-border>border</a>;
  56545. attribute DOMString <a href=#dom-table-frame id=other-elements,-attributes-and-apis:dom-table-frame>frame</a>;
  56546. attribute DOMString <a href=#dom-table-rules id=other-elements,-attributes-and-apis:dom-table-rules>rules</a>;
  56547. attribute DOMString <a href=#dom-table-summary id=other-elements,-attributes-and-apis:dom-table-summary>summary</a>;
  56548. attribute DOMString <a href=#dom-table-width id=other-elements,-attributes-and-apis:dom-table-width>width</a>;
  56549. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-bgcolor id=other-elements,-attributes-and-apis:dom-table-bgcolor>bgColor</a>;
  56550. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellpadding id=other-elements,-attributes-and-apis:dom-table-cellpadding>cellPadding</a>;
  56551. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellspacing id=other-elements,-attributes-and-apis:dom-table-cellspacing>cellSpacing</a>;
  56552. };</pre>
  56553. <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
  56554. must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-47>reflect</a> the respective content attributes of the same name.</p>
  56555. <p>The <dfn id=dom-table-bgcolor><code>bgColor</code></dfn> IDL attribute of the
  56556. <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>
  56557. <p>The <dfn id=dom-table-cellpadding><code>cellPadding</code></dfn> IDL attribute of the
  56558. <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>
  56559. <p>The <dfn id=dom-table-cellspacing><code>cellSpacing</code></dfn> IDL attribute of the
  56560. <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>
  56561. <hr>
  56562. <pre class=idl>partial interface <a href=#htmltablesectionelement id=HTMLTableSectionElement-partial>HTMLTableSectionElement</a> {
  56563. attribute DOMString <a href=#dom-tbody-align id=other-elements,-attributes-and-apis:dom-tbody-align>align</a>;
  56564. attribute DOMString <a href=#dom-tbody-ch id=other-elements,-attributes-and-apis:dom-tbody-ch>ch</a>;
  56565. attribute DOMString <a href=#dom-tbody-choff id=other-elements,-attributes-and-apis:dom-tbody-choff>chOff</a>;
  56566. attribute DOMString <a href=#dom-tbody-valign id=other-elements,-attributes-and-apis:dom-tbody-valign>vAlign</a>;
  56567. };</pre>
  56568. <p>The <dfn id=dom-tbody-align><code>align</code></dfn> IDL attribute of the
  56569. <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>
  56570. the content attribute of the same name.</p>
  56571. <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>,
  56572. <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>
  56573. <p>The <dfn id=dom-tbody-choff><code>chOff</code></dfn> IDL attribute of the
  56574. <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>
  56575. the elements' <code id=other-elements,-attributes-and-apis:attr-tbody-charoff><a href=#attr-tbody-charoff>charoff</a></code> content attributes.</p>
  56576. <p>The <dfn id=dom-tbody-valign><code>vAlign</code></dfn> IDL attribute of the
  56577. <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>
  56578. the elements' <code id=other-elements,-attributes-and-apis:attr-tbody-valign><a href=#attr-tbody-valign>valign</a></code> content attributes.</p>
  56579. <hr>
  56580. <pre class=idl>partial interface <a href=#htmltablecellelement id=HTMLTableCellElement-partial>HTMLTableCellElement</a> {
  56581. attribute DOMString <a href=#dom-tdth-align id=other-elements,-attributes-and-apis:dom-tdth-align>align</a>;
  56582. attribute DOMString <a href=#dom-tdth-axis id=other-elements,-attributes-and-apis:dom-tdth-axis>axis</a>;
  56583. attribute DOMString <a href=#dom-tdth-height id=other-elements,-attributes-and-apis:dom-tdth-height>height</a>;
  56584. attribute DOMString <a href=#dom-tdth-width id=other-elements,-attributes-and-apis:dom-tdth-width>width</a>;
  56585. attribute DOMString <a href=#dom-tdth-ch id=other-elements,-attributes-and-apis:dom-tdth-ch>ch</a>;
  56586. attribute DOMString <a href=#dom-tdth-choff id=other-elements,-attributes-and-apis:dom-tdth-choff>chOff</a>;
  56587. attribute boolean <a href=#dom-tdth-nowrap id=other-elements,-attributes-and-apis:dom-tdth-nowrap>noWrap</a>;
  56588. attribute DOMString <a href=#dom-tdth-valign id=other-elements,-attributes-and-apis:dom-tdth-valign>vAlign</a>;
  56589. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tdth-bgcolor id=other-elements,-attributes-and-apis:dom-tdth-bgcolor>bgColor</a>;
  56590. };</pre>
  56591. <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
  56592. <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
  56593. name.</p>
  56594. <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
  56595. <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>
  56596. <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>
  56597. 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>
  56598. <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>
  56599. 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>
  56600. <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>
  56601. 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>
  56602. <p>The <dfn id=dom-tdth-bgcolor><code>bgColor</code></dfn> IDL attribute of the
  56603. <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>
  56604. <hr>
  56605. <pre class=idl>partial interface <a href=#htmltabledatacellelement id=HTMLTableDataCellElement-partial>HTMLTableDataCellElement</a> {
  56606. attribute DOMString <a href=#dom-td-abbr id=other-elements,-attributes-and-apis:dom-td-abbr>abbr</a>;
  56607. };</pre>
  56608. <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>
  56609. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-61>reflect</a> the respective content attributes of the same name.</p>
  56610. <hr>
  56611. <pre class=idl>partial interface <a href=#htmltablerowelement id=HTMLTableRowElement-partial>HTMLTableRowElement</a> {
  56612. attribute DOMString <a href=#dom-tr-align id=other-elements,-attributes-and-apis:dom-tr-align>align</a>;
  56613. attribute DOMString <a href=#dom-tr-ch id=other-elements,-attributes-and-apis:dom-tr-ch>ch</a>;
  56614. attribute DOMString <a href=#dom-tr-choff id=other-elements,-attributes-and-apis:dom-tr-choff>chOff</a>;
  56615. attribute DOMString <a href=#dom-tr-valign id=other-elements,-attributes-and-apis:dom-tr-valign>vAlign</a>;
  56616. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tr-bgcolor id=other-elements,-attributes-and-apis:dom-tr-bgcolor>bgColor</a>;
  56617. };</pre>
  56618. <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>
  56619. element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-62>reflect</a> the content attribute of the same name.</p>
  56620. <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
  56621. 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
  56622. attribute.</p>
  56623. <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>
  56624. 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>
  56625. content attribute.</p>
  56626. <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>
  56627. 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
  56628. attribute.</p>
  56629. <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>
  56630. 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>
  56631. content attribute.</p>
  56632. <hr>
  56633. <pre class=idl>partial interface <a href=#htmlulistelement id=HTMLUListElement-partial>HTMLUListElement</a> {
  56634. attribute boolean <a href=#dom-ul-compact id=other-elements,-attributes-and-apis:dom-ul-compact>compact</a>;
  56635. attribute DOMString <a href=#dom-ul-type id=other-elements,-attributes-and-apis:dom-ul-type>type</a>;
  56636. };</pre>
  56637. <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
  56638. <a href=#reflect id=other-elements,-attributes-and-apis:reflect-67>reflect</a> the respective content attributes of the same name.</p>
  56639. <hr>
  56640. <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>
  56641. elements in terms of semantics and for purposes of rendering. (The parser has special behavior for
  56642. this element though.)</p>
  56643. <hr>
  56644. <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>,
  56645. <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
  56646. <code id=other-elements,-attributes-and-apis:htmlunknownelement><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface.</p>
  56647. <hr>
  56648. <pre class=idl>partial interface <a href=#document id=Document-partial>Document</a> {
  56649. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-fgcolor id=other-elements,-attributes-and-apis:dom-document-fgcolor>fgColor</a>;
  56650. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-linkcolor id=other-elements,-attributes-and-apis:dom-document-linkcolor>linkColor</a>;
  56651. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-vlinkcolor id=other-elements,-attributes-and-apis:dom-document-vlinkcolor>vlinkColor</a>;
  56652. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-alinkcolor id=other-elements,-attributes-and-apis:dom-document-alinkcolor>alinkColor</a>;
  56653. [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-bgcolor id=other-elements,-attributes-and-apis:dom-document-bgcolor>bgColor</a>;
  56654. 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>;
  56655. 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>;
  56656. void <a href=#dom-document-clear id=other-elements,-attributes-and-apis:dom-document-clear>clear</a>();
  56657. void <a href=#dom-document-captureevents id=other-elements,-attributes-and-apis:dom-document-captureevents>captureEvents</a>();
  56658. void <a href=#dom-document-releaseevents id=other-elements,-attributes-and-apis:dom-document-releaseevents>releaseEvents</a>();
  56659. 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>;
  56660. };</pre>
  56661. <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
  56662. 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
  56663. 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
  56664. 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).
  56665. 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
  56666. <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
  56667. do nothing on setting.</p>
  56668. <table><thead><tr><th> IDL attribute
  56669. <th> Content attribute
  56670. <tbody><tr><td><dfn id=dom-document-fgcolor><code>fgColor</code></dfn>
  56671. <td><code id=other-elements,-attributes-and-apis:attr-body-text-2><a href=#attr-body-text>text</a></code>
  56672. <tr><td><dfn id=dom-document-linkcolor><code>linkColor</code></dfn>
  56673. <td><code id=other-elements,-attributes-and-apis:attr-body-link-2><a href=#attr-body-link>link</a></code>
  56674. <tr><td><dfn id=dom-document-vlinkcolor><code>vlinkColor</code></dfn>
  56675. <td><code id=other-elements,-attributes-and-apis:attr-body-vlink-2><a href=#attr-body-vlink>vlink</a></code>
  56676. <tr><td><dfn id=dom-document-alinkcolor><code>alinkColor</code></dfn>
  56677. <td><code id=other-elements,-attributes-and-apis:attr-body-alink-2><a href=#attr-body-alink>alink</a></code>
  56678. <tr><td><dfn id=dom-document-bgcolor><code>bgColor</code></dfn>
  56679. <td><code id=other-elements,-attributes-and-apis:attr-body-bgcolor-2><a href=#attr-body-bgcolor>bgcolor</a></code>
  56680. </table>
  56681. <hr>
  56682. <p>The <dfn id=dom-document-anchors><code>anchors</code></dfn> attribute must return an
  56683. <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
  56684. <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>
  56685. <p>The <dfn id=dom-document-applets><code>applets</code></dfn> attribute must return an
  56686. <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
  56687. <code id=other-elements,-attributes-and-apis:the-applet-element><a href=#the-applet-element>applet</a></code> elements.</p>
  56688. <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>
  56689. <hr>
  56690. <p>The <dfn id=dom-document-all><code>all</code></dfn> attribute must return an
  56691. <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
  56692. elements.</p>
  56693. <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
  56694. behaviors:</p>
  56695. <ul><li><p>The user agent must act as if the ToBoolean() operator in JavaScript converts the object
  56696. 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
  56697. <code>null</code> values. (Comparisons using the <code>===</code> operator, and
  56698. 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
  56699. 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>
  56700. <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
  56701. specification current at the time of writing (ECMAScript edition 5). The JavaScript specification
  56702. requires that the ToBoolean() operator convert all objects to the true value, and does not have
  56703. provisions for objects acting as if they were <code>undefined</code> for the purposes of
  56704. certain operators. This violation is motivated by a desire for compatibility with two classes of
  56705. 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>
  56706. as a way to detect legacy user agents, and one that only supports those legacy user agents and
  56707. 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
  56708. presence first. <a href=#refsECMA262>[ECMA262]</a></p>
  56709. <hr>
  56710. <pre class=idl>partial interface <a href=#window id=Window-partial>Window</a> {
  56711. void <a href=#dom-window-captureevents id=other-elements,-attributes-and-apis:dom-window-captureevents>captureEvents</a>();
  56712. void <a href=#dom-window-releaseevents id=other-elements,-attributes-and-apis:dom-window-releaseevents>releaseEvents</a>();
  56713. };</pre>
  56714. <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>
  56715. <h2 id=iana>16 IANA considerations</h2>
  56716. <h3 id=text/html>16.1 <dfn><code>text/html</code></dfn></h3>
  56717. <p>This registration is for community review and will be submitted to the IESG for review,
  56718. approval, and registration with IANA.</p>
  56719. <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>html<dt>Required parameters:<dd>No required parameters<dt>Optional parameters:<dd>
  56720. <dl><dt><code>charset</code><dd>
  56721. <p>The <code>charset</code> parameter may be provided to specify the
  56722. <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
  56723. 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>
  56724. </dl>
  56725. <dt>Encoding considerations:<dd>
  56726. 8bit (see the section on <a href=#character-encoding-declaration id=text/html:character-encoding-declaration-2>character encoding
  56727. declarations</a>)
  56728. <dt>Security considerations:<dd>
  56729. <p>Entire novels have been written about the security considerations that apply to HTML
  56730. documents. Many are listed in this document, to which the reader is referred for more details.
  56731. Some general concerns bear mentioning here, however:</p>
  56732. <p>HTML is scripted language, and has a large number of APIs (some of which are described in
  56733. this document). Script can expose the user to potential risks of information leakage, credential
  56734. leakage, cross-site scripting attacks, cross-site request forgeries, and a host of other
  56735. problems. While the designs in this specification are intended to be safe if implemented
  56736. correctly, a full implementation is a massive undertaking and, as with any software, user agents
  56737. are likely to have security bugs.</p>
  56738. <p>Even without scripting, there are specific features in HTML which, for historical reasons,
  56739. are required for broad compatibility with legacy content but that expose the user to unfortunate
  56740. 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
  56741. some other features as a way to effect a port scan from the user's location on the Internet.
  56742. This can expose local network topologies that the attacker would otherwise not be able to
  56743. determine.</p>
  56744. <p>HTML relies on a compartmentalization scheme sometimes known as the <i>same-origin
  56745. 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
  56746. host, on the same port, using the same protocol.</p>
  56747. <p>It is critical, therefore, to ensure that any untrusted content that forms part of a site be
  56748. hosted on a different <a href=#origin-2 id=text/html:origin-2-2>origin</a> than any sensitive content on that site. Untrusted
  56749. content can easily spoof any other page on the same origin, read data from that origin, cause
  56750. scripts in that origin to execute, submit forms to and from that origin even if they are
  56751. protected from cross-site request forgery attacks by unique tokens, and make use of any
  56752. third-party resources exposed to or rights granted to that origin.</p>
  56753. <dt>Interoperability considerations:<dd>
  56754. Rules for processing both conforming and non-conforming content
  56755. are defined in this specification.
  56756. <dt>Published specification:<dd id=authors-using-html>
  56757. This document is the relevant specification. Labeling a resource
  56758. with the <code id=text/html:text/html><a href=#text/html>text/html</a></code> type asserts that the resource is
  56759. an <a href=#html-documents id=text/html:html-documents>HTML document</a> using
  56760. <a href=#syntax id=text/html:syntax>the HTML syntax</a>.
  56761. <dt>Applications that use this media type:<dd>
  56762. Web browsers, tools for processing Web content, HTML authoring
  56763. tools, search engines, validators.
  56764. <dt>Additional information:<dd>
  56765. <dl><dt>Magic number(s):<dd>No sequence of bytes can uniquely identify an HTML
  56766. document. More information on detecting HTML documents is
  56767. available in the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a><dt>File extension(s):<dd>"<code>html</code>" and "<code>htm</code>"
  56768. are commonly, but certainly not exclusively, used as the
  56769. extension for HTML documents.<dt>Macintosh file type code(s):<dd><code>TEXT</code></dl>
  56770. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56771. <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
  56772. indicated part of the document</a> or provide state information for in-page scripts.</p>
  56773. <h3 id=multipart/x-mixed-replace>16.2 <dfn><code>multipart/x-mixed-replace</code></dfn></h3>
  56774. <p>This registration is for community review and will be submitted to the IESG for review,
  56775. approval, and registration with IANA.</p>
  56776. <dl><dt>Type name:<dd>multipart<dt>Subtype name:<dd>x-mixed-replace<dt>Required parameters:<dd>
  56777. <ul class=brief><li><code>boundary</code> (defined in RFC2046) <a href=#refsRFC2046>[RFC2046]</a>
  56778. </ul>
  56779. <dt>Optional parameters:<dd>No optional parameters.<dt>Encoding considerations:<dd>binary<dt>Security considerations:<dd>
  56780. 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>
  56781. resource can be of any type, including types with non-trivial
  56782. security implications such as <code id=multipart/x-mixed-replace:text/html><a href=#text/html>text/html</a></code>.
  56783. <dt>Interoperability considerations:<dd>
  56784. None.
  56785. <dt>Published specification:<dd>
  56786. This specification describes processing rules for Web browsers.
  56787. 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>
  56788. <dt>Applications that use this media type:<dd>
  56789. This type is intended to be used in resources generated by Web servers, for consumption by Web browsers.
  56790. <dt>Additional information:<dd>
  56791. <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>
  56792. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56793. <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
  56794. body part as defined by the type used by that body part.</p>
  56795. <h3 id=application/xhtml+xml>16.3 <dfn><code>application/xhtml+xml</code></dfn></h3>
  56796. <p>This registration is for community review and will be submitted to the IESG for review,
  56797. approval, and registration with IANA.</p>
  56798. <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>
  56799. Labeling a resource with the <code id=application/xhtml+xml:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
  56800. type asserts that the resource is an XML document that likely has
  56801. a root element from the <a href=#html-namespace-2 id=application/xhtml+xml:html-namespace-2>HTML namespace</a>. Thus, the
  56802. relevant specifications are the XML specification, the Namespaces
  56803. in XML specification, and this specification. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a>
  56804. <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>
  56805. <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>"
  56806. are sometimes used as extensions for XML resources that have a
  56807. 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>
  56808. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56809. <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
  56810. 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>
  56811. <h3 id=application/x-www-form-urlencoded>16.4 <dfn><code>application/x-www-form-urlencoded</code></dfn></h3>
  56812. <p>This registration is for community review and will be submitted to the IESG for review,
  56813. approval, and registration with IANA.</p>
  56814. <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>
  56815. <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>
  56816. payload poses no security risks. However, as this type is usually
  56817. used as part of a form submission, all the risks that apply to
  56818. HTML forms need to be considered in the context of this type.</p>
  56819. <dt>Interoperability considerations:<dd>
  56820. Rules for generating and processing
  56821. <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
  56822. defined in this specification.
  56823. <dt>Published specification:<dd>
  56824. This document is the relevant specification.
  56825. 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>
  56826. 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.
  56827. <dt>Applications that use this media type:<dd>
  56828. Web browsers and servers.
  56829. <dt>Additional information:<dd>
  56830. <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>
  56831. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;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
  56832. submission payloads.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56833. <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>
  56834. type.</p>
  56835. <h3 id=text/cache-manifest>16.5 <dfn><code>text/cache-manifest</code></dfn></h3>
  56836. <p>This registration is for community review and will be submitted
  56837. to the IESG for review, approval, and registration with IANA.</p>
  56838. <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>cache-manifest<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
  56839. <dl><dt><code>charset</code><dd>
  56840. <p>The <code>charset</code> parameter may be provided. The parameter's value must be
  56841. "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
  56842. compatibility with legacy servers.</p>
  56843. </dl>
  56844. <dt>Encoding considerations:<dd>8bit (always UTF-8)<dt>Security considerations:<dd>
  56845. <p>Cache manifests themselves pose no immediate risk unless
  56846. sensitive information is included within the
  56847. manifest. Implementations, however, are required to follow
  56848. specific rules when populating a cache based on a cache manifest,
  56849. to ensure that certain origin-based restrictions are
  56850. honored. Failure to correctly implement these rules can result in
  56851. information leakage, cross-site scripting attacks, and the
  56852. like.</p>
  56853. <dt>Interoperability considerations:<dd>
  56854. Rules for processing both conforming and non-conforming content
  56855. are defined in this specification.
  56856. <dt>Published specification:<dd>
  56857. This document is the relevant specification.
  56858. <dt>Applications that use this media type:<dd>
  56859. Web browsers.
  56860. <dt>Additional information:<dd>
  56861. <dl><dt>Magic number(s):<dd>Cache manifests begin with the string "<code>CACHE
  56862. MANIFEST</code>", followed by either a U+0020 SPACE character, a
  56863. U+0009 CHARACTER TABULATION (tab) character, a U+000A LINE FEED
  56864. (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>
  56865. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56866. <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>
  56867. <h3 id=text/ping>16.6 <dfn><code>text/ping</code></dfn></h3>
  56868. <p>This registration is for community review and will be submitted to the IESG for review,
  56869. approval, and registration with IANA.</p>
  56870. <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>ping<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
  56871. <dl><dt><code>charset</code><dd>
  56872. <p>The <code>charset</code> parameter may be provided. The parameter's value must be
  56873. "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
  56874. compatibility with legacy servers.</p>
  56875. </dl>
  56876. <dt>Encoding considerations:<dd>Not applicable.<dt>Security considerations:<dd>
  56877. <p>If used exclusively in the fashion described in the context of
  56878. <a href=#hyperlink-auditing id=text/ping:hyperlink-auditing>hyperlink auditing</a>, this type introduces no new
  56879. security concerns.</p>
  56880. <dt>Interoperability considerations:<dd>
  56881. Rules applicable to this type are defined in this specification.
  56882. <dt>Published specification:<dd>
  56883. This document is the relevant specification.
  56884. <dt>Applications that use this media type:<dd>
  56885. Web browsers.
  56886. <dt>Additional information:<dd>
  56887. <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
  56888. 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>
  56889. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>Only intended for use with HTTP POST requests generated as part
  56890. 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 &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56891. <p>Fragment identifiers have no meaning with <code id=text/ping:text/ping-2><a href=#text/ping>text/ping</a></code> resources.</p>
  56892. <h3 id=application/microdata+json>16.7 <dfn><code>application/microdata+json</code></dfn></h3>
  56893. <p>This registration is for community review and will be submitted to the IESG for review,
  56894. approval, and registration with IANA.</p>
  56895. <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>
  56896. 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
  56897. 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
  56898. 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
  56899. of an array of either objects or strings, the objects being of the same form as the objects in
  56900. the aforementioned "<code>items</code>" entry. Thus, the relevant specifications are
  56901. the JSON specification and this specification. <a href=#refsJSON>[JSON]</a>
  56902. <dt>Applications that use this media type:<dd>
  56903. <p>Applications that transfer data intended for use with HTML's microdata feature, especially in
  56904. the context of drag-and-drop, are the primary application class for this type.</p>
  56905. <dt>Additional information:<dd>
  56906. <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>
  56907. <dt>Person &amp; email address to contact for further information:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
  56908. <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
  56909. 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
  56910. semantics at all). <a href=#refsJSON>[JSON]</a></p>
  56911. <h3 id=ping-from>16.8 <dfn><code>Ping-From</code></dfn></h3>
  56912. <p>This section describes a header for registration in the Permanent Message Header Field
  56913. Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
  56914. <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>
  56915. This document is the relevant specification.
  56916. <dt>Related information:<dd>None.</dl>
  56917. <h3 id=ping-to>16.9 <dfn><code>Ping-To</code></dfn></h3>
  56918. <p>This section describes a header for registration in the Permanent Message Header Field
  56919. Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
  56920. <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>
  56921. This document is the relevant specification.
  56922. <dt>Related information:<dd>None.</dl>
  56923. <h3 id=web+-scheme-prefix>16.10 <dfn><code>web+</code> scheme prefix</dfn></h3>
  56924. <p>This section describes a convention for use with the IANA URI scheme registry. It does not
  56925. itself register a specific scheme. <a href=#refsRFC4395>[RFC4395]</a></p>
  56926. <dl><dt>URI scheme name:<dd>
  56927. Schemes starting with the four characters "<code>web+</code>" followed by one or more letters in the range
  56928. <code>a</code>-<code>z</code>.
  56929. <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>
  56930. Any Web page is able to register a handler for all "<code>web+</code>" schemes. As
  56931. such, these schemes must not be used for features intended to be core platform features (e.g.
  56932. network transfer protocols like HTTP or FTP). Similarly, such schemes must not store
  56933. confidential information in their URLs, such as usernames, passwords, personal information, or
  56934. confidential project names.
  56935. <dt>Contact:<dd>Ian Hickson &lt;ian@hixie.ch><dt>Author/Change controller:<dd>Ian Hickson &lt;ian@hixie.ch><dt>References:<dd>
  56936. <cite>Custom scheme and content handlers</cite>, HTML Living Standard:
  56937. <a href=#custom-handlers>http://www.whatwg.org/specs/web-apps/current-work/#custom-handlers</a>
  56938. </dl>
  56939. <h2 id=index class=no-num>Index</h2>
  56940. <p>The following sections only cover conforming elements and features.</p>
  56941. <h3 id=elements-3 class=no-num>Elements</h3>
  56942. <p><i>This section is non-normative.</i></p>
  56943. <table><caption>List of elements</caption><thead><tr><th> Element
  56944. <th> Description
  56945. <th> Categories
  56946. <th> Parents†
  56947. <th> Children
  56948. <th> Attributes
  56949. <th> Interface
  56950. <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>;
  56951. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2>phrasing</a>*;
  56952. <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>;
  56953. <code id=elements-3:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
  56954. <code id=elements-3:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
  56955. <code id=elements-3:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>;
  56956. <code id=elements-3:ping><a href=#ping>ping</a></code>;
  56957. <code id=elements-3:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
  56958. <code id=elements-3:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
  56959. <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>;
  56960. <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>;
  56961. <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>;
  56962. <code id=elements-3:attr-area-alt><a href=#attr-area-alt>alt</a></code>;
  56963. <code id=elements-3:attr-area-coords><a href=#attr-area-coords>coords</a></code>;
  56964. <code id=elements-3:attr-area-shape><a href=#attr-area-shape>shape</a></code>;
  56965. <code id=elements-3:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code>;
  56966. <code id=elements-3:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code>;
  56967. <code id=elements-3:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code>;
  56968. <code id=elements-3:ping-2><a href=#ping>ping</a></code>;
  56969. <code id=elements-3:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>rel</a></code>;
  56970. <code id=elements-3:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
  56971. <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>;
  56972. <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>;
  56973. <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>;
  56974. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-8>phrasing</a>;
  56975. <a href=#embedded-content-category id=elements-3:embedded-content-category>embedded</a>;
  56976. <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>*;
  56977. <a href=#transparent id=elements-3:transparent-2>transparent</a>*<td><a href=#global-attributes id=elements-3:global-attributes-7>globals</a>;
  56978. <code id=elements-3:attr-media-src><a href=#attr-media-src>src</a></code>;
  56979. <code id=elements-3:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>;
  56980. <code id=elements-3:attr-media-preload><a href=#attr-media-preload>preload</a></code>;
  56981. <code id=elements-3:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
  56982. <code id=elements-3:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>;
  56983. <code id=elements-3:attr-media-loop><a href=#attr-media-loop>loop</a></code>;
  56984. <code id=elements-3:attr-media-muted><a href=#attr-media-muted>muted</a></code>;
  56985. <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>;
  56986. <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>;
  56987. <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>;
  56988. <code id=elements-3:attr-base-href><a href=#attr-base-href>href</a></code>;
  56989. <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>;
  56990. <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>;
  56991. <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>;
  56992. <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>;
  56993. <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>;
  56994. <code id=elements-3:handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code>;
  56995. <code id=elements-3:handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code>;
  56996. <code id=elements-3:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code>;
  56997. <code id=elements-3:handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code>;
  56998. <code id=elements-3:handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>onlanguagechange</a></code>;
  56999. <code id=elements-3:handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code>;
  57000. <code id=elements-3:handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code>;
  57001. <code id=elements-3:handler-window-ononline><a href=#handler-window-ononline>ononline</a></code>;
  57002. <code id=elements-3:handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code>;
  57003. <code id=elements-3:handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code>;
  57004. <code id=elements-3:handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code>;
  57005. <code id=elements-3:handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code>;
  57006. <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>;
  57007. <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>;
  57008. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-21>phrasing</a>;
  57009. <a href=#interactive-content-2 id=elements-3:interactive-content-2-3>interactive</a>;
  57010. <a href=#category-listed id=elements-3:category-listed>listed</a>;
  57011. <a href=#category-label id=elements-3:category-label>labelable</a>;
  57012. <a href=#category-submit id=elements-3:category-submit>submittable</a>;
  57013. <a href=#category-form-attr id=elements-3:category-form-attr>reassociateable</a>;
  57014. <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>;
  57015. <code id=elements-3:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
  57016. <code id=elements-3:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
  57017. <code id=elements-3:attr-fae-form><a href=#attr-fae-form>form</a></code>;
  57018. <code id=elements-3:attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
  57019. <code id=elements-3:attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
  57020. <code id=elements-3:attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
  57021. <code id=elements-3:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
  57022. <code id=elements-3:attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
  57023. <code id=elements-3:attr-button-menu><a href=#attr-button-menu>menu</a></code>;
  57024. <code id=elements-3:attr-fe-name><a href=#attr-fe-name>name</a></code>;
  57025. <code id=elements-3:attr-button-type><a href=#attr-button-type>type</a></code>;
  57026. <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>;
  57027. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-24>phrasing</a>;
  57028. <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>;
  57029. <code id=elements-3:attr-canvas-width><a href=#attr-canvas-width>width</a></code>;
  57030. <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>;
  57031. <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>;
  57032. <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>;
  57033. <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>;
  57034. <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>;
  57035. <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>;
  57036. <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>*;
  57037. <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>;
  57038. <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>;
  57039. <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>;
  57040. <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>;
  57041. <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>*;
  57042. <code id=elements-3:the-option-element><a href=#the-option-element>option</a></code>*;
  57043. <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>;
  57044. <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>;
  57045. <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>;
  57046. <code id=elements-3:attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
  57047. <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>;
  57048. <a href=#sectioning-root id=elements-3:sectioning-root-3>sectioning root</a>;
  57049. <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>*;
  57050. <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>;
  57051. <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>;
  57052. <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>;
  57053. <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>;
  57054. <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>*;
  57055. <code id=elements-3:the-dd-element-2><a href=#the-dd-element>dd</a></code>*;
  57056. <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>;
  57057. <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>;
  57058. <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>;
  57059. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-46>phrasing</a>;
  57060. <a href=#embedded-content-category id=elements-3:embedded-content-category-3>embedded</a>;
  57061. <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>;
  57062. <code id=elements-3:attr-embed-src><a href=#attr-embed-src>src</a></code>;
  57063. <code id=elements-3:attr-embed-type><a href=#attr-embed-type>type</a></code>;
  57064. <code id=elements-3:attr-dim-width><a href=#attr-dim-width>width</a></code>;
  57065. <code id=elements-3:attr-dim-height><a href=#attr-dim-height>height</a></code>;
  57066. 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>;
  57067. <a href=#sectioning-root id=elements-3:sectioning-root-5>sectioning root</a>;
  57068. <a href=#category-listed id=elements-3:category-listed-2>listed</a>;
  57069. <a href=#category-form-attr id=elements-3:category-form-attr-2>reassociateable</a>;
  57070. <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>*;
  57071. <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>;
  57072. <code id=elements-3:attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code>;
  57073. <code id=elements-3:attr-fae-form-2><a href=#attr-fae-form>form</a></code>;
  57074. <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>;
  57075. <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>;
  57076. <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>*;
  57077. <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>;
  57078. <code id=elements-3:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>;
  57079. <code id=elements-3:attr-fs-action><a href=#attr-fs-action>action</a></code>;
  57080. <code id=elements-3:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code>;
  57081. <code id=elements-3:attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>;
  57082. <code id=elements-3:attr-fs-method><a href=#attr-fs-method>method</a></code>;
  57083. <code id=elements-3:attr-form-name><a href=#attr-form-name>name</a></code>;
  57084. <code id=elements-3:attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>;
  57085. <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>;
  57086. <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>;
  57087. <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>;
  57088. <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>*;
  57089. <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>;
  57090. <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>;
  57091. <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>;
  57092. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-52>phrasing</a>;
  57093. <a href=#embedded-content-category id=elements-3:embedded-content-category-4>embedded</a>;
  57094. <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>;
  57095. <code id=elements-3:attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
  57096. <code id=elements-3:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
  57097. <code id=elements-3:attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
  57098. <code id=elements-3:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
  57099. <code id=elements-3:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
  57100. <code id=elements-3:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>;
  57101. <code id=elements-3:attr-dim-width-2><a href=#attr-dim-width>width</a></code>;
  57102. <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>;
  57103. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-54>phrasing</a>;
  57104. <a href=#embedded-content-category id=elements-3:embedded-content-category-5>embedded</a>;
  57105. <a href=#interactive-content-2 id=elements-3:interactive-content-2-7>interactive</a>*;
  57106. <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>;
  57107. <code id=elements-3:attr-img-alt><a href=#attr-img-alt>alt</a></code>;
  57108. <code id=elements-3:attr-img-src><a href=#attr-img-src>src</a></code>;
  57109. <code id=elements-3:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>;
  57110. <code id=elements-3:attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code>;
  57111. <code id=elements-3:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
  57112. <code id=elements-3:attr-img-ismap><a href=#attr-img-ismap>ismap</a></code>;
  57113. <code id=elements-3:attr-dim-width-3><a href=#attr-dim-width>width</a></code>;
  57114. <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>;
  57115. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-56>phrasing</a>;
  57116. <a href=#interactive-content-2 id=elements-3:interactive-content-2-8>interactive</a>*;
  57117. <a href=#category-listed id=elements-3:category-listed-3>listed</a>;
  57118. <a href=#category-label id=elements-3:category-label-2>labelable</a>;
  57119. <a href=#category-submit id=elements-3:category-submit-2>submittable</a>;
  57120. <a href=#category-reset id=elements-3:category-reset>resettable</a>;
  57121. <a href=#category-form-attr id=elements-3:category-form-attr-3>reassociateable</a>;
  57122. <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>;
  57123. <code id=elements-3:attr-input-accept><a href=#attr-input-accept>accept</a></code>;
  57124. <code id=elements-3:attr-input-alt><a href=#attr-input-alt>alt</a></code>;
  57125. <code id=elements-3:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>;
  57126. <code id=elements-3:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code>;
  57127. <code id=elements-3:attr-input-checked><a href=#attr-input-checked>checked</a></code>;
  57128. <code id=elements-3:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>;
  57129. <code id=elements-3:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code>;
  57130. <code id=elements-3:attr-fae-form-3><a href=#attr-fae-form>form</a></code>;
  57131. <code id=elements-3:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code>;
  57132. <code id=elements-3:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>;
  57133. <code id=elements-3:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code>;
  57134. <code id=elements-3:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
  57135. <code id=elements-3:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code>;
  57136. <code id=elements-3:attr-dim-height-4><a href=#attr-dim-height>height</a></code>;
  57137. <code id=elements-3:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>;
  57138. <code id=elements-3:attr-input-list-2><a href=#attr-input-list>list</a></code>;
  57139. <code id=elements-3:attr-input-max><a href=#attr-input-max>max</a></code>;
  57140. <code id=elements-3:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>;
  57141. <code id=elements-3:attr-input-min><a href=#attr-input-min>min</a></code>;
  57142. <code id=elements-3:attr-input-minlength><a href=#attr-input-minlength>minlength</a></code>;
  57143. <code id=elements-3:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>;
  57144. <code id=elements-3:attr-fe-name-3><a href=#attr-fe-name>name</a></code>;
  57145. <code id=elements-3:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>;
  57146. <code id=elements-3:attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>;
  57147. <code id=elements-3:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>;
  57148. <code id=elements-3:attr-input-required><a href=#attr-input-required>required</a></code>;
  57149. <code id=elements-3:attr-input-size><a href=#attr-input-size>size</a></code>;
  57150. <code id=elements-3:attr-input-src><a href=#attr-input-src>src</a></code>;
  57151. <code id=elements-3:attr-input-step><a href=#attr-input-step>step</a></code>;
  57152. <code id=elements-3:attr-input-type><a href=#attr-input-type>type</a></code>;
  57153. <code id=elements-3:attr-input-value><a href=#attr-input-value>value</a></code>;
  57154. <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>;
  57155. <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>;
  57156. <code id=elements-3:attr-mod-cite-2><a href=#attr-mod-cite>cite</a></code>;
  57157. <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>;
  57158. <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>;
  57159. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-63>phrasing</a>;
  57160. <a href=#interactive-content-2 id=elements-3:interactive-content-2-9>interactive</a>;
  57161. <a href=#category-listed id=elements-3:category-listed-4>listed</a>;
  57162. <a href=#category-label id=elements-3:category-label-3>labelable</a>;
  57163. <a href=#category-submit id=elements-3:category-submit-3>submittable</a>;
  57164. <a href=#category-reset id=elements-3:category-reset-2>resettable</a>;
  57165. <a href=#category-form-attr id=elements-3:category-form-attr-4>reassociateable</a>;
  57166. <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>;
  57167. <code id=elements-3:attr-fe-autofocus-3><a href=#attr-fe-autofocus>autofocus</a></code>;
  57168. <code id=elements-3:attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code>;
  57169. <code id=elements-3:attr-fe-disabled-3><a href=#attr-fe-disabled>disabled</a></code>;
  57170. <code id=elements-3:attr-fae-form-4><a href=#attr-fae-form>form</a></code>;
  57171. <code id=elements-3:attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>;
  57172. <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>;
  57173. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-65>phrasing</a>;
  57174. <a href=#interactive-content-2 id=elements-3:interactive-content-2-10>interactive</a>;
  57175. <a href=#category-form-attr id=elements-3:category-form-attr-5>reassociateable</a>;
  57176. <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>;
  57177. <code id=elements-3:attr-fae-form-5><a href=#attr-fae-form>form</a></code>;
  57178. <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>;
  57179. <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>;
  57180. <code id=elements-3:the-ul-element><a href=#the-ul-element>ul</a></code>;
  57181. <code id=elements-3:the-menu-element><a href=#the-menu-element>menu</a></code>*;
  57182. <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>;
  57183. <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>;
  57184. <a href=#flow-content-2 id=elements-3:flow-content-2-77>flow</a>*;
  57185. <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>;
  57186. <code id=elements-3:the-template-element-12><a href=#the-template-element>template</a></code>;
  57187. <code id=elements-3:the-noscript-element><a href=#the-noscript-element>noscript</a></code>*;
  57188. <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>;
  57189. <code id=elements-3:attr-link-href><a href=#attr-link-href>href</a></code>;
  57190. <code id=elements-3:attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code>;
  57191. <code id=elements-3:attr-link-rel><a href=#attr-link-rel>rel</a></code>;
  57192. <code id=elements-3:attr-link-media><a href=#attr-link-media>media</a></code>;
  57193. <code id=elements-3:attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code>;
  57194. <code id=elements-3:attr-link-type><a href=#attr-link-type>type</a></code>;
  57195. <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>;
  57196. <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>;
  57197. <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>;
  57198. <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>;
  57199. <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>;
  57200. <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>*;
  57201. <a href=#flow-content-2 id=elements-3:flow-content-2-85>flow</a>*;
  57202. <code id=elements-3:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>*;
  57203. <code id=elements-3:the-hr-element-2><a href=#the-hr-element>hr</a></code>*;
  57204. <code id=elements-3:the-menu-element-4><a href=#the-menu-element>menu</a></code>*;
  57205. <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>;
  57206. <code id=elements-3:attr-menu-type><a href=#attr-menu-type>type</a></code>;
  57207. <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>;
  57208. <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>;
  57209. <code id=elements-3:attr-menuitem-type><a href=#attr-menuitem-type>type</a></code>;
  57210. <code id=elements-3:attr-menuitem-label><a href=#attr-menuitem-label>label</a></code>;
  57211. <code id=elements-3:attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code>;
  57212. <code id=elements-3:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code>;
  57213. <code id=elements-3:attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>;
  57214. <code id=elements-3:attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>;
  57215. <code id=elements-3:attr-menuitem-default><a href=#attr-menuitem-default>default</a></code>;
  57216. <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>;
  57217. <a href=#flow-content-2 id=elements-3:flow-content-2-86>flow</a>*;
  57218. <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>;
  57219. <code id=elements-3:the-template-element-14><a href=#the-template-element>template</a></code>;
  57220. <code id=elements-3:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code>*;
  57221. <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>;
  57222. <code id=elements-3:attr-meta-name><a href=#attr-meta-name>name</a></code>;
  57223. <code id=elements-3:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>;
  57224. <code id=elements-3:attr-meta-content><a href=#attr-meta-content>content</a></code>;
  57225. <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>;
  57226. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-78>phrasing</a>;
  57227. <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>;
  57228. <code id=elements-3:attr-meter-value><a href=#attr-meter-value>value</a></code>;
  57229. <code id=elements-3:attr-meter-min><a href=#attr-meter-min>min</a></code>;
  57230. <code id=elements-3:attr-meter-max><a href=#attr-meter-max>max</a></code>;
  57231. <code id=elements-3:attr-meter-low><a href=#attr-meter-low>low</a></code>;
  57232. <code id=elements-3:attr-meter-high><a href=#attr-meter-high>high</a></code>;
  57233. <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>;
  57234. <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>;
  57235. <a href=#flow-content-2 id=elements-3:flow-content-2-91>flow</a>;
  57236. <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>*;
  57237. <code id=elements-3:the-template-element-15><a href=#the-template-element>template</a></code>*;
  57238. <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>;
  57239. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-83>phrasing</a>;
  57240. <a href=#embedded-content-category id=elements-3:embedded-content-category-6>embedded</a>;
  57241. <a href=#interactive-content-2 id=elements-3:interactive-content-2-11>interactive</a>*;
  57242. <a href=#category-listed id=elements-3:category-listed-5>listed</a>;
  57243. <a href=#category-submit id=elements-3:category-submit-4>submittable</a>;
  57244. <a href=#category-form-attr id=elements-3:category-form-attr-6>reassociateable</a>;
  57245. <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>*;
  57246. <a href=#transparent id=elements-3:transparent-7>transparent</a><td><a href=#global-attributes id=elements-3:global-attributes-65>globals</a>;
  57247. <code id=elements-3:attr-object-data><a href=#attr-object-data>data</a></code>;
  57248. <code id=elements-3:attr-object-type><a href=#attr-object-type>type</a></code>;
  57249. <code id=elements-3:attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code>;
  57250. <code id=elements-3:attr-object-name><a href=#attr-object-name>name</a></code>;
  57251. <code id=elements-3:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code>;
  57252. <code id=elements-3:attr-fae-form-6><a href=#attr-fae-form>form</a></code>;
  57253. <code id=elements-3:attr-dim-width-5><a href=#attr-dim-width>width</a></code>;
  57254. <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>;
  57255. <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>;
  57256. <code id=elements-3:attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code>;
  57257. <code id=elements-3:attr-ol-start><a href=#attr-ol-start>start</a></code>;
  57258. <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>;
  57259. <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>;
  57260. <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>;
  57261. <code id=elements-3:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code>;
  57262. <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>;
  57263. <code id=elements-3:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code>;
  57264. <code id=elements-3:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code>;
  57265. <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>;
  57266. <code id=elements-3:attr-option-disabled><a href=#attr-option-disabled>disabled</a></code>;
  57267. <code id=elements-3:attr-option-label><a href=#attr-option-label>label</a></code>;
  57268. <code id=elements-3:attr-option-selected><a href=#attr-option-selected>selected</a></code>;
  57269. <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>;
  57270. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-85>phrasing</a>;
  57271. <a href=#category-listed id=elements-3:category-listed-6>listed</a>;
  57272. <a href=#category-label id=elements-3:category-label-5>labelable</a>;
  57273. <a href=#category-reset id=elements-3:category-reset-3>resettable</a>;
  57274. <a href=#category-form-attr id=elements-3:category-form-attr-7>reassociateable</a>;
  57275. <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>;
  57276. <code id=elements-3:attr-output-for><a href=#attr-output-for>for</a></code>;
  57277. <code id=elements-3:attr-fae-form-7><a href=#attr-fae-form>form</a></code>;
  57278. <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>;
  57279. <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>;
  57280. <code id=elements-3:attr-param-name><a href=#attr-param-name>name</a></code>;
  57281. <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>;
  57282. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-90>phrasing</a>;
  57283. <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>;
  57284. <code id=elements-3:attr-progress-value><a href=#attr-progress-value>value</a></code>;
  57285. <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>;
  57286. <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>;
  57287. <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>;
  57288. <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>;
  57289. <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>;
  57290. <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>;
  57291. <code id=elements-3:the-rt-element-2><a href=#the-rt-element>rt</a></code>;
  57292. <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>;
  57293. <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>;
  57294. <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>;
  57295. <a href=#flow-content-2 id=elements-3:flow-content-2-105>flow</a>;
  57296. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-107>phrasing</a>;
  57297. <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>;
  57298. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-108>phrasing</a>;
  57299. <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>;
  57300. <code id=elements-3:attr-script-src><a href=#attr-script-src>src</a></code>;
  57301. <code id=elements-3:attr-script-type><a href=#attr-script-type>type</a></code>;
  57302. <code id=elements-3:attr-script-charset><a href=#attr-script-charset>charset</a></code>;
  57303. <code id=elements-3:attr-script-async><a href=#attr-script-async>async</a></code>;
  57304. <code id=elements-3:attr-script-defer><a href=#attr-script-defer>defer</a></code>;
  57305. <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>;
  57306. <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>;
  57307. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-109>phrasing</a>;
  57308. <a href=#interactive-content-2 id=elements-3:interactive-content-2-12>interactive</a>;
  57309. <a href=#category-listed id=elements-3:category-listed-7>listed</a>;
  57310. <a href=#category-label id=elements-3:category-label-7>labelable</a>;
  57311. <a href=#category-submit id=elements-3:category-submit-5>submittable</a>;
  57312. <a href=#category-reset id=elements-3:category-reset-4>resettable</a>;
  57313. <a href=#category-form-attr id=elements-3:category-form-attr-8>reassociateable</a>;
  57314. <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>;
  57315. <code id=elements-3:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code>;
  57316. <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>;
  57317. <code id=elements-3:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code>;
  57318. <code id=elements-3:attr-fe-autofocus-4><a href=#attr-fe-autofocus>autofocus</a></code>;
  57319. <code id=elements-3:attr-fe-disabled-4><a href=#attr-fe-disabled>disabled</a></code>;
  57320. <code id=elements-3:attr-fae-form-8><a href=#attr-fae-form>form</a></code>;
  57321. <code id=elements-3:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>;
  57322. <code id=elements-3:attr-fe-name-6><a href=#attr-fe-name>name</a></code>;
  57323. <code id=elements-3:attr-select-required><a href=#attr-select-required>required</a></code>;
  57324. <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>;
  57325. <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>;
  57326. <code id=elements-3:the-audio-element-3><a href=#the-audio-element>audio</a></code>;
  57327. <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>;
  57328. <code id=elements-3:attr-source-src><a href=#attr-source-src>src</a></code>;
  57329. <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>;
  57330. <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>;
  57331. <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>;
  57332. <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>;
  57333. <code id=elements-3:the-noscript-element-4><a href=#the-noscript-element>noscript</a></code>*;
  57334. <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>;
  57335. <code id=elements-3:attr-style-media><a href=#attr-style-media>media</a></code>;
  57336. <code id=elements-3:attr-style-type><a href=#attr-style-type>type</a></code>;
  57337. <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>;
  57338. <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>;
  57339. <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>*;
  57340. <code id=elements-3:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code>*;
  57341. <code id=elements-3:the-thead-element><a href=#the-thead-element>thead</a></code>*;
  57342. <code id=elements-3:the-tbody-element><a href=#the-tbody-element>tbody</a></code>*;
  57343. <code id=elements-3:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>*;
  57344. <code id=elements-3:the-tr-element><a href=#the-tr-element>tr</a></code>*;
  57345. <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>;
  57346. <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>;
  57347. <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>;
  57348. <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>;
  57349. <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>;
  57350. <code id=elements-3:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
  57351. <code id=elements-3:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
  57352. <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>;
  57353. <a href=#flow-content-2 id=elements-3:flow-content-2-120>flow</a>;
  57354. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-127>phrasing</a>;
  57355. <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>;
  57356. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-128>phrasing</a>;
  57357. <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-12>script-supporting</a>;
  57358. <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>;
  57359. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-129>phrasing</a>;
  57360. <a href=#interactive-content-2 id=elements-3:interactive-content-2-13>interactive</a>;
  57361. <a href=#category-listed id=elements-3:category-listed-8>listed</a>;
  57362. <a href=#category-label id=elements-3:category-label-8>labelable</a>;
  57363. <a href=#category-submit id=elements-3:category-submit-6>submittable</a>;
  57364. <a href=#category-reset id=elements-3:category-reset-5>resettable</a>;
  57365. <a href=#category-form-attr id=elements-3:category-form-attr-9>reassociateable</a>;
  57366. <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>;
  57367. <code id=elements-3:attr-fe-autofocus-5><a href=#attr-fe-autofocus>autofocus</a></code>;
  57368. <code id=elements-3:attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>;
  57369. <code id=elements-3:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code>;
  57370. <code id=elements-3:attr-fe-disabled-5><a href=#attr-fe-disabled>disabled</a></code>;
  57371. <code id=elements-3:attr-fae-form-9><a href=#attr-fae-form>form</a></code>;
  57372. <code id=elements-3:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code>;
  57373. <code id=elements-3:attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>;
  57374. <code id=elements-3:attr-textarea-minlength><a href=#attr-textarea-minlength>minlength</a></code>;
  57375. <code id=elements-3:attr-fe-name-7><a href=#attr-fe-name>name</a></code>;
  57376. <code id=elements-3:attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>;
  57377. <code id=elements-3:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code>;
  57378. <code id=elements-3:attr-textarea-required><a href=#attr-textarea-required>required</a></code>;
  57379. <code id=elements-3:attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>;
  57380. <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>;
  57381. <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>;
  57382. <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>;
  57383. <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>;
  57384. <code id=elements-3:attr-tdth-colspan-2><a href=#attr-tdth-colspan>colspan</a></code>;
  57385. <code id=elements-3:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>rowspan</a></code>;
  57386. <code id=elements-3:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code>;
  57387. <code id=elements-3:attr-th-scope><a href=#attr-th-scope>scope</a></code>;
  57388. <code id=elements-3:attr-th-sorted><a href=#attr-th-sorted>sorted</a></code>;
  57389. <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>;
  57390. <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>;
  57391. <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>;
  57392. <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>;
  57393. <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>;
  57394. <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>;
  57395. <code id=elements-3:the-thead-element-3><a href=#the-thead-element>thead</a></code>;
  57396. <code id=elements-3:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>;
  57397. <code id=elements-3:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code>;
  57398. <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>*;
  57399. <code id=elements-3:the-td-element-2><a href=#the-td-element>td</a></code>;
  57400. <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>;
  57401. <code id=elements-3:the-video-element-3><a href=#the-video-element>video</a></code>;
  57402. <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>;
  57403. <code id=elements-3:attr-track-default><a href=#attr-track-default>default</a></code>;
  57404. <code id=elements-3:attr-track-kind><a href=#attr-track-kind>kind</a></code>;
  57405. <code id=elements-3:attr-track-label><a href=#attr-track-label>label</a></code>;
  57406. <code id=elements-3:attr-track-src><a href=#attr-track-src>src</a></code>;
  57407. <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>;
  57408. <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>;
  57409. <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>;
  57410. <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>;
  57411. <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-140>phrasing</a>;
  57412. <a href=#embedded-content-category id=elements-3:embedded-content-category-7>embedded</a>;
  57413. <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>*;
  57414. <a href=#transparent id=elements-3:transparent-8>transparent</a>*<td><a href=#global-attributes id=elements-3:global-attributes-106>globals</a>;
  57415. <code id=elements-3:attr-media-src-2><a href=#attr-media-src>src</a></code>;
  57416. <code id=elements-3:attr-media-crossorigin-2><a href=#attr-media-crossorigin>crossorigin</a></code>;
  57417. <code id=elements-3:attr-video-poster><a href=#attr-video-poster>poster</a></code>;
  57418. <code id=elements-3:attr-media-preload-2><a href=#attr-media-preload>preload</a></code>;
  57419. <code id=elements-3:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code>;
  57420. <code id=elements-3:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code>;
  57421. <code id=elements-3:attr-media-loop-2><a href=#attr-media-loop>loop</a></code>;
  57422. <code id=elements-3:attr-media-muted-2><a href=#attr-media-muted>muted</a></code>;
  57423. <code id=elements-3:attr-media-controls-2><a href=#attr-media-controls>controls</a></code>;
  57424. <code id=elements-3:attr-dim-width-6><a href=#attr-dim-width>width</a></code>;
  57425. <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>;
  57426. <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>
  57427. <p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
  57428. complicated than indicated in the table above.</small></p>
  57429. <p class=tablenote><small>† Categories in the "Parents" column refer to parents that list
  57430. the given categories in their content model, not to elements that themselves are in those
  57431. 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
  57432. element whose content model contains the "phrasing" category could be a parent of an
  57433. <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
  57434. 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>
  57435. <h3 id=element-content-categories class=no-num>Element content categories</h3>
  57436. <p><i>This section is non-normative.</i></p>
  57437. <table><caption>List of element content categories</caption><thead><tr><th> Category
  57438. <th> Elements
  57439. <th> Elements with exceptions
  57440. <tbody><tr><td> <a href=#metadata-content-2 id=element-content-categories:metadata-content-2>Metadata content</a>
  57441. <td>
  57442. <code id=element-content-categories:the-base-element><a href=#the-base-element>base</a></code>;
  57443. <code id=element-content-categories:the-link-element><a href=#the-link-element>link</a></code>;
  57444. <code id=element-content-categories:the-meta-element><a href=#the-meta-element>meta</a></code>;
  57445. <code id=element-content-categories:the-noscript-element><a href=#the-noscript-element>noscript</a></code>;
  57446. <code id=element-content-categories:the-script-element><a href=#the-script-element>script</a></code>;
  57447. <code id=element-content-categories:the-style-element><a href=#the-style-element>style</a></code>;
  57448. <code id=element-content-categories:the-template-element><a href=#the-template-element>template</a></code>;
  57449. <code id=element-content-categories:the-title-element><a href=#the-title-element>title</a></code>
  57450. <td>
  57451. <tr><td> <a href=#flow-content-2 id=element-content-categories:flow-content-2>Flow content</a>
  57452. <td>
  57453. <code id=element-content-categories:the-a-element><a href=#the-a-element>a</a></code>;
  57454. <code id=element-content-categories:the-abbr-element><a href=#the-abbr-element>abbr</a></code>;
  57455. <code id=element-content-categories:the-address-element><a href=#the-address-element>address</a></code>;
  57456. <code id=element-content-categories:the-article-element><a href=#the-article-element>article</a></code>;
  57457. <code id=element-content-categories:the-aside-element><a href=#the-aside-element>aside</a></code>;
  57458. <code id=element-content-categories:the-audio-element><a href=#the-audio-element>audio</a></code>;
  57459. <code id=element-content-categories:the-b-element><a href=#the-b-element>b</a></code>;
  57460. <code id=element-content-categories:the-bdi-element><a href=#the-bdi-element>bdi</a></code>;
  57461. <code id=element-content-categories:the-bdo-element><a href=#the-bdo-element>bdo</a></code>;
  57462. <code id=element-content-categories:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>;
  57463. <code id=element-content-categories:the-br-element><a href=#the-br-element>br</a></code>;
  57464. <code id=element-content-categories:the-button-element><a href=#the-button-element>button</a></code>;
  57465. <code id=element-content-categories:the-canvas-element><a href=#the-canvas-element>canvas</a></code>;
  57466. <code id=element-content-categories:the-cite-element><a href=#the-cite-element>cite</a></code>;
  57467. <code id=element-content-categories:the-code-element><a href=#the-code-element>code</a></code>;
  57468. <code id=element-content-categories:the-data-element><a href=#the-data-element>data</a></code>;
  57469. <code id=element-content-categories:the-datalist-element><a href=#the-datalist-element>datalist</a></code>;
  57470. <code id=element-content-categories:the-del-element><a href=#the-del-element>del</a></code>;
  57471. <code id=element-content-categories:the-details-element><a href=#the-details-element>details</a></code>;
  57472. <code id=element-content-categories:the-dfn-element><a href=#the-dfn-element>dfn</a></code>;
  57473. <code id=element-content-categories:the-dialog-element><a href=#the-dialog-element>dialog</a></code>;
  57474. <code id=element-content-categories:the-div-element><a href=#the-div-element>div</a></code>;
  57475. <code id=element-content-categories:the-dl-element><a href=#the-dl-element>dl</a></code>;
  57476. <code id=element-content-categories:the-em-element><a href=#the-em-element>em</a></code>;
  57477. <code id=element-content-categories:the-embed-element><a href=#the-embed-element>embed</a></code>;
  57478. <code id=element-content-categories:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>;
  57479. <code id=element-content-categories:the-figure-element><a href=#the-figure-element>figure</a></code>;
  57480. <code id=element-content-categories:the-footer-element><a href=#the-footer-element>footer</a></code>;
  57481. <code id=element-content-categories:the-form-element><a href=#the-form-element>form</a></code>;
  57482. <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>;
  57483. <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>;
  57484. <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>;
  57485. <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>;
  57486. <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>;
  57487. <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>;
  57488. <code id=element-content-categories:the-header-element><a href=#the-header-element>header</a></code>;
  57489. <code id=element-content-categories:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>;
  57490. <code id=element-content-categories:the-hr-element><a href=#the-hr-element>hr</a></code>;
  57491. <code id=element-content-categories:the-i-element><a href=#the-i-element>i</a></code>;
  57492. <code id=element-content-categories:the-iframe-element><a href=#the-iframe-element>iframe</a></code>;
  57493. <code id=element-content-categories:the-img-element><a href=#the-img-element>img</a></code>;
  57494. <code id=element-content-categories:the-input-element><a href=#the-input-element>input</a></code>;
  57495. <code id=element-content-categories:the-ins-element><a href=#the-ins-element>ins</a></code>;
  57496. <code id=element-content-categories:the-kbd-element><a href=#the-kbd-element>kbd</a></code>;
  57497. <code id=element-content-categories:the-keygen-element><a href=#the-keygen-element>keygen</a></code>;
  57498. <code id=element-content-categories:the-label-element><a href=#the-label-element>label</a></code>;
  57499. <code id=element-content-categories:the-main-element><a href=#the-main-element>main</a></code>;
  57500. <code id=element-content-categories:the-map-element><a href=#the-map-element>map</a></code>;
  57501. <code id=element-content-categories:the-mark-element><a href=#the-mark-element>mark</a></code>;
  57502. <code id=element-content-categories:math><a href=#math>math</a></code>;
  57503. <code id=element-content-categories:the-menu-element><a href=#the-menu-element>menu</a></code>;
  57504. <code id=element-content-categories:the-meter-element><a href=#the-meter-element>meter</a></code>;
  57505. <code id=element-content-categories:the-nav-element><a href=#the-nav-element>nav</a></code>;
  57506. <code id=element-content-categories:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code>;
  57507. <code id=element-content-categories:the-object-element><a href=#the-object-element>object</a></code>;
  57508. <code id=element-content-categories:the-ol-element><a href=#the-ol-element>ol</a></code>;
  57509. <code id=element-content-categories:the-output-element><a href=#the-output-element>output</a></code>;
  57510. <code id=element-content-categories:the-p-element><a href=#the-p-element>p</a></code>;
  57511. <code id=element-content-categories:the-pre-element><a href=#the-pre-element>pre</a></code>;
  57512. <code id=element-content-categories:the-progress-element><a href=#the-progress-element>progress</a></code>;
  57513. <code id=element-content-categories:the-q-element><a href=#the-q-element>q</a></code>;
  57514. <code id=element-content-categories:the-ruby-element><a href=#the-ruby-element>ruby</a></code>;
  57515. <code id=element-content-categories:the-s-element><a href=#the-s-element>s</a></code>;
  57516. <code id=element-content-categories:the-samp-element><a href=#the-samp-element>samp</a></code>;
  57517. <code id=element-content-categories:the-script-element-2><a href=#the-script-element>script</a></code>;
  57518. <code id=element-content-categories:the-section-element><a href=#the-section-element>section</a></code>;
  57519. <code id=element-content-categories:the-select-element><a href=#the-select-element>select</a></code>;
  57520. <code id=element-content-categories:the-small-element><a href=#the-small-element>small</a></code>;
  57521. <code id=element-content-categories:the-span-element><a href=#the-span-element>span</a></code>;
  57522. <code id=element-content-categories:the-strong-element><a href=#the-strong-element>strong</a></code>;
  57523. <code id=element-content-categories:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>;
  57524. <code id=element-content-categories:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>;
  57525. <code id=element-content-categories:svg-2><a href=#svg-2>svg</a></code>;
  57526. <code id=element-content-categories:the-table-element><a href=#the-table-element>table</a></code>;
  57527. <code id=element-content-categories:the-template-element-2><a href=#the-template-element>template</a></code>;
  57528. <code id=element-content-categories:the-textarea-element><a href=#the-textarea-element>textarea</a></code>;
  57529. <code id=element-content-categories:the-time-element><a href=#the-time-element>time</a></code>;
  57530. <code id=element-content-categories:the-u-element><a href=#the-u-element>u</a></code>;
  57531. <code id=element-content-categories:the-ul-element><a href=#the-ul-element>ul</a></code>;
  57532. <code id=element-content-categories:the-var-element><a href=#the-var-element>var</a></code>;
  57533. <code id=element-content-categories:the-video-element><a href=#the-video-element>video</a></code>;
  57534. <code id=element-content-categories:the-wbr-element><a href=#the-wbr-element>wbr</a></code>;
  57535. <a href=#text-content id=element-content-categories:text-content>Text</a>
  57536. <td>
  57537. <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);
  57538. <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);
  57539. <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);
  57540. <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)
  57541. <tr><td> <a href=#sectioning-content-2 id=element-content-categories:sectioning-content-2>Sectioning content</a>
  57542. <td>
  57543. <code id=element-content-categories:the-article-element-2><a href=#the-article-element>article</a></code>;
  57544. <code id=element-content-categories:the-aside-element-2><a href=#the-aside-element>aside</a></code>;
  57545. <code id=element-content-categories:the-nav-element-2><a href=#the-nav-element>nav</a></code>;
  57546. <code id=element-content-categories:the-section-element-2><a href=#the-section-element>section</a></code>
  57547. <td>
  57548. <tr><td> <a href=#heading-content-2 id=element-content-categories:heading-content-2>Heading content</a>
  57549. <td>
  57550. <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>;
  57551. <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>;
  57552. <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>;
  57553. <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>;
  57554. <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>;
  57555. <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>;
  57556. <code id=element-content-categories:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code>
  57557. <td>
  57558. <tr><td> <a href=#phrasing-content-2 id=element-content-categories:phrasing-content-2>Phrasing content</a>
  57559. <td>
  57560. <code id=element-content-categories:the-a-element-2><a href=#the-a-element>a</a></code>;
  57561. <code id=element-content-categories:the-abbr-element-2><a href=#the-abbr-element>abbr</a></code>;
  57562. <code id=element-content-categories:the-audio-element-2><a href=#the-audio-element>audio</a></code>;
  57563. <code id=element-content-categories:the-b-element-2><a href=#the-b-element>b</a></code>;
  57564. <code id=element-content-categories:the-bdi-element-2><a href=#the-bdi-element>bdi</a></code>;
  57565. <code id=element-content-categories:the-bdo-element-2><a href=#the-bdo-element>bdo</a></code>;
  57566. <code id=element-content-categories:the-br-element-2><a href=#the-br-element>br</a></code>;
  57567. <code id=element-content-categories:the-button-element-2><a href=#the-button-element>button</a></code>;
  57568. <code id=element-content-categories:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code>;
  57569. <code id=element-content-categories:the-cite-element-2><a href=#the-cite-element>cite</a></code>;
  57570. <code id=element-content-categories:the-code-element-2><a href=#the-code-element>code</a></code>;
  57571. <code id=element-content-categories:the-data-element-2><a href=#the-data-element>data</a></code>;
  57572. <code id=element-content-categories:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code>;
  57573. <code id=element-content-categories:the-del-element-2><a href=#the-del-element>del</a></code>;
  57574. <code id=element-content-categories:the-dfn-element-2><a href=#the-dfn-element>dfn</a></code>;
  57575. <code id=element-content-categories:the-em-element-2><a href=#the-em-element>em</a></code>;
  57576. <code id=element-content-categories:the-embed-element-2><a href=#the-embed-element>embed</a></code>;
  57577. <code id=element-content-categories:the-i-element-2><a href=#the-i-element>i</a></code>;
  57578. <code id=element-content-categories:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>;
  57579. <code id=element-content-categories:the-img-element-2><a href=#the-img-element>img</a></code>;
  57580. <code id=element-content-categories:the-input-element-2><a href=#the-input-element>input</a></code>;
  57581. <code id=element-content-categories:the-ins-element-2><a href=#the-ins-element>ins</a></code>;
  57582. <code id=element-content-categories:the-kbd-element-2><a href=#the-kbd-element>kbd</a></code>;
  57583. <code id=element-content-categories:the-keygen-element-2><a href=#the-keygen-element>keygen</a></code>;
  57584. <code id=element-content-categories:the-label-element-2><a href=#the-label-element>label</a></code>;
  57585. <code id=element-content-categories:the-map-element-3><a href=#the-map-element>map</a></code>;
  57586. <code id=element-content-categories:the-mark-element-2><a href=#the-mark-element>mark</a></code>;
  57587. <code id=element-content-categories:math-2><a href=#math>math</a></code>;
  57588. <code id=element-content-categories:the-meter-element-2><a href=#the-meter-element>meter</a></code>;
  57589. <code id=element-content-categories:the-noscript-element-3><a href=#the-noscript-element>noscript</a></code>;
  57590. <code id=element-content-categories:the-object-element-2><a href=#the-object-element>object</a></code>;
  57591. <code id=element-content-categories:the-output-element-2><a href=#the-output-element>output</a></code>;
  57592. <code id=element-content-categories:the-progress-element-2><a href=#the-progress-element>progress</a></code>;
  57593. <code id=element-content-categories:the-q-element-2><a href=#the-q-element>q</a></code>;
  57594. <code id=element-content-categories:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code>;
  57595. <code id=element-content-categories:the-s-element-2><a href=#the-s-element>s</a></code>;
  57596. <code id=element-content-categories:the-samp-element-2><a href=#the-samp-element>samp</a></code>;
  57597. <code id=element-content-categories:the-script-element-3><a href=#the-script-element>script</a></code>;
  57598. <code id=element-content-categories:the-select-element-2><a href=#the-select-element>select</a></code>;
  57599. <code id=element-content-categories:the-small-element-2><a href=#the-small-element>small</a></code>;
  57600. <code id=element-content-categories:the-span-element-2><a href=#the-span-element>span</a></code>;
  57601. <code id=element-content-categories:the-strong-element-2><a href=#the-strong-element>strong</a></code>;
  57602. <code id=element-content-categories:the-sub-and-sup-elements-3><a href=#the-sub-and-sup-elements>sub</a></code>;
  57603. <code id=element-content-categories:the-sub-and-sup-elements-4><a href=#the-sub-and-sup-elements>sup</a></code>;
  57604. <code id=element-content-categories:svg-2-2><a href=#svg-2>svg</a></code>;
  57605. <code id=element-content-categories:the-template-element-3><a href=#the-template-element>template</a></code>;
  57606. <code id=element-content-categories:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>;
  57607. <code id=element-content-categories:the-time-element-2><a href=#the-time-element>time</a></code>;
  57608. <code id=element-content-categories:the-u-element-2><a href=#the-u-element>u</a></code>;
  57609. <code id=element-content-categories:the-var-element-2><a href=#the-var-element>var</a></code>;
  57610. <code id=element-content-categories:the-video-element-2><a href=#the-video-element>video</a></code>;
  57611. <code id=element-content-categories:the-wbr-element-2><a href=#the-wbr-element>wbr</a></code>;
  57612. <a href=#text-content id=element-content-categories:text-content-2>Text</a>
  57613. <td>
  57614. <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);
  57615. <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);
  57616. <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)
  57617. <tr><td> <a href=#embedded-content-category id=element-content-categories:embedded-content-category>Embedded content</a>
  57618. <td>
  57619. <code id=element-content-categories:the-audio-element-3><a href=#the-audio-element>audio</a></code>;
  57620. <code id=element-content-categories:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code>;
  57621. <code id=element-content-categories:the-embed-element-3><a href=#the-embed-element>embed</a></code>;
  57622. <code id=element-content-categories:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>;
  57623. <code id=element-content-categories:the-img-element-3><a href=#the-img-element>img</a></code>;
  57624. <code id=element-content-categories:math-3><a href=#math>math</a></code>;
  57625. <code id=element-content-categories:the-object-element-3><a href=#the-object-element>object</a></code>;
  57626. <code id=element-content-categories:svg-2-3><a href=#svg-2>svg</a></code>;
  57627. <code id=element-content-categories:the-video-element-3><a href=#the-video-element>video</a></code>
  57628. <td>
  57629. <tr><td> <a href=#interactive-content-2 id=element-content-categories:interactive-content-2>Interactive content</a>*
  57630. <td>
  57631. <code id=element-content-categories:the-a-element-3><a href=#the-a-element>a</a></code>;
  57632. <code id=element-content-categories:the-button-element-3><a href=#the-button-element>button</a></code>;
  57633. <code id=element-content-categories:the-details-element-2><a href=#the-details-element>details</a></code>;
  57634. <code id=element-content-categories:the-embed-element-4><a href=#the-embed-element>embed</a></code>;
  57635. <code id=element-content-categories:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>;
  57636. <code id=element-content-categories:the-keygen-element-3><a href=#the-keygen-element>keygen</a></code>;
  57637. <code id=element-content-categories:the-label-element-3><a href=#the-label-element>label</a></code>;
  57638. <code id=element-content-categories:the-select-element-3><a href=#the-select-element>select</a></code>;
  57639. <code id=element-content-categories:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code>
  57640. <td>
  57641. <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);
  57642. <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);
  57643. <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);
  57644. <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);
  57645. <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>)
  57646. <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)
  57647. <tr><td> <a href=#sectioning-root id=element-content-categories:sectioning-root>Sectioning roots</a>
  57648. <td>
  57649. <code id=element-content-categories:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code>;
  57650. <code id=element-content-categories:the-body-element><a href=#the-body-element>body</a></code>;
  57651. <code id=element-content-categories:the-details-element-3><a href=#the-details-element>details</a></code>;
  57652. <code id=element-content-categories:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code>;
  57653. <code id=element-content-categories:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code>;
  57654. <code id=element-content-categories:the-figure-element-2><a href=#the-figure-element>figure</a></code>;
  57655. <code id=element-content-categories:the-td-element><a href=#the-td-element>td</a></code>
  57656. <td>
  57657. <tr><td> <a href=#form-associated-element id=element-content-categories:form-associated-element>Form-associated elements</a>
  57658. <td>
  57659. <code id=element-content-categories:the-button-element-4><a href=#the-button-element>button</a></code>;
  57660. <code id=element-content-categories:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code>;
  57661. <code id=element-content-categories:the-input-element-4><a href=#the-input-element>input</a></code>;
  57662. <code id=element-content-categories:the-keygen-element-4><a href=#the-keygen-element>keygen</a></code>;
  57663. <code id=element-content-categories:the-label-element-4><a href=#the-label-element>label</a></code>;
  57664. <code id=element-content-categories:the-object-element-5><a href=#the-object-element>object</a></code>;
  57665. <code id=element-content-categories:the-output-element-3><a href=#the-output-element>output</a></code>;
  57666. <code id=element-content-categories:the-select-element-4><a href=#the-select-element>select</a></code>;
  57667. <code id=element-content-categories:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code>;
  57668. <code id=element-content-categories:the-img-element-5><a href=#the-img-element>img</a></code>
  57669. <td>
  57670. <tr><td> <a href=#category-listed id=element-content-categories:category-listed>Listed elements</a>
  57671. <td>
  57672. <code id=element-content-categories:the-button-element-5><a href=#the-button-element>button</a></code>;
  57673. <code id=element-content-categories:the-fieldset-element-4><a href=#the-fieldset-element>fieldset</a></code>;
  57674. <code id=element-content-categories:the-input-element-5><a href=#the-input-element>input</a></code>;
  57675. <code id=element-content-categories:the-keygen-element-5><a href=#the-keygen-element>keygen</a></code>;
  57676. <code id=element-content-categories:the-object-element-6><a href=#the-object-element>object</a></code>;
  57677. <code id=element-content-categories:the-output-element-4><a href=#the-output-element>output</a></code>;
  57678. <code id=element-content-categories:the-select-element-5><a href=#the-select-element>select</a></code>;
  57679. <code id=element-content-categories:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code>
  57680. <td>
  57681. <tr><td> <a href=#category-submit id=element-content-categories:category-submit>Submittable elements</a>
  57682. <td>
  57683. <code id=element-content-categories:the-button-element-6><a href=#the-button-element>button</a></code>;
  57684. <code id=element-content-categories:the-input-element-6><a href=#the-input-element>input</a></code>;
  57685. <code id=element-content-categories:the-keygen-element-6><a href=#the-keygen-element>keygen</a></code>;
  57686. <code id=element-content-categories:the-object-element-7><a href=#the-object-element>object</a></code>;
  57687. <code id=element-content-categories:the-select-element-6><a href=#the-select-element>select</a></code>;
  57688. <code id=element-content-categories:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code>
  57689. <td>
  57690. <tr><td> <a href=#category-reset id=element-content-categories:category-reset>Resettable elements</a>
  57691. <td>
  57692. <code id=element-content-categories:the-input-element-7><a href=#the-input-element>input</a></code>;
  57693. <code id=element-content-categories:the-keygen-element-7><a href=#the-keygen-element>keygen</a></code>;
  57694. <code id=element-content-categories:the-output-element-5><a href=#the-output-element>output</a></code>;
  57695. <code id=element-content-categories:the-select-element-7><a href=#the-select-element>select</a></code>;
  57696. <code id=element-content-categories:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code>
  57697. <td>
  57698. <tr><td> <a href=#category-label id=element-content-categories:category-label>Labelable elements</a>
  57699. <td>
  57700. <code id=element-content-categories:the-button-element-7><a href=#the-button-element>button</a></code>;
  57701. <code id=element-content-categories:the-input-element-8><a href=#the-input-element>input</a></code>;
  57702. <code id=element-content-categories:the-keygen-element-8><a href=#the-keygen-element>keygen</a></code>;
  57703. <code id=element-content-categories:the-meter-element-3><a href=#the-meter-element>meter</a></code>;
  57704. <code id=element-content-categories:the-output-element-6><a href=#the-output-element>output</a></code>;
  57705. <code id=element-content-categories:the-progress-element-3><a href=#the-progress-element>progress</a></code>;
  57706. <code id=element-content-categories:the-select-element-8><a href=#the-select-element>select</a></code>;
  57707. <code id=element-content-categories:the-textarea-element-8><a href=#the-textarea-element>textarea</a></code>
  57708. <td>
  57709. <tr><td> <a href=#category-form-attr id=element-content-categories:category-form-attr>Reassociateable elements</a>
  57710. <td>
  57711. <code id=element-content-categories:the-button-element-8><a href=#the-button-element>button</a></code>;
  57712. <code id=element-content-categories:the-fieldset-element-5><a href=#the-fieldset-element>fieldset</a></code>;
  57713. <code id=element-content-categories:the-input-element-9><a href=#the-input-element>input</a></code>;
  57714. <code id=element-content-categories:the-keygen-element-9><a href=#the-keygen-element>keygen</a></code>;
  57715. <code id=element-content-categories:the-label-element-5><a href=#the-label-element>label</a></code>;
  57716. <code id=element-content-categories:the-object-element-8><a href=#the-object-element>object</a></code>;
  57717. <code id=element-content-categories:the-output-element-7><a href=#the-output-element>output</a></code>;
  57718. <code id=element-content-categories:the-select-element-9><a href=#the-select-element>select</a></code>;
  57719. <code id=element-content-categories:the-textarea-element-9><a href=#the-textarea-element>textarea</a></code>
  57720. <td>
  57721. <tr><td> <a href=#palpable-content-2 id=element-content-categories:palpable-content-2>Palpable content</a>
  57722. <td>
  57723. <code id=element-content-categories:the-a-element-4><a href=#the-a-element>a</a></code>;
  57724. <code id=element-content-categories:the-abbr-element-3><a href=#the-abbr-element>abbr</a></code>;
  57725. <code id=element-content-categories:the-address-element-2><a href=#the-address-element>address</a></code>;
  57726. <code id=element-content-categories:the-article-element-3><a href=#the-article-element>article</a></code>;
  57727. <code id=element-content-categories:the-aside-element-3><a href=#the-aside-element>aside</a></code>;
  57728. <code id=element-content-categories:the-b-element-3><a href=#the-b-element>b</a></code>;
  57729. <code id=element-content-categories:the-bdi-element-3><a href=#the-bdi-element>bdi</a></code>;
  57730. <code id=element-content-categories:the-bdo-element-3><a href=#the-bdo-element>bdo</a></code>;
  57731. <code id=element-content-categories:the-blockquote-element-3><a href=#the-blockquote-element>blockquote</a></code>;
  57732. <code id=element-content-categories:the-button-element-9><a href=#the-button-element>button</a></code>;
  57733. <code id=element-content-categories:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code>;
  57734. <code id=element-content-categories:the-cite-element-3><a href=#the-cite-element>cite</a></code>;
  57735. <code id=element-content-categories:the-code-element-3><a href=#the-code-element>code</a></code>;
  57736. <code id=element-content-categories:the-data-element-3><a href=#the-data-element>data</a></code>;
  57737. <code id=element-content-categories:the-details-element-4><a href=#the-details-element>details</a></code>;
  57738. <code id=element-content-categories:the-dfn-element-3><a href=#the-dfn-element>dfn</a></code>;
  57739. <code id=element-content-categories:the-div-element-2><a href=#the-div-element>div</a></code>;
  57740. <code id=element-content-categories:the-em-element-3><a href=#the-em-element>em</a></code>;
  57741. <code id=element-content-categories:the-embed-element-5><a href=#the-embed-element>embed</a></code>;
  57742. <code id=element-content-categories:the-fieldset-element-6><a href=#the-fieldset-element>fieldset</a></code>;
  57743. <code id=element-content-categories:the-figure-element-3><a href=#the-figure-element>figure</a></code>;
  57744. <code id=element-content-categories:the-footer-element-2><a href=#the-footer-element>footer</a></code>;
  57745. <code id=element-content-categories:the-form-element-2><a href=#the-form-element>form</a></code>;
  57746. <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>;
  57747. <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>;
  57748. <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>;
  57749. <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>;
  57750. <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>;
  57751. <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>;
  57752. <code id=element-content-categories:the-header-element-2><a href=#the-header-element>header</a></code>;
  57753. <code id=element-content-categories:the-hgroup-element-3><a href=#the-hgroup-element>hgroup</a></code>;
  57754. <code id=element-content-categories:the-i-element-3><a href=#the-i-element>i</a></code>;
  57755. <code id=element-content-categories:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code>;
  57756. <code id=element-content-categories:the-img-element-6><a href=#the-img-element>img</a></code>;
  57757. <code id=element-content-categories:the-ins-element-3><a href=#the-ins-element>ins</a></code>;
  57758. <code id=element-content-categories:the-kbd-element-3><a href=#the-kbd-element>kbd</a></code>;
  57759. <code id=element-content-categories:the-keygen-element-10><a href=#the-keygen-element>keygen</a></code>;
  57760. <code id=element-content-categories:the-label-element-6><a href=#the-label-element>label</a></code>;
  57761. <code id=element-content-categories:the-main-element-2><a href=#the-main-element>main</a></code>;
  57762. <code id=element-content-categories:the-map-element-5><a href=#the-map-element>map</a></code>;
  57763. <code id=element-content-categories:the-mark-element-3><a href=#the-mark-element>mark</a></code>;
  57764. <code id=element-content-categories:math-4><a href=#math>math</a></code>;
  57765. <code id=element-content-categories:the-meter-element-4><a href=#the-meter-element>meter</a></code>;
  57766. <code id=element-content-categories:the-nav-element-3><a href=#the-nav-element>nav</a></code>;
  57767. <code id=element-content-categories:the-object-element-9><a href=#the-object-element>object</a></code>;
  57768. <code id=element-content-categories:the-output-element-8><a href=#the-output-element>output</a></code>;
  57769. <code id=element-content-categories:the-p-element-2><a href=#the-p-element>p</a></code>;
  57770. <code id=element-content-categories:the-pre-element-2><a href=#the-pre-element>pre</a></code>;
  57771. <code id=element-content-categories:the-progress-element-4><a href=#the-progress-element>progress</a></code>;
  57772. <code id=element-content-categories:the-q-element-3><a href=#the-q-element>q</a></code>;
  57773. <code id=element-content-categories:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code>;
  57774. <code id=element-content-categories:the-s-element-3><a href=#the-s-element>s</a></code>;
  57775. <code id=element-content-categories:the-samp-element-3><a href=#the-samp-element>samp</a></code>;
  57776. <code id=element-content-categories:the-section-element-3><a href=#the-section-element>section</a></code>;
  57777. <code id=element-content-categories:the-select-element-10><a href=#the-select-element>select</a></code>;
  57778. <code id=element-content-categories:the-small-element-3><a href=#the-small-element>small</a></code>;
  57779. <code id=element-content-categories:the-span-element-3><a href=#the-span-element>span</a></code>;
  57780. <code id=element-content-categories:the-strong-element-3><a href=#the-strong-element>strong</a></code>;
  57781. <code id=element-content-categories:the-sub-and-sup-elements-5><a href=#the-sub-and-sup-elements>sub</a></code>;
  57782. <code id=element-content-categories:the-sub-and-sup-elements-6><a href=#the-sub-and-sup-elements>sup</a></code>;
  57783. <code id=element-content-categories:svg-2-4><a href=#svg-2>svg</a></code>;
  57784. <code id=element-content-categories:the-table-element-2><a href=#the-table-element>table</a></code>;
  57785. <code id=element-content-categories:the-textarea-element-10><a href=#the-textarea-element>textarea</a></code>;
  57786. <code id=element-content-categories:the-time-element-3><a href=#the-time-element>time</a></code>;
  57787. <code id=element-content-categories:the-u-element-3><a href=#the-u-element>u</a></code>;
  57788. <code id=element-content-categories:the-var-element-3><a href=#the-var-element>var</a></code>;
  57789. <code id=element-content-categories:the-video-element-5><a href=#the-video-element>video</a></code>
  57790. <td>
  57791. <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);
  57792. <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);
  57793. <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);
  57794. <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);
  57795. <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);
  57796. <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);
  57797. <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>
  57798. <tr><td> <a href=#script-supporting-elements-2 id=element-content-categories:script-supporting-elements-2>Script-supporting elements</a>
  57799. <td>
  57800. <code id=element-content-categories:the-script-element-4><a href=#the-script-element>script</a></code>;
  57801. <code id=element-content-categories:the-template-element-4><a href=#the-template-element>template</a></code>
  57802. <td>
  57803. </table>
  57804. <p class=tablenote><small>* The <code id=element-content-categories:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute can also
  57805. make any element into <a href=#interactive-content-2 id=element-content-categories:interactive-content-2-2>interactive content</a>.</small></p>
  57806. <h3 id=attributes-3 class=no-num>Attributes</h3>
  57807. <p><i>This section is non-normative.</i></p>
  57808. <table><caption>List of attributes (excluding event handler content attributes)</caption><thead><tr><th> Attribute
  57809. <th> Element(s)
  57810. <th> Description
  57811. <th> Value
  57812. <tbody><tr><th> <code>abbr</code>
  57813. <td> <code id=attributes-3:attr-th-abbr><a href=#attr-th-abbr>th</a></code>
  57814. <td> Alternative label to use for the header cell when referencing the cell in other contexts
  57815. <td> <a href=#attribute-text>Text</a>*
  57816. <tr><th> <code>accept</code>
  57817. <td> <code id=attributes-3:attr-input-accept><a href=#attr-input-accept>input</a></code>
  57818. <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>
  57819. <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>
  57820. <tr><th> <code>accept-charset</code>
  57821. <td> <code id=attributes-3:attr-form-accept-charset><a href=#attr-form-accept-charset>form</a></code>
  57822. <td> Character encodings to use for <a href=#form-submission-2 id=attributes-3:form-submission-2>form submission</a>
  57823. <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>*
  57824. <tr><th> <code>accesskey</code>
  57825. <td> <a href=#the-accesskey-attribute id=attributes-3:the-accesskey-attribute>HTML elements</a>
  57826. <td> Keyboard shortcut to activate or focus element
  57827. <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
  57828. <tr><th> <code>action</code>
  57829. <td> <code id=attributes-3:attr-fs-action><a href=#attr-fs-action>form</a></code>
  57830. <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>
  57831. <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>
  57832. <tr><th> <code>allowfullscreen</code>
  57833. <td> <code id=attributes-3:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>iframe</a></code>
  57834. <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>
  57835. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute>Boolean attribute</a>
  57836. <tr><th> <code>alt</code>
  57837. <td> <code id=attributes-3:attr-area-alt><a href=#attr-area-alt>area</a></code>;
  57838. <code id=attributes-3:attr-img-alt><a href=#attr-img-alt>img</a></code>;
  57839. <code id=attributes-3:attr-input-alt><a href=#attr-input-alt>input</a></code>
  57840. <td> Replacement text for use when images are not available
  57841. <td> <a href=#attribute-text>Text</a>*
  57842. <tr><th> <code>async</code>
  57843. <td> <code id=attributes-3:attr-script-async><a href=#attr-script-async>script</a></code>
  57844. <td> Execute script asynchronously
  57845. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-2>Boolean attribute</a>
  57846. <tr><th> <code>autocomplete</code>
  57847. <td> <code id=attributes-3:attr-form-autocomplete><a href=#attr-form-autocomplete>form</a></code>
  57848. <td> Default setting for autofill feature for controls in the form
  57849. <td> "<code>on</code>"; "<code>off</code>"
  57850. <tr><th> <code>autocomplete</code>
  57851. <td> <code id=attributes-3:attr-fe-autocomplete><a href=#attr-fe-autocomplete>input</a></code>;
  57852. <code id=attributes-3:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>select</a></code>;
  57853. <code id=attributes-3:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>textarea</a></code>
  57854. <td> Hint for form autofill feature
  57855. <td> <a href=#autofill-field id=attributes-3:autofill-field>Autofill field</a> name and related tokens*
  57856. <tr><th> <code>autofocus</code>
  57857. <td> <code id=attributes-3:attr-fe-autofocus><a href=#attr-fe-autofocus>button</a></code>;
  57858. <code id=attributes-3:attr-fe-autofocus-2><a href=#attr-fe-autofocus>input</a></code>;
  57859. <code id=attributes-3:attr-fe-autofocus-3><a href=#attr-fe-autofocus>keygen</a></code>;
  57860. <code id=attributes-3:attr-fe-autofocus-4><a href=#attr-fe-autofocus>select</a></code>;
  57861. <code id=attributes-3:attr-fe-autofocus-5><a href=#attr-fe-autofocus>textarea</a></code>
  57862. <td> Automatically focus the form control when the page is loaded
  57863. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-3>Boolean attribute</a>
  57864. <tr><th> <code>autoplay</code>
  57865. <td> <code id=attributes-3:attr-media-autoplay><a href=#attr-media-autoplay>audio</a></code>;
  57866. <code id=attributes-3:attr-media-autoplay-2><a href=#attr-media-autoplay>video</a></code>
  57867. <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
  57868. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-4>Boolean attribute</a>
  57869. <tr><th> <code>challenge</code>
  57870. <td> <code id=attributes-3:attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
  57871. <td> String to package with the generated and signed public key
  57872. <td> <a href=#attribute-text>Text</a>
  57873. <tr><th> <code>charset</code>
  57874. <td> <code id=attributes-3:attr-meta-charset><a href=#attr-meta-charset>meta</a></code>
  57875. <td> <a href=#character-encoding-declaration id=attributes-3:character-encoding-declaration>Character encoding declaration</a>
  57876. <td> <a href=#encoding-label id=attributes-3:encoding-label-2>Encoding label</a>*
  57877. <tr><th> <code>charset</code>
  57878. <td> <code id=attributes-3:attr-script-charset><a href=#attr-script-charset>script</a></code>
  57879. <td> Character encoding of the external script resource
  57880. <td> <a href=#encoding-label id=attributes-3:encoding-label-3>Encoding label</a>*
  57881. <tr><th> <code>checked</code>
  57882. <td> <code id=attributes-3:attr-menuitem-checked><a href=#attr-menuitem-checked>menuitem</a></code>;
  57883. <code id=attributes-3:attr-input-checked><a href=#attr-input-checked>input</a></code>
  57884. <td> Whether the command or control is checked
  57885. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-5>Boolean attribute</a>
  57886. <tr><th> <code>cite</code>
  57887. <td> <code id=attributes-3:attr-blockquote-cite><a href=#attr-blockquote-cite>blockquote</a></code>;
  57888. <code id=attributes-3:attr-mod-cite><a href=#attr-mod-cite>del</a></code>;
  57889. <code id=attributes-3:attr-mod-cite-2><a href=#attr-mod-cite>ins</a></code>;
  57890. <code id=attributes-3:attr-q-cite><a href=#attr-q-cite>q</a></code>
  57891. <td> Link to the source of the quotation or more information about the edit
  57892. <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>
  57893. <tr><th> <code>class</code>
  57894. <td> <a href=#classes id=attributes-3:classes>HTML elements</a>
  57895. <td> Classes to which the element belongs
  57896. <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens>Set of space-separated tokens</a>
  57897. <tr><th> <code>cols</code>
  57898. <td> <code id=attributes-3:attr-textarea-cols><a href=#attr-textarea-cols>textarea</a></code>
  57899. <td> Maximum number of characters per line
  57900. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer>Valid non-negative integer</a> greater than zero
  57901. <tr><th> <code>colspan</code>
  57902. <td> <code id=attributes-3:attr-tdth-colspan><a href=#attr-tdth-colspan>td</a></code>;
  57903. <code id=attributes-3:attr-tdth-colspan-2><a href=#attr-tdth-colspan>th</a></code>
  57904. <td> Number of columns that the cell is to span
  57905. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-2>Valid non-negative integer</a> greater than zero
  57906. <tr><th> <code>command</code>
  57907. <td> <code id=attributes-3:attr-menuitem-command><a href=#attr-menuitem-command>menuitem</a></code>
  57908. <td> Command definition
  57909. <td> <a href=#concept-id id=attributes-3:concept-id>ID</a>*
  57910. <tr><th> <code>content</code>
  57911. <td> <code id=attributes-3:attr-meta-content><a href=#attr-meta-content>meta</a></code>
  57912. <td> Value of the element
  57913. <td> <a href=#attribute-text>Text</a>*
  57914. <tr><th> <code>contenteditable</code>
  57915. <td> <a href=#attr-contenteditable id=attributes-3:attr-contenteditable>HTML elements</a>
  57916. <td> Whether the element is editable
  57917. <td> "<code>true</code>"; "<code>false</code>"
  57918. <tr><th> <code>contextmenu</code>
  57919. <td> <a href=#attr-contextmenu id=attributes-3:attr-contextmenu>HTML elements</a>
  57920. <td> The element's context menu
  57921. <td> <a href=#concept-id id=attributes-3:concept-id-2>ID</a>*
  57922. <tr><th> <code>controls</code>
  57923. <td> <code id=attributes-3:attr-media-controls><a href=#attr-media-controls>audio</a></code>;
  57924. <code id=attributes-3:attr-media-controls-2><a href=#attr-media-controls>video</a></code>
  57925. <td> Show user agent controls
  57926. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-6>Boolean attribute</a>
  57927. <tr><th> <code>coords</code>
  57928. <td> <code id=attributes-3:attr-area-coords><a href=#attr-area-coords>area</a></code>
  57929. <td> Coordinates for the shape to be created in an <a href=#image-map id=attributes-3:image-map>image map</a>
  57930. <td> <a href=#valid-list-of-integers id=attributes-3:valid-list-of-integers>Valid list of integers</a>*
  57931. <tr><th> <code>crossorigin</code>
  57932. <td> <code id=attributes-3:attr-media-crossorigin><a href=#attr-media-crossorigin>audio</a></code>;
  57933. <code id=attributes-3:attr-img-crossorigin><a href=#attr-img-crossorigin>img</a></code>;
  57934. <code id=attributes-3:attr-link-crossorigin><a href=#attr-link-crossorigin>link</a></code>;
  57935. <code id=attributes-3:attr-script-crossorigin><a href=#attr-script-crossorigin>script</a></code>;
  57936. <code id=attributes-3:attr-media-crossorigin-2><a href=#attr-media-crossorigin>video</a></code>
  57937. <td> How the element handles crossorigin requests
  57938. <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>"
  57939. <tr><th> <code>data</code>
  57940. <td> <code id=attributes-3:attr-object-data><a href=#attr-object-data>object</a></code>
  57941. <td> Address of the resource
  57942. <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>
  57943. <tr><th> <code>datetime</code>
  57944. <td> <code id=attributes-3:attr-mod-datetime><a href=#attr-mod-datetime>del</a></code>;
  57945. <code id=attributes-3:attr-mod-datetime-2><a href=#attr-mod-datetime>ins</a></code>
  57946. <td> Date and (optionally) time of the change
  57947. <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>
  57948. <tr><th> <code>datetime</code>
  57949. <td> <code id=attributes-3:attr-time-datetime><a href=#attr-time-datetime>time</a></code>
  57950. <td> Machine-readable value
  57951. <td> <a href=#valid-month-string id=attributes-3:valid-month-string>Valid month string</a>,
  57952. <a href=#valid-date-string id=attributes-3:valid-date-string>valid date string</a>,
  57953. <a href=#valid-yearless-date-string id=attributes-3:valid-yearless-date-string>valid yearless date string</a>,
  57954. <a href=#valid-time-string id=attributes-3:valid-time-string>valid time string</a>,
  57955. <a href=#valid-local-date-and-time-string id=attributes-3:valid-local-date-and-time-string>valid local date and time string</a>,
  57956. <a href=#valid-time-zone-offset-string id=attributes-3:valid-time-zone-offset-string>valid time-zone offset string</a>,
  57957. <a href=#valid-global-date-and-time-string id=attributes-3:valid-global-date-and-time-string>valid global date and time string</a>,
  57958. <a href=#valid-week-string id=attributes-3:valid-week-string>valid week string</a>,
  57959. <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-3>valid non-negative integer</a>, or
  57960. <a href=#valid-duration-string id=attributes-3:valid-duration-string>valid duration string</a>
  57961. <tr><th> <code>default</code>
  57962. <td> <code id=attributes-3:attr-menuitem-default><a href=#attr-menuitem-default>menuitem</a></code>
  57963. <td> Mark the command as being a default command
  57964. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-7>Boolean attribute</a>
  57965. <tr><th> <code>default</code>
  57966. <td> <code id=attributes-3:attr-track-default><a href=#attr-track-default>track</a></code>
  57967. <td> Enable the track if no other <a href=#text-track id=attributes-3:text-track>text track</a> is more suitable
  57968. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-8>Boolean attribute</a>
  57969. <tr><th> <code>defer</code>
  57970. <td> <code id=attributes-3:attr-script-defer><a href=#attr-script-defer>script</a></code>
  57971. <td> Defer script execution
  57972. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-9>Boolean attribute</a>
  57973. <tr><th> <code>dir</code>
  57974. <td> <a href=#the-dir-attribute id=attributes-3:the-dir-attribute>HTML elements</a>
  57975. <td> <a href=#the-directionality id=attributes-3:the-directionality>The text directionality</a> of the element
  57976. <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>"
  57977. <tr><th> <code>dir</code>
  57978. <td> <code id=attributes-3:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
  57979. <td> <a href=#the-directionality id=attributes-3:the-directionality-2>The text directionality</a> of the element
  57980. <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>"
  57981. <tr><th> <code>dirname</code>
  57982. <td> <code id=attributes-3:attr-fe-dirname><a href=#attr-fe-dirname>input</a></code>;
  57983. <code id=attributes-3:attr-fe-dirname-2><a href=#attr-fe-dirname>textarea</a></code>
  57984. <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>
  57985. <td> <a href=#attribute-text>Text</a>*
  57986. <tr><th> <code>disabled</code>
  57987. <td> <code id=attributes-3:attr-fe-disabled><a href=#attr-fe-disabled>button</a></code>;
  57988. <code id=attributes-3:attr-menuitem-disabled><a href=#attr-menuitem-disabled>menuitem</a></code>;
  57989. <code id=attributes-3:attr-fieldset-disabled><a href=#attr-fieldset-disabled>fieldset</a></code>;
  57990. <code id=attributes-3:attr-fe-disabled-2><a href=#attr-fe-disabled>input</a></code>;
  57991. <code id=attributes-3:attr-fe-disabled-3><a href=#attr-fe-disabled>keygen</a></code>;
  57992. <code id=attributes-3:attr-optgroup-disabled><a href=#attr-optgroup-disabled>optgroup</a></code>;
  57993. <code id=attributes-3:attr-option-disabled><a href=#attr-option-disabled>option</a></code>;
  57994. <code id=attributes-3:attr-fe-disabled-4><a href=#attr-fe-disabled>select</a></code>;
  57995. <code id=attributes-3:attr-fe-disabled-5><a href=#attr-fe-disabled>textarea</a></code>
  57996. <td> Whether the form control is disabled
  57997. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-10>Boolean attribute</a>
  57998. <tr><th> <code>download</code>
  57999. <td> <code id=attributes-3:attr-hyperlink-download><a href=#attr-hyperlink-download>a</a></code>;
  58000. <code id=attributes-3:attr-hyperlink-download-2><a href=#attr-hyperlink-download>area</a></code>
  58001. <td> Whether to download the resource instead of navigating to it, and its file name if so
  58002. <td> Text
  58003. <tr><th> <code>draggable</code>
  58004. <td> <a href=#the-draggable-attribute id=attributes-3:the-draggable-attribute>HTML elements</a>
  58005. <td> Whether the element is draggable
  58006. <td> "<code>true</code>"; "<code>false</code>"
  58007. <tr><th> <code>dropzone</code>
  58008. <td> <a href=#the-dropzone-attribute id=attributes-3:the-dropzone-attribute>HTML elements</a>
  58009. <td> Accepted item types for drag-and-drop
  58010. <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*
  58011. <tr><th> <code>enctype</code>
  58012. <td> <code id=attributes-3:attr-fs-enctype><a href=#attr-fs-enctype>form</a></code>
  58013. <td> Form data set encoding type to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-4>form submission</a>
  58014. <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>"
  58015. <tr><th> <code>for</code>
  58016. <td> <code id=attributes-3:attr-label-for><a href=#attr-label-for>label</a></code>
  58017. <td> Associate the label with form control
  58018. <td> <a href=#concept-id id=attributes-3:concept-id-3>ID</a>*
  58019. <tr><th> <code>for</code>
  58020. <td> <code id=attributes-3:attr-output-for><a href=#attr-output-for>output</a></code>
  58021. <td> Specifies controls from which the output was calculated
  58022. <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*
  58023. <tr><th> <code>form</code>
  58024. <td> <code id=attributes-3:attr-fae-form><a href=#attr-fae-form>button</a></code>;
  58025. <code id=attributes-3:attr-fae-form-2><a href=#attr-fae-form>fieldset</a></code>;
  58026. <code id=attributes-3:attr-fae-form-3><a href=#attr-fae-form>input</a></code>;
  58027. <code id=attributes-3:attr-fae-form-4><a href=#attr-fae-form>keygen</a></code>;
  58028. <code id=attributes-3:attr-fae-form-5><a href=#attr-fae-form>label</a></code>;
  58029. <code id=attributes-3:attr-fae-form-6><a href=#attr-fae-form>object</a></code>;
  58030. <code id=attributes-3:attr-fae-form-7><a href=#attr-fae-form>output</a></code>;
  58031. <code id=attributes-3:attr-fae-form-8><a href=#attr-fae-form>select</a></code>;
  58032. <code id=attributes-3:attr-fae-form-9><a href=#attr-fae-form>textarea</a></code>
  58033. <td> Associates the control with a <code id=attributes-3:the-form-element><a href=#the-form-element>form</a></code> element
  58034. <td> <a href=#concept-id id=attributes-3:concept-id-4>ID</a>*
  58035. <tr><th> <code>formaction</code>
  58036. <td> <code id=attributes-3:attr-fs-formaction><a href=#attr-fs-formaction>button</a></code>;
  58037. <code id=attributes-3:attr-fs-formaction-2><a href=#attr-fs-formaction>input</a></code>
  58038. <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>
  58039. <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>
  58040. <tr><th> <code>formenctype</code>
  58041. <td> <code id=attributes-3:attr-fs-formenctype><a href=#attr-fs-formenctype>button</a></code>;
  58042. <code id=attributes-3:attr-fs-formenctype-2><a href=#attr-fs-formenctype>input</a></code>
  58043. <td> Form data set encoding type to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-6>form submission</a>
  58044. <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>"
  58045. <tr><th> <code>formmethod</code>
  58046. <td> <code id=attributes-3:attr-fs-formmethod><a href=#attr-fs-formmethod>button</a></code>;
  58047. <code id=attributes-3:attr-fs-formmethod-2><a href=#attr-fs-formmethod>input</a></code>
  58048. <td> HTTP method to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-7>form submission</a>
  58049. <td> "<code>GET</code>"; "<code>POST</code>"
  58050. <tr><th> <code>formnovalidate</code>
  58051. <td> <code id=attributes-3:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>button</a></code>;
  58052. <code id=attributes-3:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>input</a></code>
  58053. <td> Bypass form control validation for <a href=#form-submission-2 id=attributes-3:form-submission-2-8>form submission</a>
  58054. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-11>Boolean attribute</a>
  58055. <tr><th> <code>formtarget</code>
  58056. <td> <code id=attributes-3:attr-fs-formtarget><a href=#attr-fs-formtarget>button</a></code>;
  58057. <code id=attributes-3:attr-fs-formtarget-2><a href=#attr-fs-formtarget>input</a></code>
  58058. <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>
  58059. <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>
  58060. <tr><th> <code>headers</code>
  58061. <td> <code id=attributes-3:attr-tdth-headers><a href=#attr-tdth-headers>td</a></code>;
  58062. <code id=attributes-3:attr-tdth-headers-2><a href=#attr-tdth-headers>th</a></code>
  58063. <td> The header cells for this cell
  58064. <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*
  58065. <tr><th> <code>height</code>
  58066. <td> <code id=attributes-3:attr-canvas-height><a href=#attr-canvas-height>canvas</a></code>;
  58067. <code id=attributes-3:attr-dim-height><a href=#attr-dim-height>embed</a></code>;
  58068. <code id=attributes-3:attr-dim-height-2><a href=#attr-dim-height>iframe</a></code>;
  58069. <code id=attributes-3:attr-dim-height-3><a href=#attr-dim-height>img</a></code>;
  58070. <code id=attributes-3:attr-dim-height-4><a href=#attr-dim-height>input</a></code>;
  58071. <code id=attributes-3:attr-dim-height-5><a href=#attr-dim-height>object</a></code>;
  58072. <code id=attributes-3:attr-dim-height-6><a href=#attr-dim-height>video</a></code>
  58073. <td> Vertical dimension
  58074. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-4>Valid non-negative integer</a>
  58075. <tr><th> <code>hidden</code>
  58076. <td> <a href=#the-hidden-attribute id=attributes-3:the-hidden-attribute>HTML elements</a>
  58077. <td> Whether the element is relevant
  58078. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-12>Boolean attribute</a>
  58079. <tr><th> <code>high</code>
  58080. <td> <code id=attributes-3:attr-meter-high><a href=#attr-meter-high>meter</a></code>
  58081. <td> Low limit of high range
  58082. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number>Valid floating-point number</a>*
  58083. <tr><th> <code>href</code>
  58084. <td> <code id=attributes-3:attr-hyperlink-href><a href=#attr-hyperlink-href>a</a></code>;
  58085. <code id=attributes-3:attr-hyperlink-href-2><a href=#attr-hyperlink-href>area</a></code>
  58086. <td> Address of the <a href=#hyperlink id=attributes-3:hyperlink>hyperlink</a>
  58087. <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>
  58088. <tr><th> <code>href</code>
  58089. <td> <code id=attributes-3:attr-link-href><a href=#attr-link-href>link</a></code>
  58090. <td> Address of the <a href=#hyperlink id=attributes-3:hyperlink-2>hyperlink</a>
  58091. <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>
  58092. <tr><th> <code>href</code>
  58093. <td> <code id=attributes-3:attr-base-href><a href=#attr-base-href>base</a></code>
  58094. <td> <a href=#document-base-url id=attributes-3:document-base-url>Document base URL</a>
  58095. <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>
  58096. <tr><th> <code>hreflang</code>
  58097. <td> <code id=attributes-3:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>a</a></code>;
  58098. <code id=attributes-3:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>area</a></code>;
  58099. <code id=attributes-3:attr-link-hreflang><a href=#attr-link-hreflang>link</a></code>
  58100. <td> Language of the linked resource
  58101. <td> Valid BCP 47 language tag
  58102. <tr><th> <code>http-equiv</code>
  58103. <td> <code id=attributes-3:attr-meta-http-equiv><a href=#attr-meta-http-equiv>meta</a></code>
  58104. <td> Pragma directive
  58105. <td> <a href=#attribute-text>Text</a>*
  58106. <tr><th> <code>icon</code>
  58107. <td> <code id=attributes-3:attr-menuitem-icon><a href=#attr-menuitem-icon>menuitem</a></code>
  58108. <td> Icon for the command
  58109. <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>
  58110. <tr><th> <code>id</code>
  58111. <td> <a href=#the-id-attribute id=attributes-3:the-id-attribute>HTML elements</a>
  58112. <td> The element's <a href=#concept-id id=attributes-3:concept-id-5>ID</a>
  58113. <td> <a href=#attribute-text>Text</a>*
  58114. <tr><th> <code>inputmode</code>
  58115. <td> <code id=attributes-3:attr-fe-inputmode><a href=#attr-fe-inputmode>input</a></code>;
  58116. <code id=attributes-3:attr-fe-inputmode-2><a href=#attr-fe-inputmode>textarea</a></code>
  58117. <td> Hint for selecting an input modality
  58118. <td> "<code id=attributes-3:attr-fe-inputmode-keyword-verbatim><a href=#attr-fe-inputmode-keyword-verbatim>verbatim</a></code>";
  58119. "<code id=attributes-3:attr-fe-inputmode-keyword-latin><a href=#attr-fe-inputmode-keyword-latin>latin</a></code>";
  58120. "<code id=attributes-3:attr-fe-inputmode-keyword-latin-name><a href=#attr-fe-inputmode-keyword-latin-name>latin-name</a></code>";
  58121. "<code id=attributes-3:attr-fe-inputmode-keyword-latin-prose><a href=#attr-fe-inputmode-keyword-latin-prose>latin-prose</a></code>";
  58122. "<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>";
  58123. "<code id=attributes-3:attr-fe-inputmode-keyword-kana><a href=#attr-fe-inputmode-keyword-kana>kana</a></code>";
  58124. "<code id=attributes-3:attr-fe-inputmode-keyword-kana-name><a href=#attr-fe-inputmode-keyword-kana-name>kana-name</a></code>";
  58125. "<code id=attributes-3:attr-fe-inputmode-keyword-katakana><a href=#attr-fe-inputmode-keyword-katakana>katakana</a></code>";
  58126. "<code id=attributes-3:attr-fe-inputmode-keyword-numeric><a href=#attr-fe-inputmode-keyword-numeric>numeric</a></code>";
  58127. "<code id=attributes-3:attr-fe-inputmode-keyword-tel><a href=#attr-fe-inputmode-keyword-tel>tel</a></code>";
  58128. "<code id=attributes-3:attr-fe-inputmode-keyword-email><a href=#attr-fe-inputmode-keyword-email>email</a></code>";
  58129. "<code id=attributes-3:attr-fe-inputmode-keyword-url><a href=#attr-fe-inputmode-keyword-url>url</a></code>"
  58130. <tr><th> <code>ismap</code>
  58131. <td> <code id=attributes-3:attr-img-ismap><a href=#attr-img-ismap>img</a></code>
  58132. <td> Whether the image is a server-side image map
  58133. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-13>Boolean attribute</a>
  58134. <tr><th> <code>itemid</code>
  58135. <td> <a href=#attr-itemid id=attributes-3:attr-itemid>HTML elements</a>
  58136. <td> <a href=#global-identifier id=attributes-3:global-identifier>Global identifier</a> for a microdata item
  58137. <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>
  58138. <tr><th> <code>itemprop</code>
  58139. <td> <a href=#names:-the-itemprop-attribute id=attributes-3:names:-the-itemprop-attribute>HTML elements</a>
  58140. <td> <a href=#property-names id=attributes-3:property-names>Property names</a> of a microdata item
  58141. <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*
  58142. <tr><th> <code>itemref</code>
  58143. <td> <a href=#attr-itemref id=attributes-3:attr-itemref>HTML elements</a>
  58144. <td> Referenced elements
  58145. <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*
  58146. <tr><th> <code>itemscope</code>
  58147. <td> <a href=#attr-itemscope id=attributes-3:attr-itemscope>HTML elements</a>
  58148. <td> Introduces a microdata item
  58149. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-14>Boolean attribute</a>
  58150. <tr><th> <code>itemtype</code>
  58151. <td> <a href=#attr-itemtype id=attributes-3:attr-itemtype>HTML elements</a>
  58152. <td> <a href=#item-types id=attributes-3:item-types>Item types</a> of a microdata item
  58153. <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>*
  58154. <tr><th> <code>keytype</code>
  58155. <td> <code id=attributes-3:attr-keygen-keytype><a href=#attr-keygen-keytype>keygen</a></code>
  58156. <td> The type of cryptographic key to generate
  58157. <td> <a href=#attribute-text>Text</a>*
  58158. <tr><th> <code>kind</code>
  58159. <td> <code id=attributes-3:attr-track-kind><a href=#attr-track-kind>track</a></code>
  58160. <td> The type of text track
  58161. <td> "<code id=attributes-3:attr-track-kind-subtitles><a href=#attr-track-kind-subtitles>subtitles</a></code>";
  58162. "<code id=attributes-3:attr-track-kind-captions><a href=#attr-track-kind-captions>captions</a></code>";
  58163. "<code id=attributes-3:attr-track-kind-descriptions><a href=#attr-track-kind-descriptions>descriptions</a></code>";
  58164. "<code id=attributes-3:attr-track-kind-chapters><a href=#attr-track-kind-chapters>chapters</a></code>";
  58165. "<code id=attributes-3:attr-track-kind-metadata><a href=#attr-track-kind-metadata>metadata</a></code>"
  58166. <tr><th> <code>label</code>
  58167. <td> <code id=attributes-3:attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>;
  58168. <code id=attributes-3:attr-menu-label><a href=#attr-menu-label>menu</a></code>;
  58169. <code id=attributes-3:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>;
  58170. <code id=attributes-3:attr-option-label><a href=#attr-option-label>option</a></code>;
  58171. <code id=attributes-3:attr-track-label><a href=#attr-track-label>track</a></code>
  58172. <td> User-visible label
  58173. <td> <a href=#attribute-text>Text</a>
  58174. <tr><th> <code>lang</code>
  58175. <td> <a href=#attr-lang id=attributes-3:attr-lang>HTML elements</a>
  58176. <td> <a href=#language id=attributes-3:language>Language</a> of the element
  58177. <td> Valid BCP 47 language tag or the empty string
  58178. <tr><th> <code>list</code>
  58179. <td> <code id=attributes-3:attr-input-list><a href=#attr-input-list>input</a></code>
  58180. <td> List of autocomplete options
  58181. <td> <a href=#concept-id id=attributes-3:concept-id-6>ID</a>*
  58182. <tr><th> <code>loop</code>
  58183. <td> <code id=attributes-3:attr-media-loop><a href=#attr-media-loop>audio</a></code>;
  58184. <code id=attributes-3:attr-media-loop-2><a href=#attr-media-loop>video</a></code>
  58185. <td> Whether to loop the <a href=#media-resource id=attributes-3:media-resource-2>media resource</a>
  58186. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-15>Boolean attribute</a>
  58187. <tr><th> <code>low</code>
  58188. <td> <code id=attributes-3:attr-meter-low><a href=#attr-meter-low>meter</a></code>
  58189. <td> High limit of low range
  58190. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-2>Valid floating-point number</a>*
  58191. <tr><th> <code>manifest</code>
  58192. <td> <code id=attributes-3:attr-html-manifest><a href=#attr-html-manifest>html</a></code>
  58193. <td> <a href=#concept-appcache-manifest id=attributes-3:concept-appcache-manifest>Application cache manifest</a>
  58194. <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>
  58195. <tr><th> <code>max</code>
  58196. <td> <code id=attributes-3:attr-input-max><a href=#attr-input-max>input</a></code>
  58197. <td> Maximum value
  58198. <td> Varies*
  58199. <tr><th> <code>max</code>
  58200. <td> <code id=attributes-3:attr-meter-max><a href=#attr-meter-max>meter</a></code>;
  58201. <code id=attributes-3:attr-progress-max><a href=#attr-progress-max>progress</a></code>
  58202. <td> Upper bound of range
  58203. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-3>Valid floating-point number</a>*
  58204. <tr><th> <code>maxlength</code>
  58205. <td> <code id=attributes-3:attr-input-maxlength><a href=#attr-input-maxlength>input</a></code>;
  58206. <code id=attributes-3:attr-textarea-maxlength><a href=#attr-textarea-maxlength>textarea</a></code>
  58207. <td> Maximum length of value
  58208. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-5>Valid non-negative integer</a>
  58209. <tr><th> <code>media</code>
  58210. <td> <code id=attributes-3:attr-link-media><a href=#attr-link-media>link</a></code>;
  58211. <code id=attributes-3:attr-style-media><a href=#attr-style-media>style</a></code>
  58212. <td> Applicable media
  58213. <td> <a href=#valid-media-query-list id=attributes-3:valid-media-query-list>Valid media query list</a>
  58214. <tr><th> <code>mediagroup</code>
  58215. <td> <code id=attributes-3:attr-media-mediagroup><a href=#attr-media-mediagroup>audio</a></code>;
  58216. <code id=attributes-3:attr-media-mediagroup-2><a href=#attr-media-mediagroup>video</a></code>
  58217. <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>
  58218. <td> <a href=#attribute-text>Text</a>
  58219. <tr><th> <code>menu</code>
  58220. <td> <code id=attributes-3:attr-button-menu><a href=#attr-button-menu>button</a></code>
  58221. <td> Specifies the element's <a href=#designated-pop-up-menu id=attributes-3:designated-pop-up-menu>designated pop-up menu</a>
  58222. <td> <a href=#concept-id id=attributes-3:concept-id-7>ID</a>*
  58223. <tr><th> <code>method</code>
  58224. <td> <code id=attributes-3:attr-fs-method><a href=#attr-fs-method>form</a></code>
  58225. <td> HTTP method to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-10>form submission</a>
  58226. <td> "<code id=attributes-3:attr-fs-method-get-keyword><a href=#attr-fs-method-get-keyword>GET</a></code>";
  58227. "<code id=attributes-3:attr-fs-method-post-keyword><a href=#attr-fs-method-post-keyword>POST</a></code>";
  58228. "<code id=attributes-3:attr-fs-method-dialog-keyword><a href=#attr-fs-method-dialog-keyword>dialog</a></code>"
  58229. <tr><th> <code>min</code>
  58230. <td> <code id=attributes-3:attr-input-min><a href=#attr-input-min>input</a></code>
  58231. <td> Minimum value
  58232. <td> Varies*
  58233. <tr><th> <code>min</code>
  58234. <td> <code id=attributes-3:attr-meter-min><a href=#attr-meter-min>meter</a></code>
  58235. <td> Lower bound of range
  58236. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-4>Valid floating-point number</a>*
  58237. <tr><th> <code>minlength</code>
  58238. <td> <code id=attributes-3:attr-input-minlength><a href=#attr-input-minlength>input</a></code>;
  58239. <code id=attributes-3:attr-textarea-minlength><a href=#attr-textarea-minlength>textarea</a></code>
  58240. <td> Minimum length of value
  58241. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-6>Valid non-negative integer</a>
  58242. <tr><th> <code>multiple</code>
  58243. <td> <code id=attributes-3:attr-input-multiple><a href=#attr-input-multiple>input</a></code>;
  58244. <code id=attributes-3:attr-select-multiple><a href=#attr-select-multiple>select</a></code>
  58245. <td> Whether to allow multiple values
  58246. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-16>Boolean attribute</a>
  58247. <tr><th> <code>muted</code>
  58248. <td> <code id=attributes-3:attr-media-muted><a href=#attr-media-muted>audio</a></code>;
  58249. <code id=attributes-3:attr-media-muted-2><a href=#attr-media-muted>video</a></code>
  58250. <td> Whether to mute the <a href=#media-resource id=attributes-3:media-resource-3>media resource</a> by default
  58251. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-17>Boolean attribute</a>
  58252. <tr><th> <code>name</code>
  58253. <td> <code id=attributes-3:attr-fe-name><a href=#attr-fe-name>button</a></code>;
  58254. <code id=attributes-3:attr-fe-name-2><a href=#attr-fe-name>fieldset</a></code>;
  58255. <code id=attributes-3:attr-fe-name-3><a href=#attr-fe-name>input</a></code>;
  58256. <code id=attributes-3:attr-fe-name-4><a href=#attr-fe-name>keygen</a></code>;
  58257. <code id=attributes-3:attr-fe-name-5><a href=#attr-fe-name>output</a></code>;
  58258. <code id=attributes-3:attr-fe-name-6><a href=#attr-fe-name>select</a></code>;
  58259. <code id=attributes-3:attr-fe-name-7><a href=#attr-fe-name>textarea</a></code>
  58260. <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
  58261. <td> <a href=#attribute-text>Text</a>*
  58262. <tr><th> <code>name</code>
  58263. <td> <code id=attributes-3:attr-form-name><a href=#attr-form-name>form</a></code>
  58264. <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
  58265. <td> <a href=#attribute-text>Text</a>*
  58266. <tr><th> <code>name</code>
  58267. <td> <code id=attributes-3:attr-iframe-name><a href=#attr-iframe-name>iframe</a></code>;
  58268. <code id=attributes-3:attr-object-name><a href=#attr-object-name>object</a></code>
  58269. <td> Name of <a href=#nested-browsing-context id=attributes-3:nested-browsing-context>nested browsing context</a>
  58270. <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>
  58271. <tr><th> <code>name</code>
  58272. <td> <code id=attributes-3:attr-map-name><a href=#attr-map-name>map</a></code>
  58273. <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
  58274. <td> <a href=#attribute-text>Text</a>*
  58275. <tr><th> <code>name</code>
  58276. <td> <code id=attributes-3:attr-meta-name><a href=#attr-meta-name>meta</a></code>
  58277. <td> Metadata name
  58278. <td> <a href=#attribute-text>Text</a>*
  58279. <tr><th> <code>name</code>
  58280. <td> <code id=attributes-3:attr-param-name><a href=#attr-param-name>param</a></code>
  58281. <td> Name of parameter
  58282. <td> <a href=#attribute-text>Text</a>
  58283. <tr><th> <code>novalidate</code>
  58284. <td> <code id=attributes-3:attr-fs-novalidate><a href=#attr-fs-novalidate>form</a></code>
  58285. <td> Bypass form control validation for <a href=#form-submission-2 id=attributes-3:form-submission-2-12>form submission</a>
  58286. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-18>Boolean attribute</a>
  58287. <tr><th> <code>open</code>
  58288. <td> <code id=attributes-3:attr-details-open><a href=#attr-details-open>details</a></code>
  58289. <td> Whether the details are visible
  58290. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-19>Boolean attribute</a>
  58291. <tr><th> <code>open</code>
  58292. <td> <code id=attributes-3:attr-dialog-open><a href=#attr-dialog-open>dialog</a></code>
  58293. <td> Whether the dialog box is showing
  58294. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-20>Boolean attribute</a>
  58295. <tr><th> <code>optimum</code>
  58296. <td> <code id=attributes-3:attr-meter-optimum><a href=#attr-meter-optimum>meter</a></code>
  58297. <td> Optimum value in gauge
  58298. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-5>Valid floating-point number</a>*
  58299. <tr><th> <code>pattern</code>
  58300. <td> <code id=attributes-3:attr-input-pattern><a href=#attr-input-pattern>input</a></code>
  58301. <td> Pattern to be matched by the form control's value
  58302. <td> Regular expression matching the JavaScript <i>Pattern</i> production
  58303. <tr><th> <code>ping</code>
  58304. <td> <code id=attributes-3:ping><a href=#ping>a</a></code>;
  58305. <code id=attributes-3:ping-2><a href=#ping>area</a></code>
  58306. <td> <a href=#url id=attributes-3:url-3>URLs</a> to ping
  58307. <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>
  58308. <tr><th> <code>placeholder</code>
  58309. <td> <code id=attributes-3:attr-input-placeholder><a href=#attr-input-placeholder>input</a></code>;
  58310. <code id=attributes-3:attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code>
  58311. <td> User-visible label to be placed within the form control
  58312. <td> <a href=#attribute-text>Text</a>*
  58313. <tr><th> <code>poster</code>
  58314. <td> <code id=attributes-3:attr-video-poster><a href=#attr-video-poster>video</a></code>
  58315. <td> Poster frame to show prior to video playback
  58316. <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>
  58317. <tr><th> <code>preload</code>
  58318. <td> <code id=attributes-3:attr-media-preload><a href=#attr-media-preload>audio</a></code>;
  58319. <code id=attributes-3:attr-media-preload-2><a href=#attr-media-preload>video</a></code>
  58320. <td> Hints how much buffering the <a href=#media-resource id=attributes-3:media-resource-4>media resource</a> will likely need
  58321. <td> "<code id=attributes-3:attr-media-preload-none><a href=#attr-media-preload-none>none</a></code>";
  58322. "<code id=attributes-3:attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>";
  58323. "<code id=attributes-3:attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>"
  58324. <tr><th> <code>radiogroup</code>
  58325. <td> <code id=attributes-3:attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>menuitem</a></code>
  58326. <td> Name of group of commands to treat as a radio button group
  58327. <td> <a href=#attribute-text>Text</a>
  58328. <tr><th> <code>readonly</code>
  58329. <td> <code id=attributes-3:attr-input-readonly><a href=#attr-input-readonly>input</a></code>;
  58330. <code id=attributes-3:attr-textarea-readonly><a href=#attr-textarea-readonly>textarea</a></code>
  58331. <td> Whether to allow the value to be edited by the user
  58332. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-21>Boolean attribute</a>
  58333. <tr><th> <code>rel</code>
  58334. <td> <code id=attributes-3:attr-hyperlink-rel><a href=#attr-hyperlink-rel>a</a></code>;
  58335. <code id=attributes-3:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>area</a></code>;
  58336. <code id=attributes-3:attr-link-rel><a href=#attr-link-rel>link</a></code>
  58337. <td> Relationship between the document containing the hyperlink and the destination resource
  58338. <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens-3>Set of space-separated tokens</a>*
  58339. <tr><th> <code>required</code>
  58340. <td> <code id=attributes-3:attr-input-required><a href=#attr-input-required>input</a></code>;
  58341. <code id=attributes-3:attr-select-required><a href=#attr-select-required>select</a></code>;
  58342. <code id=attributes-3:attr-textarea-required><a href=#attr-textarea-required>textarea</a></code>
  58343. <td> Whether the control is required for <a href=#form-submission-2 id=attributes-3:form-submission-2-13>form submission</a>
  58344. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-22>Boolean attribute</a>
  58345. <tr><th> <code>reversed</code>
  58346. <td> <code id=attributes-3:attr-ol-reversed><a href=#attr-ol-reversed>ol</a></code>
  58347. <td> Number the list backwards
  58348. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-23>Boolean attribute</a>
  58349. <tr><th> <code>rows</code>
  58350. <td> <code id=attributes-3:attr-textarea-rows><a href=#attr-textarea-rows>textarea</a></code>
  58351. <td> Number of lines to show
  58352. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-7>Valid non-negative integer</a> greater than zero
  58353. <tr><th> <code>rowspan</code>
  58354. <td> <code id=attributes-3:attr-tdth-rowspan><a href=#attr-tdth-rowspan>td</a></code>;
  58355. <code id=attributes-3:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>th</a></code>
  58356. <td> Number of rows that the cell is to span
  58357. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-8>Valid non-negative integer</a>
  58358. <tr><th> <code>sandbox</code>
  58359. <td> <code id=attributes-3:attr-iframe-sandbox><a href=#attr-iframe-sandbox>iframe</a></code>
  58360. <td> Security rules for nested content
  58361. <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
  58362. "<code id=attributes-3:attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>",
  58363. "<code id=attributes-3:attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>",
  58364. "<code id=attributes-3:attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>",
  58365. "<code id=attributes-3:attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>",
  58366. "<code id=attributes-3:attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and
  58367. "<code id=attributes-3:attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>"
  58368. <tr><th> <code>spellcheck</code>
  58369. <td> <a href=#attr-spellcheck id=attributes-3:attr-spellcheck>HTML elements</a>
  58370. <td> Whether the element is to have its spelling and grammar checked
  58371. <td> "<code>true</code>"; "<code>false</code>"
  58372. <tr><th> <code>scope</code>
  58373. <td> <code id=attributes-3:attr-th-scope><a href=#attr-th-scope>th</a></code>
  58374. <td> Specifies which cells the header cell applies to
  58375. <td> "<code id=attributes-3:attr-th-scope-row><a href=#attr-th-scope-row>row</a></code>";
  58376. "<code id=attributes-3:attr-th-scope-col><a href=#attr-th-scope-col>col</a></code>";
  58377. "<code id=attributes-3:attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>rowgroup</a></code>";
  58378. "<code id=attributes-3:attr-th-scope-colgroup><a href=#attr-th-scope-colgroup>colgroup</a></code>"
  58379. <tr><th> <code>scoped</code>
  58380. <td> <code id=attributes-3:attr-style-scoped><a href=#attr-style-scoped>style</a></code>
  58381. <td> Whether the styles apply to the entire document or just the parent subtree
  58382. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-24>Boolean attribute</a>
  58383. <tr><th> <code>seamless</code>
  58384. <td> <code id=attributes-3:attr-iframe-seamless><a href=#attr-iframe-seamless>iframe</a></code>
  58385. <td> Whether to apply the document's styles to the nested content
  58386. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-25>Boolean attribute</a>
  58387. <tr><th> <code>selected</code>
  58388. <td> <code id=attributes-3:attr-option-selected><a href=#attr-option-selected>option</a></code>
  58389. <td> Whether the option is selected by default
  58390. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-26>Boolean attribute</a>
  58391. <tr><th> <code>shape</code>
  58392. <td> <code id=attributes-3:attr-area-shape><a href=#attr-area-shape>area</a></code>
  58393. <td> The kind of shape to be created in an <a href=#image-map id=attributes-3:image-map-3>image map</a>
  58394. <td> "<code id=attributes-3:attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code>";
  58395. "<code id=attributes-3:attr-area-shape-keyword-default><a href=#attr-area-shape-keyword-default>default</a></code>";
  58396. "<code id=attributes-3:attr-area-shape-keyword-poly><a href=#attr-area-shape-keyword-poly>poly</a></code>";
  58397. "<code id=attributes-3:attr-area-shape-keyword-rect><a href=#attr-area-shape-keyword-rect>rect</a></code>"
  58398. <tr><th> <code>size</code>
  58399. <td> <code id=attributes-3:attr-input-size><a href=#attr-input-size>input</a></code>;
  58400. <code id=attributes-3:attr-select-size><a href=#attr-select-size>select</a></code>
  58401. <td> Size of the control
  58402. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-9>Valid non-negative integer</a> greater than zero
  58403. <tr><th> <code>sizes</code>
  58404. <td> <code id=attributes-3:attr-link-sizes><a href=#attr-link-sizes>link</a></code>
  58405. <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>")
  58406. <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*
  58407. <tr><th> <code>sortable</code>
  58408. <td> <code id=attributes-3:attr-table-sortable><a href=#attr-table-sortable>table</a></code>
  58409. <td> Enables a sorting interface for the table
  58410. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-27>Boolean attribute</a>
  58411. <tr><th> <code>sorted</code>
  58412. <td> <code id=attributes-3:attr-th-sorted><a href=#attr-th-sorted>th</a></code>
  58413. <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>
  58414. <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
  58415. <tr><th> <code>span</code>
  58416. <td> <code id=attributes-3:attr-col-span><a href=#attr-col-span>col</a></code>;
  58417. <code id=attributes-3:attr-colgroup-span><a href=#attr-colgroup-span>colgroup</a></code>
  58418. <td> Number of columns spanned by the element
  58419. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-11>Valid non-negative integer</a> greater than zero
  58420. <tr><th> <code>src</code>
  58421. <td> <code id=attributes-3:attr-media-src><a href=#attr-media-src>audio</a></code>;
  58422. <code id=attributes-3:attr-embed-src><a href=#attr-embed-src>embed</a></code>;
  58423. <code id=attributes-3:attr-iframe-src><a href=#attr-iframe-src>iframe</a></code>;
  58424. <code id=attributes-3:attr-img-src><a href=#attr-img-src>img</a></code>;
  58425. <code id=attributes-3:attr-input-src><a href=#attr-input-src>input</a></code>;
  58426. <code id=attributes-3:attr-script-src><a href=#attr-script-src>script</a></code>;
  58427. <code id=attributes-3:attr-source-src><a href=#attr-source-src>source</a></code>;
  58428. <code id=attributes-3:attr-track-src><a href=#attr-track-src>track</a></code>;
  58429. <code id=attributes-3:attr-media-src-2><a href=#attr-media-src>video</a></code>
  58430. <td> Address of the resource
  58431. <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>
  58432. <tr><th> <code>srcdoc</code>
  58433. <td> <code id=attributes-3:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
  58434. <td> A document to render in the <code id=attributes-3:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>
  58435. <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>*
  58436. <tr><th> <code>srclang</code>
  58437. <td> <code id=attributes-3:attr-track-srclang><a href=#attr-track-srclang>track</a></code>
  58438. <td> Language of the text track
  58439. <td> Valid BCP 47 language tag
  58440. <tr><th> <code>srcset</code>
  58441. <td> <code id=attributes-3:attr-img-srcset><a href=#attr-img-srcset>img</a></code>
  58442. <td> Images to use in different situations (e.g. high-resolution displays, small monitors, etc)
  58443. <td> Comma-separated list of <span>image candidate strings</span>
  58444. <tr><th> <code>start</code>
  58445. <td> <code id=attributes-3:attr-ol-start><a href=#attr-ol-start>ol</a></code>
  58446. <td> <a href=#ordinal-value id=attributes-3:ordinal-value>Ordinal value</a> of the first item
  58447. <td> <a href=#valid-integer id=attributes-3:valid-integer>Valid integer</a>
  58448. <tr><th> <code>step</code>
  58449. <td> <code id=attributes-3:attr-input-step><a href=#attr-input-step>input</a></code>
  58450. <td> Granularity to be matched by the form control's value
  58451. <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>"
  58452. <tr><th> <code>style</code>
  58453. <td> <a href=#the-style-attribute id=attributes-3:the-style-attribute>HTML elements</a>
  58454. <td> Presentational and formatting instructions
  58455. <td> CSS declarations*
  58456. <tr><th> <code>tabindex</code>
  58457. <td> <a href=#attr-tabindex id=attributes-3:attr-tabindex>HTML elements</a>
  58458. <td> Whether the element is focusable, and the relative order of the element for the purposes of sequential focus navigation
  58459. <td> <a href=#valid-integer id=attributes-3:valid-integer-2>Valid integer</a>
  58460. <tr><th> <code>target</code>
  58461. <td> <code id=attributes-3:attr-hyperlink-target><a href=#attr-hyperlink-target>a</a></code>;
  58462. <code id=attributes-3:attr-hyperlink-target-2><a href=#attr-hyperlink-target>area</a></code>
  58463. <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>
  58464. <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>
  58465. <tr><th> <code>target</code>
  58466. <td> <code id=attributes-3:attr-base-target><a href=#attr-base-target>base</a></code>
  58467. <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>
  58468. <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>
  58469. <tr><th> <code>target</code>
  58470. <td> <code id=attributes-3:attr-fs-target><a href=#attr-fs-target>form</a></code>
  58471. <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>
  58472. <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>
  58473. <tr><th> <code>title</code>
  58474. <td> <a href=#attr-title id=attributes-3:attr-title>HTML elements</a>
  58475. <td> Advisory information for the element
  58476. <td> <a href=#attribute-text>Text</a>
  58477. <tr><th> <code>title</code>
  58478. <td> <code id=attributes-3:attr-abbr-title><a href=#attr-abbr-title>abbr</a></code>;
  58479. <code id=attributes-3:attr-dfn-title><a href=#attr-dfn-title>dfn</a></code>
  58480. <td> Full term or expansion of abbreviation
  58481. <td> <a href=#attribute-text>Text</a>
  58482. <tr><th> <code>title</code>
  58483. <td> <code id=attributes-3:attr-input-title><a href=#attr-input-title>input</a></code>
  58484. <td> Description of pattern (when used with <code id=attributes-3:attr-input-pattern-2><a href=#attr-input-pattern>pattern</a></code> attribute)
  58485. <td> <a href=#attribute-text>Text</a>
  58486. <tr><th> <code>title</code>
  58487. <td> <code id=attributes-3:attr-menuitem-title><a href=#attr-menuitem-title>menuitem</a></code>
  58488. <td> Hint describing the command
  58489. <td> <a href=#attribute-text>Text</a>
  58490. <tr><th> <code>title</code>
  58491. <td> <code id=attributes-3:attr-link-title><a href=#attr-link-title>link</a></code>
  58492. <td> Title of the link
  58493. <td> <a href=#attribute-text>Text</a>
  58494. <tr><th> <code>title</code>
  58495. <td> <code id=attributes-3:attr-link-title-2><a href=#attr-link-title>link</a></code>;
  58496. <code id=attributes-3:attr-style-title><a href=#attr-style-title>style</a></code>
  58497. <td> Alternative style sheet set name
  58498. <td> <a href=#attribute-text>Text</a>
  58499. <tr><th> <code>translate</code>
  58500. <td> <a href=#attr-translate id=attributes-3:attr-translate>HTML elements</a>
  58501. <td> Whether the element is to be translated when the page is localized
  58502. <td> "<code>yes</code>"; "<code>no</code>"
  58503. <tr><th> <code>type</code>
  58504. <td> <code id=attributes-3:attr-hyperlink-type><a href=#attr-hyperlink-type>a</a></code>;
  58505. <code id=attributes-3:attr-hyperlink-type-2><a href=#attr-hyperlink-type>area</a></code>;
  58506. <code id=attributes-3:attr-link-type><a href=#attr-link-type>link</a></code>
  58507. <td> Hint for the type of the referenced resource
  58508. <td> <a href=#valid-mime-type id=attributes-3:valid-mime-type-2>Valid MIME type</a>
  58509. <tr><th> <code>type</code>
  58510. <td> <code id=attributes-3:attr-button-type><a href=#attr-button-type>button</a></code>
  58511. <td> Type of button
  58512. <td> "<code id=attributes-3:attr-button-type-submit><a href=#attr-button-type-submit>submit</a></code>";
  58513. "<code id=attributes-3:attr-button-type-reset><a href=#attr-button-type-reset>reset</a></code>";
  58514. "<code id=attributes-3:attr-button-type-button><a href=#attr-button-type-button>button</a></code>";
  58515. "<code id=attributes-3:attr-button-type-menu><a href=#attr-button-type-menu>menu</a></code>"
  58516. <tr><th> <code>type</code>
  58517. <td> <code id=attributes-3:attr-embed-type><a href=#attr-embed-type>embed</a></code>;
  58518. <code id=attributes-3:attr-object-type><a href=#attr-object-type>object</a></code>;
  58519. <code id=attributes-3:attr-script-type><a href=#attr-script-type>script</a></code>;
  58520. <code id=attributes-3:attr-source-type><a href=#attr-source-type>source</a></code>;
  58521. <code id=attributes-3:attr-style-type><a href=#attr-style-type>style</a></code>
  58522. <td> Type of embedded resource
  58523. <td> <a href=#valid-mime-type id=attributes-3:valid-mime-type-3>Valid MIME type</a>
  58524. <tr><th> <code>type</code>
  58525. <td> <code id=attributes-3:attr-input-type><a href=#attr-input-type>input</a></code>
  58526. <td> Type of form control
  58527. <td> <a href=#attr-input-type id=attributes-3:attr-input-type-2><code>input</code> type keyword</a>
  58528. <tr><th> <code>type</code>
  58529. <td> <code id=attributes-3:attr-menu-type><a href=#attr-menu-type>menu</a></code>
  58530. <td> Type of menu
  58531. <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>"
  58532. <tr><th> <code>type</code>
  58533. <td> <code id=attributes-3:attr-menuitem-type><a href=#attr-menuitem-type>menuitem</a></code>
  58534. <td> Type of command
  58535. <td> "<code id=attributes-3:attr-menuitem-type-keyword-command><a href=#attr-menuitem-type-keyword-command>command</a></code>";
  58536. "<code id=attributes-3:attr-menuitem-type-keyword-checkbox><a href=#attr-menuitem-type-keyword-checkbox>checkbox</a></code>";
  58537. "<code id=attributes-3:attr-menuitem-type-keyword-radio><a href=#attr-menuitem-type-keyword-radio>radio</a></code>"
  58538. <tr><th> <code>type</code>
  58539. <td> <code id=attributes-3:attr-ol-type><a href=#attr-ol-type>ol</a></code>
  58540. <td> Kind of list marker
  58541. <td> "<code id=attributes-3:attr-ol-type-keyword-decimal><a href=#attr-ol-type-keyword-decimal>1</a></code>";
  58542. "<code id=attributes-3:attr-ol-type-keyword-lower-alpha><a href=#attr-ol-type-keyword-lower-alpha>a</a></code>";
  58543. "<code id=attributes-3:attr-ol-type-keyword-upper-alpha><a href=#attr-ol-type-keyword-upper-alpha>A</a></code>";
  58544. "<code id=attributes-3:attr-ol-type-keyword-lower-roman><a href=#attr-ol-type-keyword-lower-roman>i</a></code>";
  58545. "<code id=attributes-3:attr-ol-type-keyword-upper-roman><a href=#attr-ol-type-keyword-upper-roman>I</a></code>"
  58546. <tr><th> <code>typemustmatch</code>
  58547. <td> <code id=attributes-3:attr-object-typemustmatch><a href=#attr-object-typemustmatch>object</a></code>
  58548. <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
  58549. <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-28>Boolean attribute</a>
  58550. <tr><th> <code>usemap</code>
  58551. <td> <code id=attributes-3:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>img</a></code>;
  58552. <code id=attributes-3:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>object</a></code>
  58553. <td> Name of <a href=#image-map id=attributes-3:image-map-4>image map</a> to use
  58554. <td> <a href=#valid-hash-name-reference id=attributes-3:valid-hash-name-reference>Valid hash-name reference</a>*
  58555. <tr><th> <code>value</code>
  58556. <td> <code id=attributes-3:attr-button-value><a href=#attr-button-value>button</a></code>;
  58557. <code id=attributes-3:attr-option-value><a href=#attr-option-value>option</a></code>
  58558. <td> Value to be used for <a href=#form-submission-2 id=attributes-3:form-submission-2-16>form submission</a>
  58559. <td> <a href=#attribute-text>Text</a>
  58560. <tr><th> <code>value</code>
  58561. <td> <code id=attributes-3:attr-data-value><a href=#attr-data-value>data</a></code>
  58562. <td> Machine-readable value
  58563. <td> <a href=#attribute-text>Text</a>*
  58564. <tr><th> <code>value</code>
  58565. <td> <code id=attributes-3:attr-input-value><a href=#attr-input-value>input</a></code>
  58566. <td> Value of the form control
  58567. <td> Varies*
  58568. <tr><th> <code>value</code>
  58569. <td> <code id=attributes-3:attr-li-value><a href=#attr-li-value>li</a></code>
  58570. <td> <a href=#ordinal-value id=attributes-3:ordinal-value-2>Ordinal value</a> of the list item
  58571. <td> <a href=#valid-integer id=attributes-3:valid-integer-3>Valid integer</a>
  58572. <tr><th> <code>value</code>
  58573. <td> <code id=attributes-3:attr-meter-value><a href=#attr-meter-value>meter</a></code>;
  58574. <code id=attributes-3:attr-progress-value><a href=#attr-progress-value>progress</a></code>
  58575. <td> Current value of the element
  58576. <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-7>Valid floating-point number</a>
  58577. <tr><th> <code>value</code>
  58578. <td> <code id=attributes-3:attr-param-value><a href=#attr-param-value>param</a></code>
  58579. <td> Value of parameter
  58580. <td> <a href=#attribute-text>Text</a>
  58581. <tr><th> <code>width</code>
  58582. <td> <code id=attributes-3:attr-canvas-width><a href=#attr-canvas-width>canvas</a></code>;
  58583. <code id=attributes-3:attr-dim-width><a href=#attr-dim-width>embed</a></code>;
  58584. <code id=attributes-3:attr-dim-width-2><a href=#attr-dim-width>iframe</a></code>;
  58585. <code id=attributes-3:attr-dim-width-3><a href=#attr-dim-width>img</a></code>;
  58586. <code id=attributes-3:attr-dim-width-4><a href=#attr-dim-width>input</a></code>;
  58587. <code id=attributes-3:attr-dim-width-5><a href=#attr-dim-width>object</a></code>;
  58588. <code id=attributes-3:attr-dim-width-6><a href=#attr-dim-width>video</a></code>
  58589. <td> Horizontal dimension
  58590. <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-12>Valid non-negative integer</a>
  58591. <tr><th> <code>wrap</code>
  58592. <td> <code id=attributes-3:attr-textarea-wrap><a href=#attr-textarea-wrap>textarea</a></code>
  58593. <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>
  58594. <td> "<code id=attributes-3:attr-textarea-wrap-soft><a href=#attr-textarea-wrap-soft>soft</a></code>";
  58595. "<code id=attributes-3:attr-textarea-wrap-hard><a href=#attr-textarea-wrap-hard>hard</a></code>"
  58596. </table>
  58597. <p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
  58598. complicated than indicated in the table above.</small></p>
  58599. <hr>
  58600. <table id=ix-event-handlers><caption>List of event handler content attributes</caption><thead><tr><th> Attribute
  58601. <th> Element(s)
  58602. <th> Description
  58603. <th> Value
  58604. <tbody><tr><th id=ix-handler-onabort> <code>onabort</code>
  58605. <td> <a href=#handler-onabort id=attributes-3:handler-onabort>HTML elements</a>
  58606. <td> <code id=attributes-3:event-abort><a href=#event-abort>abort</a></code> event handler
  58607. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes>Event handler content attribute</a>
  58608. <tr><th id=ix-handler-onautocomplete> <code>onautocomplete</code>
  58609. <td> <a href=#handler-onautocomplete id=attributes-3:handler-onautocomplete>HTML elements</a>
  58610. <td> <code id=attributes-3:event-autocomplete><a href=#event-autocomplete>autocomplete</a></code> event handler
  58611. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-2>Event handler content attribute</a>
  58612. <tr><th id=ix-handler-onautocompleteerror> <code>onautocompleteerror</code>
  58613. <td> <a href=#handler-onautocompleteerror id=attributes-3:handler-onautocompleteerror>HTML elements</a>
  58614. <td> <code id=attributes-3:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> event handler
  58615. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-3>Event handler content attribute</a>
  58616. <tr><th id=ix-handler-window-onafterprint> <code>onafterprint</code>
  58617. <td> <code id=attributes-3:handler-window-onafterprint><a href=#handler-window-onafterprint>body</a></code>
  58618. <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
  58619. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-4>Event handler content attribute</a>
  58620. <tr><th id=ix-handler-window-onbeforeprint> <code>onbeforeprint</code>
  58621. <td> <code id=attributes-3:handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>body</a></code>
  58622. <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
  58623. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-5>Event handler content attribute</a>
  58624. <tr><th id=ix-handler-window-onbeforeunload> <code>onbeforeunload</code>
  58625. <td> <code id=attributes-3:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>body</a></code>
  58626. <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
  58627. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-6>Event handler content attribute</a>
  58628. <tr><th id=ix-handler-onblur> <code>onblur</code>
  58629. <td> <a href=#handler-onblur id=attributes-3:handler-onblur>HTML elements</a>
  58630. <td> <code id=attributes-3:event-blur><a href=#event-blur>blur</a></code> event handler
  58631. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-7>Event handler content attribute</a>
  58632. <tr><th id=ix-handler-oncancel> <code>oncancel</code>
  58633. <td> <a href=#handler-oncancel id=attributes-3:handler-oncancel>HTML elements</a>
  58634. <td> <code id=attributes-3:event-cancel><a href=#event-cancel>cancel</a></code> event handler
  58635. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-8>Event handler content attribute</a>
  58636. <tr><th id=ix-handler-oncanplay> <code>oncanplay</code>
  58637. <td> <a href=#handler-oncanplay id=attributes-3:handler-oncanplay>HTML elements</a>
  58638. <td> <code id=attributes-3:event-media-canplay><a href=#event-media-canplay>canplay</a></code> event handler
  58639. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-9>Event handler content attribute</a>
  58640. <tr><th id=ix-handler-oncanplaythrough> <code>oncanplaythrough</code>
  58641. <td> <a href=#handler-oncanplaythrough id=attributes-3:handler-oncanplaythrough>HTML elements</a>
  58642. <td> <code id=attributes-3:event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> event handler
  58643. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-10>Event handler content attribute</a>
  58644. <tr><th id=ix-handler-onchange> <code>onchange</code>
  58645. <td> <a href=#handler-onchange id=attributes-3:handler-onchange>HTML elements</a>
  58646. <td> <code id=attributes-3:event-change><a href=#event-change>change</a></code> event handler
  58647. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-11>Event handler content attribute</a>
  58648. <tr><th id=ix-handler-onclick> <code>onclick</code>
  58649. <td> <a href=#handler-onclick id=attributes-3:handler-onclick>HTML elements</a>
  58650. <td> <code id=attributes-3:event-click><a href=#event-click>click</a></code> event handler
  58651. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-12>Event handler content attribute</a>
  58652. <tr><th id=ix-handler-onclose> <code>onclose</code>
  58653. <td> <a href=#handler-onclose id=attributes-3:handler-onclose>HTML elements</a>
  58654. <td> <code id=attributes-3:event-close><a href=#event-close>close</a></code> event handler
  58655. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-13>Event handler content attribute</a>
  58656. <tr><th id=ix-handler-oncontextmenu> <code>oncontextmenu</code>
  58657. <td> <a href=#handler-oncontextmenu id=attributes-3:handler-oncontextmenu>HTML elements</a>
  58658. <td> <code id=attributes-3:event-contextmenu><a href=#event-contextmenu>contextmenu</a></code> event handler
  58659. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-14>Event handler content attribute</a>
  58660. <tr><th id=ix-handler-oncuechange> <code>oncuechange</code>
  58661. <td> <a href=#handler-oncuechange id=attributes-3:handler-oncuechange>HTML elements</a>
  58662. <td> <code id=attributes-3:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code> event handler
  58663. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-15>Event handler content attribute</a>
  58664. <tr><th id=ix-handler-ondblclick> <code>ondblclick</code>
  58665. <td> <a href=#handler-ondblclick id=attributes-3:handler-ondblclick>HTML elements</a>
  58666. <td> <code id=attributes-3:event-dblclick><a href=#event-dblclick>dblclick</a></code> event handler
  58667. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-16>Event handler content attribute</a>
  58668. <tr><th id=ix-handler-ondrag> <code>ondrag</code>
  58669. <td> <a href=#handler-ondrag id=attributes-3:handler-ondrag>HTML elements</a>
  58670. <td> <code id=attributes-3:event-dnd-drag><a href=#event-dnd-drag>drag</a></code> event handler
  58671. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-17>Event handler content attribute</a>
  58672. <tr><th id=ix-handler-ondragend> <code>ondragend</code>
  58673. <td> <a href=#handler-ondragend id=attributes-3:handler-ondragend>HTML elements</a>
  58674. <td> <code id=attributes-3:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code> event handler
  58675. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-18>Event handler content attribute</a>
  58676. <tr><th id=ix-handler-ondragenter> <code>ondragenter</code>
  58677. <td> <a href=#handler-ondragenter id=attributes-3:handler-ondragenter>HTML elements</a>
  58678. <td> <code id=attributes-3:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> event handler
  58679. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-19>Event handler content attribute</a>
  58680. <tr><th id=ix-handler-ondragexit> <code>ondragexit</code>
  58681. <td> <a href=#handler-ondragexit id=attributes-3:handler-ondragexit>HTML elements</a>
  58682. <td> <code id=attributes-3:event-dnd-dragexit><a href=#event-dnd-dragexit>dragexit</a></code> event handler
  58683. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-20>Event handler content attribute</a>
  58684. <tr><th id=ix-handler-ondragleave> <code>ondragleave</code>
  58685. <td> <a href=#handler-ondragleave id=attributes-3:handler-ondragleave>HTML elements</a>
  58686. <td> <code id=attributes-3:event-dnd-dragleave><a href=#event-dnd-dragleave>dragleave</a></code> event handler
  58687. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-21>Event handler content attribute</a>
  58688. <tr><th id=ix-handler-ondragover> <code>ondragover</code>
  58689. <td> <a href=#handler-ondragover id=attributes-3:handler-ondragover>HTML elements</a>
  58690. <td> <code id=attributes-3:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code> event handler
  58691. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-22>Event handler content attribute</a>
  58692. <tr><th id=ix-handler-ondragstart> <code>ondragstart</code>
  58693. <td> <a href=#handler-ondragstart id=attributes-3:handler-ondragstart>HTML elements</a>
  58694. <td> <code id=attributes-3:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event handler
  58695. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-23>Event handler content attribute</a>
  58696. <tr><th id=ix-handler-ondrop> <code>ondrop</code>
  58697. <td> <a href=#handler-ondrop id=attributes-3:handler-ondrop>HTML elements</a>
  58698. <td> <code id=attributes-3:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event handler
  58699. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-24>Event handler content attribute</a>
  58700. <tr><th id=ix-handler-ondurationchange> <code>ondurationchange</code>
  58701. <td> <a href=#handler-ondurationchange id=attributes-3:handler-ondurationchange>HTML elements</a>
  58702. <td> <code id=attributes-3:event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event handler
  58703. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-25>Event handler content attribute</a>
  58704. <tr><th id=ix-handler-onemptied> <code>onemptied</code>
  58705. <td> <a href=#handler-onemptied id=attributes-3:handler-onemptied>HTML elements</a>
  58706. <td> <code id=attributes-3:event-media-emptied><a href=#event-media-emptied>emptied</a></code> event handler
  58707. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-26>Event handler content attribute</a>
  58708. <tr><th id=ix-handler-onended> <code>onended</code>
  58709. <td> <a href=#handler-onended id=attributes-3:handler-onended>HTML elements</a>
  58710. <td> <code id=attributes-3:event-media-ended><a href=#event-media-ended>ended</a></code> event handler
  58711. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-27>Event handler content attribute</a>
  58712. <tr><th id=ix-handler-onerror> <code>onerror</code>
  58713. <td> <a href=#handler-onerror id=attributes-3:handler-onerror>HTML elements</a>
  58714. <td> <code id=attributes-3:event-error><a href=#event-error>error</a></code> event handler
  58715. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-28>Event handler content attribute</a>
  58716. <tr><th id=ix-handler-onfocus> <code>onfocus</code>
  58717. <td> <a href=#handler-onfocus id=attributes-3:handler-onfocus>HTML elements</a>
  58718. <td> <code id=attributes-3:event-focus><a href=#event-focus>focus</a></code> event handler
  58719. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-29>Event handler content attribute</a>
  58720. <tr><th id=ix-handler-window-onhashchange> <code>onhashchange</code>
  58721. <td> <code id=attributes-3:handler-window-onhashchange><a href=#handler-window-onhashchange>body</a></code>
  58722. <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
  58723. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-30>Event handler content attribute</a>
  58724. <tr><th id=ix-handler-oninput> <code>oninput</code>
  58725. <td> <a href=#handler-oninput id=attributes-3:handler-oninput>HTML elements</a>
  58726. <td> <code id=attributes-3:event-input><a href=#event-input>input</a></code> event handler
  58727. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-31>Event handler content attribute</a>
  58728. <tr><th id=ix-handler-oninvalid> <code>oninvalid</code>
  58729. <td> <a href=#handler-oninvalid id=attributes-3:handler-oninvalid>HTML elements</a>
  58730. <td> <code id=attributes-3:event-invalid><a href=#event-invalid>invalid</a></code> event handler
  58731. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-32>Event handler content attribute</a>
  58732. <tr><th id=ix-handler-onkeydown> <code>onkeydown</code>
  58733. <td> <a href=#handler-onkeydown id=attributes-3:handler-onkeydown>HTML elements</a>
  58734. <td> <code id=attributes-3:event-keydown><a href=#event-keydown>keydown</a></code> event handler
  58735. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-33>Event handler content attribute</a>
  58736. <tr><th id=ix-handler-onkeypress> <code>onkeypress</code>
  58737. <td> <a href=#handler-onkeypress id=attributes-3:handler-onkeypress>HTML elements</a>
  58738. <td> <code id=attributes-3:event-keypress><a href=#event-keypress>keypress</a></code> event handler
  58739. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-34>Event handler content attribute</a>
  58740. <tr><th id=ix-handler-onkeyup> <code>onkeyup</code>
  58741. <td> <a href=#handler-onkeyup id=attributes-3:handler-onkeyup>HTML elements</a>
  58742. <td> <code id=attributes-3:event-keyup><a href=#event-keyup>keyup</a></code> event handler
  58743. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-35>Event handler content attribute</a>
  58744. <tr><th id=ix-handler-window-onlanguagechange> <code>onlanguagechange</code>
  58745. <td> <code id=attributes-3:handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>body</a></code>
  58746. <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
  58747. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-36>Event handler content attribute</a>
  58748. <tr><th id=ix-handler-onload> <code>onload</code>
  58749. <td> <a href=#handler-onload id=attributes-3:handler-onload>HTML elements</a>
  58750. <td> <code id=attributes-3:event-load><a href=#event-load>load</a></code> event handler
  58751. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-37>Event handler content attribute</a>
  58752. <tr><th id=ix-handler-onloadeddata> <code>onloadeddata</code>
  58753. <td> <a href=#handler-onloadeddata id=attributes-3:handler-onloadeddata>HTML elements</a>
  58754. <td> <code id=attributes-3:event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> event handler
  58755. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-38>Event handler content attribute</a>
  58756. <tr><th id=ix-handler-onloadedmetadata> <code>onloadedmetadata</code>
  58757. <td> <a href=#handler-onloadedmetadata id=attributes-3:handler-onloadedmetadata>HTML elements</a>
  58758. <td> <code id=attributes-3:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> event handler
  58759. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-39>Event handler content attribute</a>
  58760. <tr><th id=ix-handler-onloadstart> <code>onloadstart</code>
  58761. <td> <a href=#handler-onloadstart id=attributes-3:handler-onloadstart>HTML elements</a>
  58762. <td> <code id=attributes-3:event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> event handler
  58763. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-40>Event handler content attribute</a>
  58764. <tr><th id=ix-handler-window-onmessage> <code>onmessage</code>
  58765. <td> <code id=attributes-3:handler-window-onmessage><a href=#handler-window-onmessage>body</a></code>
  58766. <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
  58767. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-41>Event handler content attribute</a>
  58768. <tr><th id=ix-handler-onmousedown> <code>onmousedown</code>
  58769. <td> <a href=#handler-onmousedown id=attributes-3:handler-onmousedown>HTML elements</a>
  58770. <td> <code id=attributes-3:event-mousedown><a href=#event-mousedown>mousedown</a></code> event handler
  58771. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-42>Event handler content attribute</a>
  58772. <tr><th id=ix-handler-onmouseenter> <code>onmouseenter</code>
  58773. <td> <a href=#handler-onmouseenter id=attributes-3:handler-onmouseenter>HTML elements</a>
  58774. <td> <code id=attributes-3:event-mouseenter><a href=#event-mouseenter>mouseenter</a></code> event handler
  58775. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-43>Event handler content attribute</a>
  58776. <tr><th id=ix-handler-onmouseleave> <code>onmouseleave</code>
  58777. <td> <a href=#handler-onmouseleave id=attributes-3:handler-onmouseleave>HTML elements</a>
  58778. <td> <code id=attributes-3:event-mouseleave><a href=#event-mouseleave>mouseleave</a></code> event handler
  58779. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-44>Event handler content attribute</a>
  58780. <tr><th id=ix-handler-onmousemove> <code>onmousemove</code>
  58781. <td> <a href=#handler-onmousemove id=attributes-3:handler-onmousemove>HTML elements</a>
  58782. <td> <code id=attributes-3:event-mousemove><a href=#event-mousemove>mousemove</a></code> event handler
  58783. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-45>Event handler content attribute</a>
  58784. <tr><th id=ix-handler-onmouseout> <code>onmouseout</code>
  58785. <td> <a href=#handler-onmouseout id=attributes-3:handler-onmouseout>HTML elements</a>
  58786. <td> <code id=attributes-3:event-mouseout><a href=#event-mouseout>mouseout</a></code> event handler
  58787. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-46>Event handler content attribute</a>
  58788. <tr><th id=ix-handler-onmouseover> <code>onmouseover</code>
  58789. <td> <a href=#handler-onmouseover id=attributes-3:handler-onmouseover>HTML elements</a>
  58790. <td> <code id=attributes-3:event-mouseover><a href=#event-mouseover>mouseover</a></code> event handler
  58791. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-47>Event handler content attribute</a>
  58792. <tr><th id=ix-handler-onmouseup> <code>onmouseup</code>
  58793. <td> <a href=#handler-onmouseup id=attributes-3:handler-onmouseup>HTML elements</a>
  58794. <td> <code id=attributes-3:event-mouseup><a href=#event-mouseup>mouseup</a></code> event handler
  58795. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-48>Event handler content attribute</a>
  58796. <tr><th id=ix-handler-onmousewheel> <code>onmousewheel</code>
  58797. <td> <a href=#handler-onmousewheel id=attributes-3:handler-onmousewheel>HTML elements</a>
  58798. <td> <code id=attributes-3:event-mousewheel><a href=#event-mousewheel>mousewheel</a></code> event handler
  58799. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-49>Event handler content attribute</a>
  58800. <tr><th id=ix-handler-window-onoffline> <code>onoffline</code>
  58801. <td> <code id=attributes-3:handler-window-onoffline><a href=#handler-window-onoffline>body</a></code>
  58802. <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
  58803. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-50>Event handler content attribute</a>
  58804. <tr><th id=ix-handler-window-ononline> <code>ononline</code>
  58805. <td> <code id=attributes-3:handler-window-ononline><a href=#handler-window-ononline>body</a></code>
  58806. <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
  58807. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-51>Event handler content attribute</a>
  58808. <tr><th id=ix-handler-window-onpagehide> <code>onpagehide</code>
  58809. <td> <code id=attributes-3:handler-window-onpagehide><a href=#handler-window-onpagehide>body</a></code>
  58810. <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
  58811. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-52>Event handler content attribute</a>
  58812. <tr><th id=ix-handler-window-onpageshow> <code>onpageshow</code>
  58813. <td> <code id=attributes-3:handler-window-onpageshow><a href=#handler-window-onpageshow>body</a></code>
  58814. <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
  58815. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-53>Event handler content attribute</a>
  58816. <tr><th id=ix-handler-onpause> <code>onpause</code>
  58817. <td> <a href=#handler-onpause id=attributes-3:handler-onpause>HTML elements</a>
  58818. <td> <code id=attributes-3:event-media-pause><a href=#event-media-pause>pause</a></code> event handler
  58819. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-54>Event handler content attribute</a>
  58820. <tr><th id=ix-handler-onplay> <code>onplay</code>
  58821. <td> <a href=#handler-onplay id=attributes-3:handler-onplay>HTML elements</a>
  58822. <td> <code id=attributes-3:event-media-play><a href=#event-media-play>play</a></code> event handler
  58823. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-55>Event handler content attribute</a>
  58824. <tr><th id=ix-handler-onplaying> <code>onplaying</code>
  58825. <td> <a href=#handler-onplaying id=attributes-3:handler-onplaying>HTML elements</a>
  58826. <td> <code id=attributes-3:event-media-playing><a href=#event-media-playing>playing</a></code> event handler
  58827. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-56>Event handler content attribute</a>
  58828. <tr><th id=ix-handler-window-onpopstate> <code>onpopstate</code>
  58829. <td> <code id=attributes-3:handler-window-onpopstate><a href=#handler-window-onpopstate>body</a></code>
  58830. <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
  58831. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-57>Event handler content attribute</a>
  58832. <tr><th id=ix-handler-onprogress> <code>onprogress</code>
  58833. <td> <a href=#handler-onprogress id=attributes-3:handler-onprogress>HTML elements</a>
  58834. <td> <code id=attributes-3:event-media-progress><a href=#event-media-progress>progress</a></code> event handler
  58835. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-58>Event handler content attribute</a>
  58836. <tr><th id=ix-handler-onratechange> <code>onratechange</code>
  58837. <td> <a href=#handler-onratechange id=attributes-3:handler-onratechange>HTML elements</a>
  58838. <td> <code id=attributes-3:event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> event handler
  58839. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-59>Event handler content attribute</a>
  58840. <tr><th id=ix-handler-onreset> <code>onreset</code>
  58841. <td> <a href=#handler-onreset id=attributes-3:handler-onreset>HTML elements</a>
  58842. <td> <code id=attributes-3:event-reset><a href=#event-reset>reset</a></code> event handler
  58843. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-60>Event handler content attribute</a>
  58844. <tr><th id=ix-handler-onresize> <code>onresize</code>
  58845. <td> <a href=#handler-onresize id=attributes-3:handler-onresize>HTML elements</a>
  58846. <td> <code id=attributes-3:event-resize><a href=#event-resize>resize</a></code> event handler
  58847. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-61>Event handler content attribute</a>
  58848. <tr><th id=ix-handler-onscroll> <code>onscroll</code>
  58849. <td> <a href=#handler-onscroll id=attributes-3:handler-onscroll>HTML elements</a>
  58850. <td> <code id=attributes-3:event-scroll><a href=#event-scroll>scroll</a></code> event handler
  58851. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-62>Event handler content attribute</a>
  58852. <tr><th id=ix-handler-onseeked> <code>onseeked</code>
  58853. <td> <a href=#handler-onseeked id=attributes-3:handler-onseeked>HTML elements</a>
  58854. <td> <code id=attributes-3:event-media-seeked><a href=#event-media-seeked>seeked</a></code> event handler
  58855. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-63>Event handler content attribute</a>
  58856. <tr><th id=ix-handler-onseeking> <code>onseeking</code>
  58857. <td> <a href=#handler-onseeking id=attributes-3:handler-onseeking>HTML elements</a>
  58858. <td> <code id=attributes-3:event-media-seeking><a href=#event-media-seeking>seeking</a></code> event handler
  58859. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-64>Event handler content attribute</a>
  58860. <tr><th id=ix-handler-onselect> <code>onselect</code>
  58861. <td> <a href=#handler-onselect id=attributes-3:handler-onselect>HTML elements</a>
  58862. <td> <code id=attributes-3:event-select><a href=#event-select>select</a></code> event handler
  58863. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-65>Event handler content attribute</a>
  58864. <tr><th id=ix-handler-onshow> <code>onshow</code>
  58865. <td> <a href=#handler-onshow id=attributes-3:handler-onshow>HTML elements</a>
  58866. <td> <code id=attributes-3:event-show><a href=#event-show>show</a></code> event handler
  58867. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-66>Event handler content attribute</a>
  58868. <tr><th id=ix-handler-onsort> <code>onsort</code>
  58869. <td> <a href=#handler-onsort id=attributes-3:handler-onsort>HTML elements</a>
  58870. <td> <code id=attributes-3:event-sort><a href=#event-sort>sort</a></code> event handler
  58871. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-67>Event handler content attribute</a>
  58872. <tr><th id=ix-handler-onstalled> <code>onstalled</code>
  58873. <td> <a href=#handler-onstalled id=attributes-3:handler-onstalled>HTML elements</a>
  58874. <td> <code id=attributes-3:event-media-stalled><a href=#event-media-stalled>stalled</a></code> event handler
  58875. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-68>Event handler content attribute</a>
  58876. <tr><th id=ix-handler-window-onstorage> <code>onstorage</code>
  58877. <td> <code id=attributes-3:handler-window-onstorage><a href=#handler-window-onstorage>body</a></code>
  58878. <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
  58879. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-69>Event handler content attribute</a>
  58880. <tr><th id=ix-handler-onsubmit> <code>onsubmit</code>
  58881. <td> <a href=#handler-onsubmit id=attributes-3:handler-onsubmit>HTML elements</a>
  58882. <td> <code id=attributes-3:event-submit><a href=#event-submit>submit</a></code> event handler
  58883. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-70>Event handler content attribute</a>
  58884. <tr><th id=ix-handler-onsuspend> <code>onsuspend</code>
  58885. <td> <a href=#handler-onsuspend id=attributes-3:handler-onsuspend>HTML elements</a>
  58886. <td> <code id=attributes-3:event-media-suspend><a href=#event-media-suspend>suspend</a></code> event handler
  58887. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-71>Event handler content attribute</a>
  58888. <tr><th id=ix-handler-ontimeupdate> <code>ontimeupdate</code>
  58889. <td> <a href=#handler-ontimeupdate id=attributes-3:handler-ontimeupdate>HTML elements</a>
  58890. <td> <code id=attributes-3:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event handler
  58891. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-72>Event handler content attribute</a>
  58892. <tr><th id=ix-handler-ontoggle> <code>ontoggle</code>
  58893. <td> <a href=#handler-ontoggle id=attributes-3:handler-ontoggle>HTML elements</a>
  58894. <td> <code id=attributes-3:event-toggle><a href=#event-toggle>toggle</a></code> event handler
  58895. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-73>Event handler content attribute</a>
  58896. <tr><th id=ix-handler-window-onunload> <code>onunload</code>
  58897. <td> <code id=attributes-3:handler-window-onunload><a href=#handler-window-onunload>body</a></code>
  58898. <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
  58899. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-74>Event handler content attribute</a>
  58900. <tr><th id=ix-handler-onvolumechange> <code>onvolumechange</code>
  58901. <td> <a href=#handler-onvolumechange id=attributes-3:handler-onvolumechange>HTML elements</a>
  58902. <td> <code id=attributes-3:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event handler
  58903. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-75>Event handler content attribute</a>
  58904. <tr><th id=ix-handler-onwaiting> <code>onwaiting</code>
  58905. <td> <a href=#handler-onwaiting id=attributes-3:handler-onwaiting>HTML elements</a>
  58906. <td> <code id=attributes-3:event-media-waiting><a href=#event-media-waiting>waiting</a></code> event handler
  58907. <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-76>Event handler content attribute</a>
  58908. </table>
  58909. <h3 id=element-interfaces class=no-num>Element Interfaces</h3>
  58910. <p><i>This section is non-normative.</i></p>
  58911. <table><caption>List of interfaces for elements</caption><thead><tr><th> Element(s)
  58912. <th> Interface(s)
  58913. <tbody><tr><td> <code id=element-interfaces:the-a-element><a href=#the-a-element>a</a></code>
  58914. <td> <code id=element-interfaces:htmlanchorelement><a href=#htmlanchorelement>HTMLAnchorElement</a></code> : <code id=element-interfaces:htmlelement><a href=#htmlelement>HTMLElement</a></code>
  58915. <tr><td> <code id=element-interfaces:the-abbr-element><a href=#the-abbr-element>abbr</a></code>
  58916. <td> <code id=element-interfaces:htmlelement-2><a href=#htmlelement>HTMLElement</a></code>
  58917. <tr><td> <code id=element-interfaces:the-address-element><a href=#the-address-element>address</a></code>
  58918. <td> <code id=element-interfaces:htmlelement-3><a href=#htmlelement>HTMLElement</a></code>
  58919. <tr><td> <code id=element-interfaces:the-area-element><a href=#the-area-element>area</a></code>
  58920. <td> <code id=element-interfaces:htmlareaelement><a href=#htmlareaelement>HTMLAreaElement</a></code> : <code id=element-interfaces:htmlelement-4><a href=#htmlelement>HTMLElement</a></code>
  58921. <tr><td> <code id=element-interfaces:the-article-element><a href=#the-article-element>article</a></code>
  58922. <td> <code id=element-interfaces:htmlelement-5><a href=#htmlelement>HTMLElement</a></code>
  58923. <tr><td> <code id=element-interfaces:the-aside-element><a href=#the-aside-element>aside</a></code>
  58924. <td> <code id=element-interfaces:htmlelement-6><a href=#htmlelement>HTMLElement</a></code>
  58925. <tr><td> <code id=element-interfaces:the-audio-element><a href=#the-audio-element>audio</a></code>
  58926. <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>
  58927. <tr><td> <code id=element-interfaces:the-b-element><a href=#the-b-element>b</a></code>
  58928. <td> <code id=element-interfaces:htmlelement-8><a href=#htmlelement>HTMLElement</a></code>
  58929. <tr><td> <code id=element-interfaces:the-base-element><a href=#the-base-element>base</a></code>
  58930. <td> <code id=element-interfaces:htmlbaseelement><a href=#htmlbaseelement>HTMLBaseElement</a></code> : <code id=element-interfaces:htmlelement-9><a href=#htmlelement>HTMLElement</a></code>
  58931. <tr><td> <code id=element-interfaces:the-bdi-element><a href=#the-bdi-element>bdi</a></code>
  58932. <td> <code id=element-interfaces:htmlelement-10><a href=#htmlelement>HTMLElement</a></code>
  58933. <tr><td> <code id=element-interfaces:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
  58934. <td> <code id=element-interfaces:htmlelement-11><a href=#htmlelement>HTMLElement</a></code>
  58935. <tr><td> <code id=element-interfaces:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>
  58936. <td> <code id=element-interfaces:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code id=element-interfaces:htmlelement-12><a href=#htmlelement>HTMLElement</a></code>
  58937. <tr><td> <code id=element-interfaces:the-body-element><a href=#the-body-element>body</a></code>
  58938. <td> <code id=element-interfaces:htmlbodyelement><a href=#htmlbodyelement>HTMLBodyElement</a></code> : <code id=element-interfaces:htmlelement-13><a href=#htmlelement>HTMLElement</a></code>
  58939. <tr><td> <code id=element-interfaces:the-br-element><a href=#the-br-element>br</a></code>
  58940. <td> <code id=element-interfaces:htmlbrelement><a href=#htmlbrelement>HTMLBRElement</a></code> : <code id=element-interfaces:htmlelement-14><a href=#htmlelement>HTMLElement</a></code>
  58941. <tr><td> <code id=element-interfaces:the-button-element><a href=#the-button-element>button</a></code>
  58942. <td> <code id=element-interfaces:htmlbuttonelement><a href=#htmlbuttonelement>HTMLButtonElement</a></code> : <code id=element-interfaces:htmlelement-15><a href=#htmlelement>HTMLElement</a></code>
  58943. <tr><td> <code id=element-interfaces:the-canvas-element><a href=#the-canvas-element>canvas</a></code>
  58944. <td> <code id=element-interfaces:htmlcanvaselement><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> : <code id=element-interfaces:htmlelement-16><a href=#htmlelement>HTMLElement</a></code>
  58945. <tr><td> <code id=element-interfaces:the-caption-element><a href=#the-caption-element>caption</a></code>
  58946. <td> <code id=element-interfaces:htmltablecaptionelement><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code> : <code id=element-interfaces:htmlelement-17><a href=#htmlelement>HTMLElement</a></code>
  58947. <tr><td> <code id=element-interfaces:the-cite-element><a href=#the-cite-element>cite</a></code>
  58948. <td> <code id=element-interfaces:htmlelement-18><a href=#htmlelement>HTMLElement</a></code>
  58949. <tr><td> <code id=element-interfaces:the-code-element><a href=#the-code-element>code</a></code>
  58950. <td> <code id=element-interfaces:htmlelement-19><a href=#htmlelement>HTMLElement</a></code>
  58951. <tr><td> <code id=element-interfaces:the-col-element><a href=#the-col-element>col</a></code>
  58952. <td> <code id=element-interfaces:htmltablecolelement><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code id=element-interfaces:htmlelement-20><a href=#htmlelement>HTMLElement</a></code>
  58953. <tr><td> <code id=element-interfaces:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>
  58954. <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>
  58955. <tr><td> <code id=element-interfaces:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>
  58956. <td> <code id=element-interfaces:htmlmenuitemelement><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code> : <code id=element-interfaces:htmlelement-22><a href=#htmlelement>HTMLElement</a></code>
  58957. <tr><td> <code id=element-interfaces:the-data-element><a href=#the-data-element>data</a></code>
  58958. <td> <code id=element-interfaces:htmldataelement><a href=#htmldataelement>HTMLDataElement</a></code> : <code id=element-interfaces:htmlelement-23><a href=#htmlelement>HTMLElement</a></code>
  58959. <tr><td> <code id=element-interfaces:the-datalist-element><a href=#the-datalist-element>datalist</a></code>
  58960. <td> <code id=element-interfaces:htmldatalistelement><a href=#htmldatalistelement>HTMLDataListElement</a></code> : <code id=element-interfaces:htmlelement-24><a href=#htmlelement>HTMLElement</a></code>
  58961. <tr><td> <code id=element-interfaces:the-dd-element><a href=#the-dd-element>dd</a></code>
  58962. <td> <code id=element-interfaces:htmlelement-25><a href=#htmlelement>HTMLElement</a></code>
  58963. <tr><td> <code id=element-interfaces:the-del-element><a href=#the-del-element>del</a></code>
  58964. <td> <code id=element-interfaces:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> : <code id=element-interfaces:htmlelement-26><a href=#htmlelement>HTMLElement</a></code>
  58965. <tr><td> <code id=element-interfaces:the-details-element><a href=#the-details-element>details</a></code>
  58966. <td> <code id=element-interfaces:htmldetailselement><a href=#htmldetailselement>HTMLDetailsElement</a></code> : <code id=element-interfaces:htmlelement-27><a href=#htmlelement>HTMLElement</a></code>
  58967. <tr><td> <code id=element-interfaces:the-dfn-element><a href=#the-dfn-element>dfn</a></code>
  58968. <td> <code id=element-interfaces:htmlelement-28><a href=#htmlelement>HTMLElement</a></code>
  58969. <tr><td> <code id=element-interfaces:the-dialog-element><a href=#the-dialog-element>dialog</a></code>
  58970. <td> <code id=element-interfaces:htmldialogelement><a href=#htmldialogelement>HTMLDialogElement</a></code> : <code id=element-interfaces:htmlelement-29><a href=#htmlelement>HTMLElement</a></code>
  58971. <tr><td> <code id=element-interfaces:the-div-element><a href=#the-div-element>div</a></code>
  58972. <td> <code id=element-interfaces:htmldivelement><a href=#htmldivelement>HTMLDivElement</a></code> : <code id=element-interfaces:htmlelement-30><a href=#htmlelement>HTMLElement</a></code>
  58973. <tr><td> <code id=element-interfaces:the-dl-element><a href=#the-dl-element>dl</a></code>
  58974. <td> <code id=element-interfaces:htmldlistelement><a href=#htmldlistelement>HTMLDListElement</a></code> : <code id=element-interfaces:htmlelement-31><a href=#htmlelement>HTMLElement</a></code>
  58975. <tr><td> <code id=element-interfaces:the-dt-element><a href=#the-dt-element>dt</a></code>
  58976. <td> <code id=element-interfaces:htmlelement-32><a href=#htmlelement>HTMLElement</a></code>
  58977. <tr><td> <code id=element-interfaces:the-em-element><a href=#the-em-element>em</a></code>
  58978. <td> <code id=element-interfaces:htmlelement-33><a href=#htmlelement>HTMLElement</a></code>
  58979. <tr><td> <code id=element-interfaces:the-embed-element><a href=#the-embed-element>embed</a></code>
  58980. <td> <code id=element-interfaces:htmlembedelement><a href=#htmlembedelement>HTMLEmbedElement</a></code> : <code id=element-interfaces:htmlelement-34><a href=#htmlelement>HTMLElement</a></code>
  58981. <tr><td> <code id=element-interfaces:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>
  58982. <td> <code id=element-interfaces:htmlfieldsetelement><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code> : <code id=element-interfaces:htmlelement-35><a href=#htmlelement>HTMLElement</a></code>
  58983. <tr><td> <code id=element-interfaces:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code>
  58984. <td> <code id=element-interfaces:htmlelement-36><a href=#htmlelement>HTMLElement</a></code>
  58985. <tr><td> <code id=element-interfaces:the-figure-element><a href=#the-figure-element>figure</a></code>
  58986. <td> <code id=element-interfaces:htmlelement-37><a href=#htmlelement>HTMLElement</a></code>
  58987. <tr><td> <code id=element-interfaces:the-footer-element><a href=#the-footer-element>footer</a></code>
  58988. <td> <code id=element-interfaces:htmlelement-38><a href=#htmlelement>HTMLElement</a></code>
  58989. <tr><td> <code id=element-interfaces:the-form-element><a href=#the-form-element>form</a></code>
  58990. <td> <code id=element-interfaces:htmlformelement><a href=#htmlformelement>HTMLFormElement</a></code> : <code id=element-interfaces:htmlelement-39><a href=#htmlelement>HTMLElement</a></code>
  58991. <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>
  58992. <td> <code id=element-interfaces:htmlheadingelement><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-40><a href=#htmlelement>HTMLElement</a></code>
  58993. <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>
  58994. <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>
  58995. <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>
  58996. <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>
  58997. <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>
  58998. <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>
  58999. <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>
  59000. <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>
  59001. <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>
  59002. <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>
  59003. <tr><td> <code id=element-interfaces:the-head-element><a href=#the-head-element>head</a></code>
  59004. <td> <code id=element-interfaces:htmlheadelement><a href=#htmlheadelement>HTMLHeadElement</a></code> : <code id=element-interfaces:htmlelement-46><a href=#htmlelement>HTMLElement</a></code>
  59005. <tr><td> <code id=element-interfaces:the-header-element><a href=#the-header-element>header</a></code>
  59006. <td> <code id=element-interfaces:htmlelement-47><a href=#htmlelement>HTMLElement</a></code>
  59007. <tr><td> <code id=element-interfaces:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>
  59008. <td> <code id=element-interfaces:htmlelement-48><a href=#htmlelement>HTMLElement</a></code>
  59009. <tr><td> <code id=element-interfaces:the-hr-element><a href=#the-hr-element>hr</a></code>
  59010. <td> <code id=element-interfaces:htmlhrelement><a href=#htmlhrelement>HTMLHRElement</a></code> : <code id=element-interfaces:htmlelement-49><a href=#htmlelement>HTMLElement</a></code>
  59011. <tr><td> <code id=element-interfaces:the-html-element><a href=#the-html-element>html</a></code>
  59012. <td> <code id=element-interfaces:htmlhtmlelement><a href=#htmlhtmlelement>HTMLHtmlElement</a></code> : <code id=element-interfaces:htmlelement-50><a href=#htmlelement>HTMLElement</a></code>
  59013. <tr><td> <code id=element-interfaces:the-i-element><a href=#the-i-element>i</a></code>
  59014. <td> <code id=element-interfaces:htmlelement-51><a href=#htmlelement>HTMLElement</a></code>
  59015. <tr><td> <code id=element-interfaces:the-iframe-element><a href=#the-iframe-element>iframe</a></code>
  59016. <td> <code id=element-interfaces:htmliframeelement><a href=#htmliframeelement>HTMLIFrameElement</a></code> : <code id=element-interfaces:htmlelement-52><a href=#htmlelement>HTMLElement</a></code>
  59017. <tr><td> <code id=element-interfaces:the-img-element><a href=#the-img-element>img</a></code>
  59018. <td> <code id=element-interfaces:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code> : <code id=element-interfaces:htmlelement-53><a href=#htmlelement>HTMLElement</a></code>
  59019. <tr><td> <code id=element-interfaces:the-input-element><a href=#the-input-element>input</a></code>
  59020. <td> <code id=element-interfaces:htmlinputelement><a href=#htmlinputelement>HTMLInputElement</a></code> : <code id=element-interfaces:htmlelement-54><a href=#htmlelement>HTMLElement</a></code>
  59021. <tr><td> <code id=element-interfaces:the-ins-element><a href=#the-ins-element>ins</a></code>
  59022. <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>
  59023. <tr><td> <code id=element-interfaces:the-kbd-element><a href=#the-kbd-element>kbd</a></code>
  59024. <td> <code id=element-interfaces:htmlelement-56><a href=#htmlelement>HTMLElement</a></code>
  59025. <tr><td> <code id=element-interfaces:the-keygen-element><a href=#the-keygen-element>keygen</a></code>
  59026. <td> <code id=element-interfaces:htmlkeygenelement><a href=#htmlkeygenelement>HTMLKeygenElement</a></code> : <code id=element-interfaces:htmlelement-57><a href=#htmlelement>HTMLElement</a></code>
  59027. <tr><td> <code id=element-interfaces:the-label-element><a href=#the-label-element>label</a></code>
  59028. <td> <code id=element-interfaces:htmllabelelement><a href=#htmllabelelement>HTMLLabelElement</a></code> : <code id=element-interfaces:htmlelement-58><a href=#htmlelement>HTMLElement</a></code>
  59029. <tr><td> <code id=element-interfaces:the-legend-element><a href=#the-legend-element>legend</a></code>
  59030. <td> <code id=element-interfaces:htmllegendelement><a href=#htmllegendelement>HTMLLegendElement</a></code> : <code id=element-interfaces:htmlelement-59><a href=#htmlelement>HTMLElement</a></code>
  59031. <tr><td> <code id=element-interfaces:the-li-element><a href=#the-li-element>li</a></code>
  59032. <td> <code id=element-interfaces:htmllielement><a href=#htmllielement>HTMLLIElement</a></code> : <code id=element-interfaces:htmlelement-60><a href=#htmlelement>HTMLElement</a></code>
  59033. <tr><td> <code id=element-interfaces:the-link-element><a href=#the-link-element>link</a></code>
  59034. <td> <code id=element-interfaces:htmllinkelement><a href=#htmllinkelement>HTMLLinkElement</a></code> : <code id=element-interfaces:htmlelement-61><a href=#htmlelement>HTMLElement</a></code>
  59035. <tr><td> <code id=element-interfaces:the-main-element><a href=#the-main-element>main</a></code>
  59036. <td> <code id=element-interfaces:htmlelement-62><a href=#htmlelement>HTMLElement</a></code>
  59037. <tr><td> <code id=element-interfaces:the-map-element><a href=#the-map-element>map</a></code>
  59038. <td> <code id=element-interfaces:htmlmapelement><a href=#htmlmapelement>HTMLMapElement</a></code> : <code id=element-interfaces:htmlelement-63><a href=#htmlelement>HTMLElement</a></code>
  59039. <tr><td> <code id=element-interfaces:the-mark-element><a href=#the-mark-element>mark</a></code>
  59040. <td> <code id=element-interfaces:htmlelement-64><a href=#htmlelement>HTMLElement</a></code>
  59041. <tr><td> <code id=element-interfaces:the-menu-element><a href=#the-menu-element>menu</a></code>
  59042. <td> <code id=element-interfaces:htmlmenuelement><a href=#htmlmenuelement>HTMLMenuElement</a></code> : <code id=element-interfaces:htmlelement-65><a href=#htmlelement>HTMLElement</a></code>
  59043. <tr><td> <code id=element-interfaces:the-meta-element><a href=#the-meta-element>meta</a></code>
  59044. <td> <code id=element-interfaces:htmlmetaelement><a href=#htmlmetaelement>HTMLMetaElement</a></code> : <code id=element-interfaces:htmlelement-66><a href=#htmlelement>HTMLElement</a></code>
  59045. <tr><td> <code id=element-interfaces:the-meter-element><a href=#the-meter-element>meter</a></code>
  59046. <td> <code id=element-interfaces:htmlmeterelement><a href=#htmlmeterelement>HTMLMeterElement</a></code> : <code id=element-interfaces:htmlelement-67><a href=#htmlelement>HTMLElement</a></code>
  59047. <tr><td> <code id=element-interfaces:the-nav-element><a href=#the-nav-element>nav</a></code>
  59048. <td> <code id=element-interfaces:htmlelement-68><a href=#htmlelement>HTMLElement</a></code>
  59049. <tr><td> <code id=element-interfaces:the-noscript-element><a href=#the-noscript-element>noscript</a></code>
  59050. <td> <code id=element-interfaces:htmlelement-69><a href=#htmlelement>HTMLElement</a></code>
  59051. <tr><td> <code id=element-interfaces:the-object-element><a href=#the-object-element>object</a></code>
  59052. <td> <code id=element-interfaces:htmlobjectelement><a href=#htmlobjectelement>HTMLObjectElement</a></code> : <code id=element-interfaces:htmlelement-70><a href=#htmlelement>HTMLElement</a></code>
  59053. <tr><td> <code id=element-interfaces:the-ol-element><a href=#the-ol-element>ol</a></code>
  59054. <td> <code id=element-interfaces:htmlolistelement><a href=#htmlolistelement>HTMLOListElement</a></code> : <code id=element-interfaces:htmlelement-71><a href=#htmlelement>HTMLElement</a></code>
  59055. <tr><td> <code id=element-interfaces:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code>
  59056. <td> <code id=element-interfaces:htmloptgroupelement><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code> : <code id=element-interfaces:htmlelement-72><a href=#htmlelement>HTMLElement</a></code>
  59057. <tr><td> <code id=element-interfaces:the-option-element><a href=#the-option-element>option</a></code>
  59058. <td> <code id=element-interfaces:htmloptionelement><a href=#htmloptionelement>HTMLOptionElement</a></code> : <code id=element-interfaces:htmlelement-73><a href=#htmlelement>HTMLElement</a></code>
  59059. <tr><td> <code id=element-interfaces:the-output-element><a href=#the-output-element>output</a></code>
  59060. <td> <code id=element-interfaces:htmloutputelement><a href=#htmloutputelement>HTMLOutputElement</a></code> : <code id=element-interfaces:htmlelement-74><a href=#htmlelement>HTMLElement</a></code>
  59061. <tr><td> <code id=element-interfaces:the-p-element><a href=#the-p-element>p</a></code>
  59062. <td> <code id=element-interfaces:htmlparagraphelement><a href=#htmlparagraphelement>HTMLParagraphElement</a></code> : <code id=element-interfaces:htmlelement-75><a href=#htmlelement>HTMLElement</a></code>
  59063. <tr><td> <code id=element-interfaces:the-param-element><a href=#the-param-element>param</a></code>
  59064. <td> <code id=element-interfaces:htmlparamelement><a href=#htmlparamelement>HTMLParamElement</a></code> : <code id=element-interfaces:htmlelement-76><a href=#htmlelement>HTMLElement</a></code>
  59065. <tr><td> <code id=element-interfaces:the-pre-element><a href=#the-pre-element>pre</a></code>
  59066. <td> <code id=element-interfaces:htmlpreelement><a href=#htmlpreelement>HTMLPreElement</a></code> : <code id=element-interfaces:htmlelement-77><a href=#htmlelement>HTMLElement</a></code>
  59067. <tr><td> <code id=element-interfaces:the-progress-element><a href=#the-progress-element>progress</a></code>
  59068. <td> <code id=element-interfaces:htmlprogresselement><a href=#htmlprogresselement>HTMLProgressElement</a></code> : <code id=element-interfaces:htmlelement-78><a href=#htmlelement>HTMLElement</a></code>
  59069. <tr><td> <code id=element-interfaces:the-q-element><a href=#the-q-element>q</a></code>
  59070. <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>
  59071. <tr><td> <code id=element-interfaces:the-rp-element><a href=#the-rp-element>rp</a></code>
  59072. <td> <code id=element-interfaces:htmlelement-80><a href=#htmlelement>HTMLElement</a></code>
  59073. <tr><td> <code id=element-interfaces:the-rt-element><a href=#the-rt-element>rt</a></code>
  59074. <td> <code id=element-interfaces:htmlelement-81><a href=#htmlelement>HTMLElement</a></code>
  59075. <tr><td> <code id=element-interfaces:the-ruby-element><a href=#the-ruby-element>ruby</a></code>
  59076. <td> <code id=element-interfaces:htmlelement-82><a href=#htmlelement>HTMLElement</a></code>
  59077. <tr><td> <code id=element-interfaces:the-s-element><a href=#the-s-element>s</a></code>
  59078. <td> <code id=element-interfaces:htmlelement-83><a href=#htmlelement>HTMLElement</a></code>
  59079. <tr><td> <code id=element-interfaces:the-samp-element><a href=#the-samp-element>samp</a></code>
  59080. <td> <code id=element-interfaces:htmlelement-84><a href=#htmlelement>HTMLElement</a></code>
  59081. <tr><td> <code id=element-interfaces:the-script-element><a href=#the-script-element>script</a></code>
  59082. <td> <code id=element-interfaces:htmlscriptelement><a href=#htmlscriptelement>HTMLScriptElement</a></code> : <code id=element-interfaces:htmlelement-85><a href=#htmlelement>HTMLElement</a></code>
  59083. <tr><td> <code id=element-interfaces:the-section-element><a href=#the-section-element>section</a></code>
  59084. <td> <code id=element-interfaces:htmlelement-86><a href=#htmlelement>HTMLElement</a></code>
  59085. <tr><td> <code id=element-interfaces:the-select-element><a href=#the-select-element>select</a></code>
  59086. <td> <code id=element-interfaces:htmlselectelement><a href=#htmlselectelement>HTMLSelectElement</a></code> : <code id=element-interfaces:htmlelement-87><a href=#htmlelement>HTMLElement</a></code>
  59087. <tr><td> <code id=element-interfaces:the-small-element><a href=#the-small-element>small</a></code>
  59088. <td> <code id=element-interfaces:htmlelement-88><a href=#htmlelement>HTMLElement</a></code>
  59089. <tr><td> <code id=element-interfaces:the-source-element><a href=#the-source-element>source</a></code>
  59090. <td> <code id=element-interfaces:htmlsourceelement><a href=#htmlsourceelement>HTMLSourceElement</a></code> : <code id=element-interfaces:htmlelement-89><a href=#htmlelement>HTMLElement</a></code>
  59091. <tr><td> <code id=element-interfaces:the-span-element><a href=#the-span-element>span</a></code>
  59092. <td> <code id=element-interfaces:htmlspanelement><a href=#htmlspanelement>HTMLSpanElement</a></code> : <code id=element-interfaces:htmlelement-90><a href=#htmlelement>HTMLElement</a></code>
  59093. <tr><td> <code id=element-interfaces:the-strong-element><a href=#the-strong-element>strong</a></code>
  59094. <td> <code id=element-interfaces:htmlelement-91><a href=#htmlelement>HTMLElement</a></code>
  59095. <tr><td> <code id=element-interfaces:the-style-element><a href=#the-style-element>style</a></code>
  59096. <td> <code id=element-interfaces:htmlstyleelement><a href=#htmlstyleelement>HTMLStyleElement</a></code> : <code id=element-interfaces:htmlelement-92><a href=#htmlelement>HTMLElement</a></code>
  59097. <tr><td> <code id=element-interfaces:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>
  59098. <td> <code id=element-interfaces:htmlelement-93><a href=#htmlelement>HTMLElement</a></code>
  59099. <tr><td> <code id=element-interfaces:the-summary-element><a href=#the-summary-element>summary</a></code>
  59100. <td> <code id=element-interfaces:htmlelement-94><a href=#htmlelement>HTMLElement</a></code>
  59101. <tr><td> <code id=element-interfaces:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>
  59102. <td> <code id=element-interfaces:htmlelement-95><a href=#htmlelement>HTMLElement</a></code>
  59103. <tr><td> <code id=element-interfaces:the-table-element><a href=#the-table-element>table</a></code>
  59104. <td> <code id=element-interfaces:htmltableelement><a href=#htmltableelement>HTMLTableElement</a></code> : <code id=element-interfaces:htmlelement-96><a href=#htmlelement>HTMLElement</a></code>
  59105. <tr><td> <code id=element-interfaces:the-tbody-element><a href=#the-tbody-element>tbody</a></code>
  59106. <td> <code id=element-interfaces:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code id=element-interfaces:htmlelement-97><a href=#htmlelement>HTMLElement</a></code>
  59107. <tr><td> <code id=element-interfaces:the-td-element><a href=#the-td-element>td</a></code>
  59108. <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>
  59109. <tr><td> <code id=element-interfaces:the-template-element><a href=#the-template-element>template</a></code>
  59110. <td> <code id=element-interfaces:htmltemplateelement><a href=#htmltemplateelement>HTMLTemplateElement</a></code> : <code id=element-interfaces:htmlelement-99><a href=#htmlelement>HTMLElement</a></code>
  59111. <tr><td> <code id=element-interfaces:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
  59112. <td> <code id=element-interfaces:htmltextareaelement><a href=#htmltextareaelement>HTMLTextAreaElement</a></code> : <code id=element-interfaces:htmlelement-100><a href=#htmlelement>HTMLElement</a></code>
  59113. <tr><td> <code id=element-interfaces:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>
  59114. <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>
  59115. <tr><td> <code id=element-interfaces:the-th-element><a href=#the-th-element>th</a></code>
  59116. <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>
  59117. <tr><td> <code id=element-interfaces:the-thead-element><a href=#the-thead-element>thead</a></code>
  59118. <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>
  59119. <tr><td> <code id=element-interfaces:the-time-element><a href=#the-time-element>time</a></code>
  59120. <td> <code id=element-interfaces:htmltimeelement><a href=#htmltimeelement>HTMLTimeElement</a></code> : <code id=element-interfaces:htmlelement-104><a href=#htmlelement>HTMLElement</a></code>
  59121. <tr><td> <code id=element-interfaces:the-title-element><a href=#the-title-element>title</a></code>
  59122. <td> <code id=element-interfaces:htmltitleelement><a href=#htmltitleelement>HTMLTitleElement</a></code> : <code id=element-interfaces:htmlelement-105><a href=#htmlelement>HTMLElement</a></code>
  59123. <tr><td> <code id=element-interfaces:the-tr-element><a href=#the-tr-element>tr</a></code>
  59124. <td> <code id=element-interfaces:htmltablerowelement><a href=#htmltablerowelement>HTMLTableRowElement</a></code> : <code id=element-interfaces:htmlelement-106><a href=#htmlelement>HTMLElement</a></code>
  59125. <tr><td> <code id=element-interfaces:the-track-element><a href=#the-track-element>track</a></code>
  59126. <td> <code id=element-interfaces:htmltrackelement><a href=#htmltrackelement>HTMLTrackElement</a></code> : <code id=element-interfaces:htmlelement-107><a href=#htmlelement>HTMLElement</a></code>
  59127. <tr><td> <code id=element-interfaces:the-u-element><a href=#the-u-element>u</a></code>
  59128. <td> <code id=element-interfaces:htmlelement-108><a href=#htmlelement>HTMLElement</a></code>
  59129. <tr><td> <code id=element-interfaces:the-ul-element><a href=#the-ul-element>ul</a></code>
  59130. <td> <code id=element-interfaces:htmlulistelement><a href=#htmlulistelement>HTMLUListElement</a></code> : <code id=element-interfaces:htmlelement-109><a href=#htmlelement>HTMLElement</a></code>
  59131. <tr><td> <code id=element-interfaces:the-var-element><a href=#the-var-element>var</a></code>
  59132. <td> <code id=element-interfaces:htmlelement-110><a href=#htmlelement>HTMLElement</a></code>
  59133. <tr><td> <code id=element-interfaces:the-video-element><a href=#the-video-element>video</a></code>
  59134. <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>
  59135. <tr><td> <code id=element-interfaces:the-wbr-element><a href=#the-wbr-element>wbr</a></code>
  59136. <td> <code id=element-interfaces:htmlelement-112><a href=#htmlelement>HTMLElement</a></code>
  59137. </table>
  59138. <h3 id=all-interfaces class=no-num>All Interfaces</h3>
  59139. <p><i>This section is non-normative.</i></p>
  59140. <ul class="brief">
  59141. <li><code><a href=#abstractworker>AbstractWorker</a></code>
  59142. <li><code><a href=#applicationcache>ApplicationCache</a></code>
  59143. <li><code><a href=#audiotrack>AudioTrack</a></code>
  59144. <li><code><a href=#audiotracklist>AudioTrackList</a></code>
  59145. <li><code><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code>
  59146. <li><code><a href=#barprop>BarProp</a></code>
  59147. <li><code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
  59148. <li><code><a href=#broadcastchannel>BroadcastChannel</a></code>
  59149. <li><code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
  59150. <li><code><a href=#canvasgradient>CanvasGradient</a></code>
  59151. <li><code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
  59152. <li><code><a href=#canvaspattern>CanvasPattern</a></code>
  59153. <li><code><a href=#canvasproxy>CanvasProxy</a></code>
  59154. <li><code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
  59155. <li><code><a href=#closeevent>CloseEvent</a></code>
  59156. <li><code><a href=#domelementmap-2>DOMElementMap</a></code>
  59157. <li><code><a href=#domstringmap-2>DOMStringMap</a></code>
  59158. <li><code><a href=#datatransfer>DataTransfer</a></code>
  59159. <li><code><a href=#datatransferitem>DataTransferItem</a></code>
  59160. <li><code><a href=#datatransferitemlist>DataTransferItemList</a></code>
  59161. <li><code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
  59162. <li><code><a href=#document>Document</a></code>, <a href=#Document-partial>partial</a>
  59163. <li><code><a href=#dragevent>DragEvent</a></code>
  59164. <li><code><a href=#drawingstyle>DrawingStyle</a></code>
  59165. <li><code><a href=#errorevent>ErrorEvent</a></code>
  59166. <li><code><a href=#eventsource>EventSource</a></code>
  59167. <li><code><a href=#external>External</a></code>
  59168. <li><code><a href=#globaleventhandlers>GlobalEventHandlers</a></code>
  59169. <li><code><a href=#htmlallcollection-2>HTMLAllCollection</a></code>
  59170. <li><code><a href=#htmlanchorelement>HTMLAnchorElement</a></code>, <a href=#HTMLAnchorElement-partial>partial</a>
  59171. <li><code><a href=#htmlappletelement>HTMLAppletElement</a></code>
  59172. <li><code><a href=#htmlareaelement>HTMLAreaElement</a></code>, <a href=#HTMLAreaElement-partial>partial</a>
  59173. <li><code><a href=#htmlaudioelement>HTMLAudioElement</a></code>
  59174. <li><code><a href=#htmlbrelement>HTMLBRElement</a></code>, <a href=#HTMLBRElement-partial>partial</a>
  59175. <li><code><a href=#htmlbaseelement>HTMLBaseElement</a></code>
  59176. <li><code><a href=#htmlbodyelement>HTMLBodyElement</a></code>, <a href=#HTMLBodyElement-partial>partial</a>
  59177. <li><code><a href=#htmlbuttonelement>HTMLButtonElement</a></code>
  59178. <li><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>
  59179. <li><code><a href=#htmldlistelement>HTMLDListElement</a></code>, <a href=#HTMLDListElement-partial>partial</a>
  59180. <li><code><a href=#htmldataelement>HTMLDataElement</a></code>
  59181. <li><code><a href=#htmldatalistelement>HTMLDataListElement</a></code>
  59182. <li><code><a href=#htmldetailselement>HTMLDetailsElement</a></code>
  59183. <li><code><a href=#htmldialogelement>HTMLDialogElement</a></code>
  59184. <li><code><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code>
  59185. <li><code><a href=#htmldivelement>HTMLDivElement</a></code>, <a href=#HTMLDivElement-partial>partial</a>
  59186. <li><code><a href=#htmlelement>HTMLElement</a></code>
  59187. <li><code><a href=#htmlembedelement>HTMLEmbedElement</a></code>, <a href=#HTMLEmbedElement-partial>partial</a>
  59188. <li><code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code>
  59189. <li><code><a href=#htmlfontelement>HTMLFontElement</a></code>
  59190. <li><code><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code>
  59191. <li><code><a href=#htmlformelement>HTMLFormElement</a></code>
  59192. <li><code><a href=#htmlframeelement>HTMLFrameElement</a></code>
  59193. <li><code><a href=#htmlframesetelement>HTMLFrameSetElement</a></code>
  59194. <li><code><a href=#htmlhrelement>HTMLHRElement</a></code>, <a href=#HTMLHRElement-partial>partial</a>
  59195. <li><code><a href=#htmlheadelement>HTMLHeadElement</a></code>
  59196. <li><code><a href=#htmlheadingelement>HTMLHeadingElement</a></code>, <a href=#HTMLHeadingElement-partial>partial</a>
  59197. <li><code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code>, <a href=#HTMLHtmlElement-partial>partial</a>
  59198. <li><code><a href=#htmliframeelement>HTMLIFrameElement</a></code>, <a href=#HTMLIFrameElement-partial>partial</a>
  59199. <li><code><a href=#htmlimageelement>HTMLImageElement</a></code>, <a href=#HTMLImageElement-partial>partial</a>
  59200. <li><code><a href=#htmlinputelement>HTMLInputElement</a></code>, <a href=#HTMLInputElement-partial>partial</a>
  59201. <li><code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code>
  59202. <li><code><a href=#htmllielement>HTMLLIElement</a></code>, <a href=#HTMLLIElement-partial>partial</a>
  59203. <li><code><a href=#htmllabelelement>HTMLLabelElement</a></code>
  59204. <li><code><a href=#htmllegendelement>HTMLLegendElement</a></code>, <a href=#HTMLLegendElement-partial>partial</a>
  59205. <li><code><a href=#htmllinkelement>HTMLLinkElement</a></code>, <a href=#HTMLLinkElement-partial>partial</a>
  59206. <li><code><a href=#htmlmapelement>HTMLMapElement</a></code>
  59207. <li><code><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code>
  59208. <li><code><a href=#htmlmediaelement>HTMLMediaElement</a></code>
  59209. <li><code><a href=#htmlmenuelement>HTMLMenuElement</a></code>, <a href=#HTMLMenuElement-partial>partial</a>
  59210. <li><code><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code>
  59211. <li><code><a href=#htmlmetaelement>HTMLMetaElement</a></code>, <a href=#HTMLMetaElement-partial>partial</a>
  59212. <li><code><a href=#htmlmeterelement>HTMLMeterElement</a></code>
  59213. <li><code><a href=#htmlmodelement>HTMLModElement</a></code>
  59214. <li><code><a href=#htmlolistelement>HTMLOListElement</a></code>, <a href=#HTMLOListElement-partial>partial</a>
  59215. <li><code><a href=#htmlobjectelement>HTMLObjectElement</a></code>, <a href=#HTMLObjectElement-partial>partial</a>
  59216. <li><code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code>
  59217. <li><code><a href=#htmloptionelement>HTMLOptionElement</a></code>
  59218. <li><code><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code>
  59219. <li><code><a href=#htmloutputelement>HTMLOutputElement</a></code>
  59220. <li><code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code>, <a href=#HTMLParagraphElement-partial>partial</a>
  59221. <li><code><a href=#htmlparamelement>HTMLParamElement</a></code>, <a href=#HTMLParamElement-partial>partial</a>
  59222. <li><code><a href=#htmlpictureelement>HTMLPictureElement</a></code>
  59223. <li><code><a href=#htmlpreelement>HTMLPreElement</a></code>, <a href=#HTMLPreElement-partial>partial</a>
  59224. <li><code><a href=#htmlprogresselement>HTMLProgressElement</a></code>
  59225. <li><code><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code>
  59226. <li><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code>
  59227. <li><code><a href=#htmlscriptelement>HTMLScriptElement</a></code>, <a href=#HTMLScriptElement-partial>partial</a>
  59228. <li><code><a href=#htmlselectelement>HTMLSelectElement</a></code>
  59229. <li><code><a href=#htmlsourceelement>HTMLSourceElement</a></code>, <a href=#the-source-element-when-used-with-the-picture-element:htmlsourceelement>partial</a>
  59230. <li><code><a href=#htmlspanelement>HTMLSpanElement</a></code>
  59231. <li><code><a href=#htmlstyleelement>HTMLStyleElement</a></code>
  59232. <li><code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code>, <a href=#HTMLTableCaptionElement-partial>partial</a>
  59233. <li><code><a href=#htmltablecellelement>HTMLTableCellElement</a></code>, <a href=#HTMLTableCellElement-partial>partial</a>
  59234. <li><code><a href=#htmltablecolelement>HTMLTableColElement</a></code>, <a href=#HTMLTableColElement-partial>partial</a>
  59235. <li><code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code>, <a href=#HTMLTableDataCellElement-partial>partial</a>
  59236. <li><code><a href=#htmltableelement>HTMLTableElement</a></code>, <a href=#HTMLTableElement-partial>partial</a>
  59237. <li><code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code>
  59238. <li><code><a href=#htmltablerowelement>HTMLTableRowElement</a></code>, <a href=#HTMLTableRowElement-partial>partial</a>
  59239. <li><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, <a href=#HTMLTableSectionElement-partial>partial</a>
  59240. <li><code><a href=#htmltemplateelement>HTMLTemplateElement</a></code>
  59241. <li><code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code>
  59242. <li><code><a href=#htmltimeelement>HTMLTimeElement</a></code>
  59243. <li><code><a href=#htmltitleelement>HTMLTitleElement</a></code>
  59244. <li><code><a href=#htmltrackelement>HTMLTrackElement</a></code>
  59245. <li><code><a href=#htmlulistelement>HTMLUListElement</a></code>, <a href=#HTMLUListElement-partial>partial</a>
  59246. <li><code><a href=#htmlunknownelement>HTMLUnknownElement</a></code>
  59247. <li><code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
  59248. <li><code><a href=#hashchangeevent>HashChangeEvent</a></code>
  59249. <li><code><a href=#history-3>History</a></code>
  59250. <li><code><a href=#imagebitmap>ImageBitmap</a></code>
  59251. <li><code><a href=#imagebitmapfactories>ImageBitmapFactories</a></code>
  59252. <li><code><a href=#imagedata>ImageData</a></code>
  59253. <li><code><a href=#location>Location</a></code>
  59254. <li><code><a href=#mediacontroller>MediaController</a></code>
  59255. <li><code><a href=#mediaerror>MediaError</a></code>
  59256. <li><code><a href=#messagechannel>MessageChannel</a></code>
  59257. <li><code><a href=#messageevent>MessageEvent</a></code>
  59258. <li><code><a href=#messageport>MessagePort</a></code>
  59259. <li><code><a href=#mimetype>MimeType</a></code>
  59260. <li><code><a href=#mimetypearray>MimeTypeArray</a></code>
  59261. <li><code>MouseEvent</code>, <a href=#MouseEvent-partial>partial</a>
  59262. <li><code><a href=#navigator>Navigator</a></code>
  59263. <li><code><a href=#navigatorcontentutils>NavigatorContentUtils</a></code>
  59264. <li><code><a href=#navigatorid>NavigatorID</a></code>
  59265. <li><code><a href=#navigatorlanguage>NavigatorLanguage</a></code>
  59266. <li><code><a href=#navigatoronline>NavigatorOnLine</a></code>
  59267. <li><code><a href=#navigatorplugins>NavigatorPlugins</a></code>
  59268. <li><code><a href=#navigatorstorageutils>NavigatorStorageUtils</a></code>
  59269. <li><code><a href=#pagetransitionevent>PageTransitionEvent</a></code>
  59270. <li><code><a href=#path2d>Path2D</a></code>
  59271. <li><code><a href=#dom-plugin>Plugin</a></code>
  59272. <li><code><a href=#pluginarray>PluginArray</a></code>
  59273. <li><code><a href=#popstateevent>PopStateEvent</a></code>
  59274. <li><code><a href=#portcollection>PortCollection</a></code>
  59275. <li><code><a href=#propertynodelist>PropertyNodeList</a></code>
  59276. <li><code><a href=#radionodelist>RadioNodeList</a></code>
  59277. <li><code><a href=#relatedevent>RelatedEvent</a></code>
  59278. <li><code><a href=#sharedworker>SharedWorker</a></code>
  59279. <li><code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
  59280. <li><code><a href=#storage-2>Storage</a></code>
  59281. <li><code><a href=#storageevent>StorageEvent</a></code>
  59282. <li><code><a href=#textmetrics>TextMetrics</a></code>
  59283. <li><code><a href=#texttrack>TextTrack</a></code>
  59284. <li><code><a href=#texttrackcue>TextTrackCue</a></code>
  59285. <li><code><a href=#texttrackcuelist>TextTrackCueList</a></code>
  59286. <li><code><a href=#texttracklist>TextTrackList</a></code>
  59287. <li><code><a href=#timeranges>TimeRanges</a></code>
  59288. <li><code>Touch</code>, <a href=#Touch-partial>partial</a>
  59289. <li><code><a href=#trackevent>TrackEvent</a></code>
  59290. <li><code><a href=#validitystate>ValidityState</a></code>
  59291. <li><code><a href=#videotrack>VideoTrack</a></code>
  59292. <li><code><a href=#videotracklist>VideoTrackList</a></code>
  59293. <li><code><a href=#websocket>WebSocket</a></code>
  59294. <li><code><a href=#window>Window</a></code>, <a href=#Window-partial>partial</a>
  59295. <li><code><a href=#windowbase64>WindowBase64</a></code>
  59296. <li><code><a href=#windoweventhandlers>WindowEventHandlers</a></code>
  59297. <li><code><a href=#windowlocalstorage>WindowLocalStorage</a></code>
  59298. <li><code><a href=#windowmodal>WindowModal</a></code>
  59299. <li><code><a href=#windowsessionstorage>WindowSessionStorage</a></code>
  59300. <li><code><a href=#windowtimers>WindowTimers</a></code>
  59301. <li><code><a href=#worker>Worker</a></code>
  59302. <li><code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, <a href=#WorkerGlobalScope-partial>partial</a>
  59303. <li><code><a href=#workerlocation>WorkerLocation</a></code>
  59304. <li><code><a href=#workernavigator>WorkerNavigator</a></code>
  59305. <li><code>XMLDocument</code>, <a href=#loading-xml-documents:xmldocument>partial</a>
  59306. </ul>
  59307. <h3 id=events-2 class=no-num>Events</h3>
  59308. <p><i>This section is non-normative.</i></p>
  59309. <table><caption>List of events</caption><thead><tr><th> Event
  59310. <th> Interface
  59311. <th> Interesting targets
  59312. <th> Description
  59313. <tbody><tr><td> <dfn id=event-abort><code>abort</code></dfn>
  59314. <td> <code id=events-2:event><a href=#event>Event</a></code>
  59315. <td> <code id=events-2:window><a href=#window>Window</a></code>
  59316. <td> Fired at the <code id=events-2:window-2><a href=#window>Window</a></code> when the download was aborted by the user
  59317. <tr><td> <dfn id=event-autocomplete><code>autocomplete</code></dfn>
  59318. <td> <code id=events-2:event-2><a href=#event>Event</a></code>
  59319. <td> <code id=events-2:the-form-element><a href=#the-form-element>form</a></code> elements
  59320. <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>
  59321. <tr><td> <dfn id=event-autocompleteerror><code>autocompleteerror</code></dfn>
  59322. <td> <code id=events-2:event-3><a href=#event>Event</a></code>
  59323. <td> <code id=events-2:the-form-element-3><a href=#the-form-element>form</a></code> elements
  59324. <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
  59325. <tr><td> <dfn id=event-domcontentloaded><code>DOMContentLoaded</code></dfn>
  59326. <td> <code id=events-2:event-4><a href=#event>Event</a></code>
  59327. <td> <code id=events-2:document><a href=#document>Document</a></code>
  59328. <td> Fired at the <code id=events-2:document-2><a href=#document>Document</a></code> once the parser has finished
  59329. <tr><td> <dfn id=event-afterprint><code>afterprint</code></dfn>
  59330. <td> <code id=events-2:event-5><a href=#event>Event</a></code>
  59331. <td> <code id=events-2:window-3><a href=#window>Window</a></code>
  59332. <td> Fired at the <code id=events-2:window-4><a href=#window>Window</a></code> after printing
  59333. <tr><td> <dfn id=event-afterscriptexecute><code>afterscriptexecute</code></dfn>
  59334. <td> <code id=events-2:event-6><a href=#event>Event</a></code>
  59335. <td> <code id=events-2:the-script-element><a href=#the-script-element>script</a></code> elements
  59336. <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)
  59337. <tr><td> <dfn id=event-beforeprint><code>beforeprint</code></dfn>
  59338. <td> <code id=events-2:event-7><a href=#event>Event</a></code>
  59339. <td> <code id=events-2:window-5><a href=#window>Window</a></code>
  59340. <td> Fired at the <code id=events-2:window-6><a href=#window>Window</a></code> before printing
  59341. <tr><td> <dfn id=event-beforescriptexecute><code>beforescriptexecute</code></dfn>
  59342. <td> <code id=events-2:event-8><a href=#event>Event</a></code>
  59343. <td> <code id=events-2:the-script-element-3><a href=#the-script-element>script</a></code> elements
  59344. <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
  59345. <tr><td> <dfn id=event-beforeunload><code>beforeunload</code></dfn>
  59346. <td> <code id=events-2:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
  59347. <td> <code id=events-2:window-7><a href=#window>Window</a></code>
  59348. <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
  59349. <tr><td> <dfn id=event-blur><code>blur</code></dfn>
  59350. <td> <code id=events-2:event-9><a href=#event>Event</a></code>
  59351. <td> <code id=events-2:window-9><a href=#window>Window</a></code>, elements
  59352. <td> Fired at nodes when they stop being <a href=#focused id=events-2:focused>focused</a>
  59353. <tr><td> <dfn id=event-cancel><code>cancel</code></dfn>
  59354. <td> <code id=events-2:event-10><a href=#event>Event</a></code>
  59355. <td> <code id=events-2:the-dialog-element><a href=#the-dialog-element>dialog</a></code> elements
  59356. <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)
  59357. <tr><td> <dfn id=event-change><code>change</code></dfn>
  59358. <td> <code id=events-2:event-11><a href=#event>Event</a></code>
  59359. <td> Form controls
  59360. <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)
  59361. <tr><td> <code id=events-2:event-click><a href=#event-click>click</a></code>
  59362. <td> <code id=events-2:mouseevent><a href=#mouseevent>MouseEvent</a></code>
  59363. <td> Elements
  59364. <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)
  59365. <tr><td> <dfn id=event-close><code>close</code></dfn>
  59366. <td> <code id=events-2:event-12><a href=#event>Event</a></code>
  59367. <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>
  59368. <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
  59369. <tr><td> <dfn id=event-workerglobalscope-connect><code>connect</code></dfn>
  59370. <td> <code id=events-2:messageevent><a href=#messageevent>MessageEvent</a></code>
  59371. <td> <code id=events-2:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
  59372. <td> Fired at a shared worker's global scope when a new client connects
  59373. <tr><td> <dfn id=event-contextmenu><code>contextmenu</code></dfn>
  59374. <td> <code id=events-2:event-13><a href=#event>Event</a></code>
  59375. <td> Elements
  59376. <td> Fired at elements when the user requests their context menu
  59377. <tr><td> <dfn id=event-error><code>error</code></dfn>
  59378. <td> <code id=events-2:event-14><a href=#event>Event</a></code>
  59379. <td> Global scope objects, <code id=events-2:worker><a href=#worker>Worker</a></code> objects, elements, networking-related objects
  59380. <td> Fired when unexpected errors occur (e.g. networking errors, script errors, decoding errors)
  59381. <tr><td> <dfn id=event-focus><code>focus</code></dfn>
  59382. <td> <code id=events-2:event-15><a href=#event>Event</a></code>
  59383. <td> <code id=events-2:window-10><a href=#window>Window</a></code>, elements
  59384. <td> Fired at nodes <a href=#gains-focus id=events-2:gains-focus>gaining focus</a>
  59385. <tr><td> <dfn id=event-hashchange><code>hashchange</code></dfn>
  59386. <td> <code id=events-2:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code>
  59387. <td> <code id=events-2:window-11><a href=#window>Window</a></code>
  59388. <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
  59389. <tr><td> <dfn id=event-input><code>input</code></dfn>
  59390. <td> <code id=events-2:event-16><a href=#event>Event</a></code>
  59391. <td> Form controls
  59392. <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)
  59393. <tr><td> <dfn id=event-invalid><code>invalid</code></dfn>
  59394. <td> <code id=events-2:event-17><a href=#event>Event</a></code>
  59395. <td> Form controls
  59396. <td> Fired at controls during form validation if they do not satisfy their constraints
  59397. <tr><td> <dfn id=event-languagechange><code>languagechange</code></dfn>
  59398. <td> <code id=events-2:event-18><a href=#event>Event</a></code>
  59399. <td> Global scope objects
  59400. <td> Fired at the global scope object when the user's preferred languages change
  59401. <tr><td> <dfn id=event-load><code>load</code></dfn>
  59402. <td> <code id=events-2:event-19><a href=#event>Event</a></code>
  59403. <td> <code id=events-2:window-13><a href=#window>Window</a></code>, elements
  59404. <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
  59405. <tr><td> <dfn id=event-loadend><code>loadend</code></dfn>
  59406. <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>
  59407. <td> <code id=events-2:the-img-element-2><a href=#the-img-element>img</a></code> elements
  59408. <td> Fired at <code id=events-2:the-img-element-3><a href=#the-img-element>img</a></code> elements after a successful load
  59409. <tr><td> <dfn id=event-loadstart><code>loadstart</code></dfn>
  59410. <td> <code id=events-2:progressevent-2><a href=#progressevent>ProgressEvent</a></code>
  59411. <td> <code id=events-2:the-img-element-4><a href=#the-img-element>img</a></code> elements
  59412. <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>)
  59413. <tr><td> <dfn id=event-message><code>message</code></dfn>
  59414. <td> <code id=events-2:messageevent-2><a href=#messageevent>MessageEvent</a></code>
  59415. <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>
  59416. <td> Fired at an object when it receives a message
  59417. <tr><td> <dfn id=event-offline><code>offline</code></dfn>
  59418. <td> <code id=events-2:event-21><a href=#event>Event</a></code>
  59419. <td> Global scope objects
  59420. <td> Fired at the global scope object when the network connections fails
  59421. <tr><td> <dfn id=event-online><code>online</code></dfn>
  59422. <td> <code id=events-2:event-22><a href=#event>Event</a></code>
  59423. <td> Global scope objects
  59424. <td> Fired at the global scope object when the network connections returns
  59425. <tr><td> <dfn id=event-open><code>open</code></dfn>
  59426. <td> <code id=events-2:event-23><a href=#event>Event</a></code>
  59427. <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>
  59428. <td> Fired at networking-related objects when a connection is established
  59429. <tr><td> <dfn id=event-pagehide><code>pagehide</code></dfn>
  59430. <td> <code id=events-2:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code>
  59431. <td> <code id=events-2:window-16><a href=#window>Window</a></code>
  59432. <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>
  59433. <tr><td> <dfn id=event-pageshow><code>pageshow</code></dfn>
  59434. <td> <code id=events-2:pagetransitionevent-2><a href=#pagetransitionevent>PageTransitionEvent</a></code>
  59435. <td> <code id=events-2:window-18><a href=#window>Window</a></code>
  59436. <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>
  59437. <tr><td> <dfn id=event-popstate><code>popstate</code></dfn>
  59438. <td> <code id=events-2:popstateevent><a href=#popstateevent>PopStateEvent</a></code>
  59439. <td> <code id=events-2:window-20><a href=#window>Window</a></code>
  59440. <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>
  59441. <tr><td> <dfn id=event-progress><code>progress</code></dfn>
  59442. <td> <code id=events-2:progressevent-3><a href=#progressevent>ProgressEvent</a></code>
  59443. <td> <code id=events-2:the-img-element-6><a href=#the-img-element>img</a></code> elements
  59444. <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>)
  59445. <tr><td> <dfn id=event-readystatechange><code>readystatechange</code></dfn>
  59446. <td> <code id=events-2:event-24><a href=#event>Event</a></code>
  59447. <td> <code id=events-2:document-3><a href=#document>Document</a></code>
  59448. <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
  59449. <tr><td> <dfn id=event-reset><code>reset</code></dfn>
  59450. <td> <code id=events-2:event-25><a href=#event>Event</a></code>
  59451. <td> <code id=events-2:the-form-element-5><a href=#the-form-element>form</a></code> elements
  59452. <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>
  59453. <tr><td> <dfn id=event-select><code>select</code></dfn>
  59454. <td> <code id=events-2:event-26><a href=#event>Event</a></code>
  59455. <td> Form controls
  59456. <td> Fired at form controls when their text selection is adjusted (whether by an API or by the user)
  59457. <tr><td> <dfn id=event-show><code>show</code></dfn>
  59458. <td> <code id=events-2:relatedevent><a href=#relatedevent>RelatedEvent</a></code>
  59459. <td> <code id=events-2:the-menu-element><a href=#the-menu-element>menu</a></code> elements
  59460. <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
  59461. <tr><td> <dfn id=event-sort><code>sort</code></dfn>
  59462. <td> <code id=events-2:event-27><a href=#event>Event</a></code>
  59463. <td> <code id=events-2:the-table-element><a href=#the-table-element>table</a></code> elements
  59464. <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
  59465. <tr><td> <dfn id=event-storage><code>storage</code></dfn>
  59466. <td> <code id=events-2:storageevent><a href=#storageevent>StorageEvent</a></code>
  59467. <td> <code id=events-2:window-22><a href=#window>Window</a></code>
  59468. <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
  59469. <tr><td> <dfn id=event-submit><code>submit</code></dfn>
  59470. <td> <code id=events-2:event-28><a href=#event>Event</a></code>
  59471. <td> <code id=events-2:the-form-element-7><a href=#the-form-element>form</a></code> elements
  59472. <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>
  59473. <tr><td> <dfn id=event-toggle><code>toggle</code></dfn>
  59474. <td> <code id=events-2:event-29><a href=#event>Event</a></code>
  59475. <td> <code id=events-2:the-details-element><a href=#the-details-element>details</a></code> element
  59476. <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
  59477. <tr><td> <dfn id=event-unload><code>unload</code></dfn>
  59478. <td> <code id=events-2:event-30><a href=#event>Event</a></code>
  59479. <td> <code id=events-2:window-24><a href=#window>Window</a></code>
  59480. <td> Fired at the <code id=events-2:window-25><a href=#window>Window</a></code> object when the page is going away
  59481. </table>
  59482. <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
  59483. events</a>.</p>
  59484. <h3 id=mime-types-2 class=no-num>MIME Types</h3>
  59485. <p><i>This section is non-normative.</i></p>
  59486. <p>The following MIME types are mentioned in this specification:</p>
  59487. <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>
  59488. <dt><dfn id=application/javascript><code>application/javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59489. <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>
  59490. <dt><dfn id=application/x-javascript><code>application/x-javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59491. <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
  59492. <dt><dfn id=application/rss+xml><code>application/rss+xml</code></dfn><dd>RSS
  59493. <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>
  59494. <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>
  59495. <dt><dfn id=text/javascript1.0><code>text/javascript1.0</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59496. <dt><dfn id=text/javascript1.1><code>text/javascript1.1</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59497. <dt><dfn id=text/javascript1.2><code>text/javascript1.2</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59498. <dt><dfn id=text/javascript1.3><code>text/javascript1.3</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59499. <dt><dfn id=text/javascript1.4><code>text/javascript1.4</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59500. <dt><dfn id=text/javascript1.5><code>text/javascript1.5</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59501. <dt><dfn id=text/jscript><code>text/jscript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59502. <dt><dfn id=text/livescript><code>text/livescript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59503. <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>
  59504. <dt><dfn id=text/vcard><code>text/vcard</code></dfn><dd>vCard <a href=#refsRFC6350>[RFC6350]</a>
  59505. <dt><dfn id=text/x-ecmascript><code>text/x-ecmascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59506. <dt><dfn id=text/x-javascript><code>text/x-javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
  59507. <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>
  59508. <h2 id=references class=no-num>References</h2>
  59509. <p>All references are normative unless marked "Non-normative".</p>
  59510. <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&amp;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>.
  59511. 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&amp;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>
  59512. <h2 id=acknowledgements class=no-num>Acknowledgements</h2>
  59513. <p>Thanks to Tim Berners-Lee for inventing HTML, without which none of this would exist.</p>
  59514. <p>Thanks to
  59515. Aankhen,
  59516. Aaron Boodman,
  59517. Aaron Leventhal,
  59518. Adam Barth,
  59519. Adam de Boor,
  59520. Adam Hepton,
  59521. Adam Klein,
  59522. Adam Roben,
  59523. Addison Phillips,
  59524. Adele Peterson,
  59525. Adrian Bateman,
  59526. Adrian Sutton,
  59527. Agustín Fernández,
  59528. Aharon (Vladimir) Lanin,
  59529. Ajai Tirumali,
  59530. Akatsuki Kitamura,
  59531. Alan Plum,
  59532. Alastair Campbell,
  59533. Alejandro G. Castro,
  59534. Alex Bishop,
  59535. Alex Nicolaou,
  59536. Alex Rousskov,
  59537. Alexander Farkas,
  59538. Alexander J. Vincent,
  59539. Alexandre Morgaut,
  59540. Alexey Feldgendler,
  59541. Алексей Проскуряков (Alexey Proskuryakov),
  59542. Alexis Deveria,
  59543. Allan Clements,
  59544. Ami Fischman,
  59545. Amos Jeffries,
  59546. Anders Carlsson,
  59547. André E. Veltstra,
  59548. Andrea Rendine,
  59549. Andreas,
  59550. Andreas Kling,
  59551. Andrei Popescu,
  59552. Andres Gomez,
  59553. Andrew Barfield,
  59554. Andrew Clover,
  59555. Andrew Gove,
  59556. Andrew Grieve,
  59557. Andrew Oakley,
  59558. Andrew Sidwell,
  59559. Andrew Simons,
  59560. Andrew Smith,
  59561. Andrew W. Hagen,
  59562. Andrey V. Lukyanov,
  59563. Andry Rendy,
  59564. Andy Earnshaw,
  59565. Andy Heydon,
  59566. Andy Palay,
  59567. Anne van Kesteren,
  59568. Anthony Boyd,
  59569. Anthony Bryan,
  59570. Anthony Hickson,
  59571. Anthony Ricaud,
  59572. Antti Koivisto,
  59573. Arkadiusz Michalski,
  59574. Arne Thomassen,
  59575. Aron Spohr,
  59576. Arphen Lin,
  59577. Arthur Stolyar,
  59578. Arun Patole,
  59579. Aryeh Gregor,
  59580. Asbjørn Ulsberg,
  59581. Ashley Gullen,
  59582. Ashley Sheridan,
  59583. Atsushi Takayama,
  59584. Aurelien Levy,
  59585. Ave Wrigley,
  59586. Axel Dahmen,
  59587. Ben Boyle,
  59588. Ben Godfrey,
  59589. Ben Lerner,
  59590. Ben Leslie,
  59591. Ben Meadowcroft,
  59592. Ben Millard,
  59593. Benjamin Carl Wiley Sittler,
  59594. Benjamin Hawkes-Lewis,
  59595. Benoit Ren,
  59596. Bert Bos,
  59597. Bijan Parsia,
  59598. Bil Corry,
  59599. Bill Mason,
  59600. Bill McCoy,
  59601. Billy Wong,
  59602. Bjartur Thorlacius,
  59603. Björn Höhrmann,
  59604. Blake Frantz,
  59605. Bob Lund,
  59606. Bob Owen,
  59607. Boris Zbarsky,
  59608. Brad Fults,
  59609. Brad Neuberg,
  59610. Brad Spencer,
  59611. Brady Eidson,
  59612. Brendan Eich,
  59613. Brenton Simpson,
  59614. Brett Wilson,
  59615. Brett Zamir,
  59616. Brian Blakely,
  59617. Brian Campbell,
  59618. Brian Korver,
  59619. Brian Kuhn,
  59620. Brian M. Dube,
  59621. Brian Ryner,
  59622. Brian Smith,
  59623. Brian Wilson,
  59624. Bryan Sullivan,
  59625. Bruce Bailey,
  59626. Bruce D'Arcus,
  59627. Bruce Lawson,
  59628. Bruce Miller,
  59629. C. Williams,
  59630. Cameron McCormack,
  59631. Cameron Zemek,
  59632. Cao Yipeng,
  59633. Carlos Amengual,
  59634. Carlos Gabriel Cardona,
  59635. Carlos Perelló Marín,
  59636. Chao Cai,
  59637. 윤석찬 (Channy Yun),
  59638. Charl van Niekerk,
  59639. Charles Iliya Krempeaux,
  59640. Charles McCathieNevile,
  59641. Chris Apers,
  59642. Chris Cressman,
  59643. Chris Evans,
  59644. Chris Morris,
  59645. Chris Pearce,
  59646. Chris Peterson,
  59647. Chris Weber,
  59648. Christian Biesinger,
  59649. Christian Johansen,
  59650. Christian Schmidt,
  59651. Christoph Päper,
  59652. Christophe Dumez,
  59653. Christopher Aillon,
  59654. Christopher Ferris,
  59655. Chriswa,
  59656. Clark Buehler,
  59657. Cole Robison,
  59658. Colin Fine,
  59659. Collin Jackson,
  59660. Corprew Reed,
  59661. Craig Cockburn,
  59662. Csaba Gabor,
  59663. Csaba Marton,
  59664. Cynthia Shelly,
  59665. Dan Yoder,
  59666. Daniel Barclay,
  59667. Daniel Bratell,
  59668. Daniel Brooks,
  59669. Daniel Brumbaugh Keeney,
  59670. Daniel Cheng,
  59671. Daniel Davis,
  59672. Daniel Glazman,
  59673. Daniel Peng,
  59674. Daniel Schattenkirchner,
  59675. Daniel Spång,
  59676. Daniel Steinberg,
  59677. Daniel Trebbien,
  59678. Danny Sullivan,
  59679. Darin Adler,
  59680. Darin Fisher,
  59681. Darxus,
  59682. Dave Camp,
  59683. Dave Hodder,
  59684. Dave Lampton,
  59685. Dave Singer,
  59686. Dave Townsend,
  59687. David Baron,
  59688. David Bloom,
  59689. David Bruant,
  59690. David Carlisle,
  59691. David E. Cleary,
  59692. David Egan Evans,
  59693. David Fink,
  59694. David Flanagan,
  59695. David Gerard,
  59696. David Håsäther,
  59697. David Hyatt,
  59698. David I. Lehn,
  59699. David John Burrowes,
  59700. David Kendal,
  59701. David Matja,
  59702. David Remahl,
  59703. David Smith,
  59704. David Woolley,
  59705. DeWitt Clinton,
  59706. Dean Edridge,
  59707. Dean Edwards,
  59708. Debi Orton,
  59709. Derek Featherstone,
  59710. Devarshi Pant,
  59711. Devdatta,
  59712. Dimitri Glazkov,
  59713. Dimitry Golubovsky,
  59714. Dirk Pranke,
  59715. Dirk Schulze,
  59716. Dirkjan Ochtman,
  59717. Divya Manian,
  59718. Dmitry Titov,
  59719. dolphinling,
  59720. Domenic Denicola,
  59721. Dominique Hazaël-Massieux,
  59722. Don Brutzman,
  59723. Doron Rosenberg,
  59724. Doug Kramer,
  59725. Doug Simpkinson,
  59726. Drew Wilson,
  59727. Edmund Lai,
  59728. Eduard Pascual,
  59729. Eduardo Vela,
  59730. Edward O'Connor,
  59731. Edward Welbourne,
  59732. Edward Z. Yang,
  59733. Ehsan Akhgari,
  59734. Eira Monstad,
  59735. Eitan Adler,
  59736. Eliot Graff,
  59737. Elisabeth Robson,
  59738. Elizabeth Castro,
  59739. Elliott Sprehn,
  59740. Elliotte Harold,
  59741. Eric Carlson,
  59742. Eric Casler,
  59743. Eric Lawrence,
  59744. Eric Rescorla,
  59745. Eric Semling,
  59746. Erik Arvidsson,
  59747. Erik Rose,
  59748. Evan Martin,
  59749. Evan Prodromou,
  59750. Evan Stade,
  59751. Evert,
  59752. fantasai,
  59753. Felix Sasaki,
  59754. Francesco Schwarz,
  59755. Francis Brosnan Blazquez,
  59756. Franck 'Shift' Quélain,
  59757. Frank Barchard,
  59758. Fredrik Söderquist,
  59759. 鵜飼文敏 (Fumitoshi Ukai),
  59760. Futomi Hatano,
  59761. Gavin Carothers,
  59762. Gavin Kistner,
  59763. Gareth Rees,
  59764. Garrett Smith,
  59765. Geoff Richards,
  59766. Geoffrey Garen,
  59767. Geoffrey Sneddon,
  59768. George Lund,
  59769. Gianmarco Armellin,
  59770. Giovanni Campagna,
  59771. Giuseppe Pascale,
  59772. Glenn Adams,
  59773. Glenn Maynard,
  59774. Graham Klyne,
  59775. Greg Botten,
  59776. Greg Houston,
  59777. Greg Wilkins,
  59778. Gregg Tavares,
  59779. Gregory J. Rosmaita,
  59780. Grey,
  59781. Guilherme Johansson Tramontina,
  59782. Gytis Jakutonis,
  59783. Håkon Wium Lie,
  59784. Habib Virji,
  59785. Hallvord Reiar Michaelsen Steen,
  59786. Hans S. Tømmerhalt,
  59787. Hans Stimer,
  59788. Harald Alvestrand,
  59789. Henri Sivonen,
  59790. Henrik Lied,
  59791. Henry Mason,
  59792. Henry Story,
  59793. Hugh Guiney,
  59794. Hugh Winkler,
  59795. Ian Bicking,
  59796. Ian Clelland,
  59797. Ian Davis,
  59798. Ian Fette,
  59799. Ido Green,
  59800. Ignacio Javier,
  59801. Ivan Enderlin,
  59802. Ivo Emanuel Gonçalves,
  59803. J. King,
  59804. Jacob Davies,
  59805. Jacques Distler,
  59806. Jake Verbaten,
  59807. Jakub Łopuszański,
  59808. James Craig,
  59809. James Graham,
  59810. James Greene,
  59811. James Justin Harrell,
  59812. James Kozianski,
  59813. James M Snell,
  59814. James Perrett,
  59815. James Robinson,
  59816. Jamie Lokier,
  59817. Janusz Majnert,
  59818. Jan-Klaas Kollhof,
  59819. Jared Jacobs,
  59820. Jason Duell,
  59821. Jason Kersey,
  59822. Jason Lustig,
  59823. Jason White,
  59824. Jasper Bryant-Greene,
  59825. Jasper St. Pierre,
  59826. Jatinder Mann,
  59827. Jed Hartman,
  59828. Jeff Balogh,
  59829. Jeff Cutsinger,
  59830. Jeff Schiller,
  59831. Jeff Walden,
  59832. Jeffrey Zeldman,
  59833. 胡慧鋒 (Jennifer Braithwaite),
  59834. Jens Bannmann,
  59835. Jens Fendler,
  59836. Jens Lindström,
  59837. Jens Meiert,
  59838. Jeremey Hustman,
  59839. Jeremy Keith,
  59840. Jeremy Orlow,
  59841. Jeroen van der Meer,
  59842. Jian Li,
  59843. Jim Jewett,
  59844. Jim Ley,
  59845. Jim Meehan,
  59846. Jim Michaels,
  59847. Jirka Kosek,
  59848. Jjgod Jiang,
  59849. João Eiras,
  59850. Joe Clark,
  59851. Joe Gregorio,
  59852. Joel Spolsky,
  59853. Joel Verhagen,
  59854. Johan Herland,
  59855. John Boyer,
  59856. John Bussjaeger,
  59857. John Carpenter,
  59858. John Daggett,
  59859. John Fallows,
  59860. John Foliot,
  59861. John Harding,
  59862. John Keiser,
  59863. John Snyders,
  59864. John Stockton,
  59865. John-Mark Bell,
  59866. Johnny Stenback,
  59867. Jon Ferraiolo,
  59868. Jon Gibbins,
  59869. Jon Perlow,
  59870. Jonas Sicking,
  59871. Jonathan Cook,
  59872. Jonathan Rees,
  59873. Jonathan Watt,
  59874. Jonathan Worent,
  59875. Jonny Axelsson,
  59876. Jordan Tucker,
  59877. Jorgen Horstink,
  59878. Jorunn Danielsen Newth,
  59879. Joseph Kesselman,
  59880. Joseph Mansfield,
  59881. Joseph Pecoraro,
  59882. Josh Aas,
  59883. Josh Hart,
  59884. Josh Levenberg,
  59885. Joshua Bell,
  59886. Joshua Randall,
  59887. Jukka K. Korpela,
  59888. Jules Clément-Ripoche,
  59889. Julian Reschke,
  59890. Jürgen Jeka,
  59891. Justin Lebar,
  59892. Justin Novosad,
  59893. Justin Schuh,
  59894. Justin Sinclair,
  59895. Ka-Sing Chou,
  59896. Kai Hendry,
  59897. 呂康豪 (KangHao Lu),
  59898. Kartikaya Gupta,
  59899. Kathy Walton,
  59900. Kelly Ford,
  59901. Kelly Norton,
  59902. Kevin Benson,
  59903. Kevin Gadd,
  59904. Kevin Cole,
  59905. Kornél Pál,
  59906. Kornel Lesinski,
  59907. Kris Northfield,
  59908. Kristof Zelechovski,
  59909. Krzysztof Maczyński,
  59910. 黒澤剛志 (Kurosawa Takeshi),
  59911. Kyle Barnhart,
  59912. Kyle Hofmann,
  59913. Kyle Huey,
  59914. Léonard Bouchet,
  59915. Léonie Watson,
  59916. Lachlan Hunt,
  59917. Larry Masinter,
  59918. Larry Page,
  59919. Lars Gunther,
  59920. Lars Solberg,
  59921. Laura Carlson,
  59922. Laura Granka,
  59923. Laura L. Carlson,
  59924. Laura Wisewell,
  59925. Laurens Holst,
  59926. Lawrence Forooghian,
  59927. Lee Kowalkowski,
  59928. Leif Halvard Silli,
  59929. Leif Kornstaedt,
  59930. Lenny Domnitser,
  59931. Leonard Rosenthol,
  59932. Leons Petrazickis,
  59933. Lobotom Dysmon,
  59934. Logan,
  59935. Loune,
  59936. Łukasz Pilorz,
  59937. Luke Kenneth Casson Leighton,
  59938. Maciej Stachowiak,
  59939. Magnus Kristiansen,
  59940. Maik Merten,
  59941. Malcolm Rowe,
  59942. Manish Tripathi,
  59943. Marc Hoyois,
  59944. Marcus Bointon,
  59945. Mark Birbeck,
  59946. Mark Davis,
  59947. Mark Miller,
  59948. Mark Nottingham,
  59949. Mark Pilgrim,
  59950. Mark Rowe,
  59951. Mark Schenk,
  59952. Mark Vickers,
  59953. Mark Wilton-Jones,
  59954. Martijn Wargers,
  59955. Martin Atkins,
  59956. Martin Dürst,
  59957. Martin Honnen,
  59958. Martin Janecke,
  59959. Martin Kutschker,
  59960. Martin Nilsson,
  59961. Martin Thomson,
  59962. Masataka Yakura,
  59963. Masatoshi Kimura,
  59964. Mason Mize,
  59965. Mathias Bynens,
  59966. Mathieu Henri,
  59967. Matias Larsson,
  59968. Matt Falkenhagen,
  59969. Matt Schmidt,
  59970. Matt Wright,
  59971. Matthew Gregan,
  59972. Matthew Mastracci,
  59973. Matthew Noorenberghe,
  59974. Matthew Raymond,
  59975. Matthew Thomas,
  59976. Mattias Waldau,
  59977. Max Romantschuk,
  59978. Menachem Salomon,
  59979. Menno van Slooten,
  59980. Micah Dubinko,
  59981. Michael 'Ratt' Iannarelli,
  59982. Michael A. Nachbaur,
  59983. Michael A. Puls II,
  59984. Michael Carter,
  59985. Michael Daskalov,
  59986. Michael Day,
  59987. Michael Dyck,
  59988. Michael Enright,
  59989. Michael Gratton,
  59990. Michael Nordman,
  59991. Michael Powers,
  59992. Michael Rakowski,
  59993. Michael(tm) Smith,
  59994. Michael Walmsley,
  59995. Michal Zalewski,
  59996. Michel Fortin,
  59997. Michelangelo De Simone,
  59998. Michiel van der Blonk,
  59999. Mihai Şucan,
  60000. Mihai Parparita,
  60001. Mike Brown,
  60002. Mike Dierken,
  60003. Mike Dixon,
  60004. Mike Hearn,
  60005. Mike Schinkel,
  60006. Mike Shaver,
  60007. Mikko Rantalainen,
  60008. Mohamed Zergaoui,
  60009. Mohammad Al Houssami,
  60010. Mounir Lamouri,
  60011. Ms2ger,
  60012. Nadia Heninger,
  60013. NARUSE Yui,
  60014. Neil Deakin,
  60015. Neil Rashbrook,
  60016. Neil Soiffer,
  60017. Nicholas Shanks,
  60018. Nicholas Stimpson,
  60019. Nicholas Zakas,
  60020. Nickolay Ponomarev,
  60021. Nicolas Gallagher,
  60022. Noah Mendelsohn,
  60023. Noah Slater,
  60024. Noel Gordon,
  60025. Nolan Waite,
  60026. NoozNooz42,
  60027. Norbert Lindenberg,
  60028. Ojan Vafai,
  60029. Olaf Hoffmann,
  60030. Olav Junker Kjær,
  60031. Oldřich Vetešník,
  60032. Oli Studholme,
  60033. Oliver Hunt,
  60034. Oliver Rigby,
  60035. Olivier Gendrin,
  60036. Olli Pettay,
  60037. oSand,
  60038. Pablo Flouret,
  60039. Patrick Garies,
  60040. Patrick H. Lauke,
  60041. Patrik Persson,
  60042. Paul Adenot,
  60043. Paul Norman,
  60044. Per-Erik Brodin,
  60045. Perry Smith,
  60046. Peter Beverloo,
  60047. Peter Karlsson,
  60048. Peter Kasting,
  60049. Peter Moulder,
  60050. Peter Occil,
  60051. Peter Stark,
  60052. Peter Van der Beken,
  60053. Peter-Paul Koch,
  60054. Phil Pickering,
  60055. Philip Jägenstedt,
  60056. Philip Taylor,
  60057. Philip TAYLOR,
  60058. Philippe De Ryck,
  60059. Prateek Rungta,
  60060. Pravir Gupta,
  60061. 李普君 (Pujun Li),
  60062. Rachid Finge,
  60063. Rafael Weinstein,
  60064. Rafał Miłecki,
  60065. Raj Doshi,
  60066. Rajas Moonka,
  60067. Ralf Stoltze,
  60068. Ralph Giles,
  60069. Raphael Champeimont,
  60070. Remci Mizkur,
  60071. Remco,
  60072. Remy Sharp,
  60073. Rene Saarsoo,
  60074. Rene Stach,
  60075. Ric Hardacre,
  60076. Rich Clark,
  60077. Rich Doughty,
  60078. Richard Ishida,
  60079. Rigo Wenning,
  60080. Rikkert Koppes,
  60081. Rimantas Liubertas,
  60082. Riona Macnamara,
  60083. Rob Ennals,
  60084. Rob Jellinghaus,
  60085. Rob S,
  60086. Robert Blaut,
  60087. Robert Collins,
  60088. Robert Kieffer,
  60089. Robert Millan,
  60090. Robert O'Callahan,
  60091. Robert Sayre,
  60092. Robin Berjon,
  60093. Robin Schaufler,
  60094. Rodger Combs,
  60095. Roland Steiner,
  60096. Roma Matusevich,
  60097. Roman Ivanov,
  60098. Roy Fielding,
  60099. Ruud Steltenpool,
  60100. Ryan King,
  60101. Ryosuke Niwa,
  60102. S. Mike Dierken,
  60103. Salvatore Loreto,
  60104. Sam Dutton,
  60105. Sam Kuper,
  60106. Sam Ruby,
  60107. Sam Weinig,
  60108. Samuel Bronson,
  60109. Samy Kamkar,
  60110. Sander van Lambalgen,
  60111. Sanjoy Pal,
  60112. Sarven Capadisli,
  60113. Scott González,
  60114. Scott Hess,
  60115. Sean Fraser,
  60116. Sean Hayes,
  60117. Sean Hogan,
  60118. Sean Knapp,
  60119. Sebastian Markbåge,
  60120. Sebastian Schnitzenbaumer,
  60121. Seth Call,
  60122. Seth Dillingham,
  60123. Shannon Moeller,
  60124. Shanti Rao,
  60125. Shaun Inman,
  60126. Shiki Okasaka,
  60127. Sierk Bornemann,
  60128. Sigbjørn Finne,
  60129. Sigbjørn Vik,
  60130. Silver Ghost,
  60131. Silvia Pfeiffer,
  60132. Šime Vidas,
  60133. Simon Montagu,
  60134. Simon Pieters,
  60135. Simon Spiegel,
  60136. skeww,
  60137. Smylers,
  60138. Stanton McCandlish,
  60139. Stefan Håkansson,
  60140. Stefan Haustein,
  60141. Stefan Santesson,
  60142. Stefan Weiss,
  60143. Steffen Meschkat,
  60144. Stephen Ma,
  60145. Stephen White,
  60146. Steve Comstock,
  60147. Steve Faulkner,
  60148. Steve Runyon,
  60149. Steven Bennett,
  60150. Steven Garrity,
  60151. Steven Tate,
  60152. Stewart Brodie,
  60153. Stuart Ballard,
  60154. Stuart Langridge,
  60155. Stuart Parmenter,
  60156. Subramanian Peruvemba,
  60157. Sunava Dutta,
  60158. Susan Borgrink,
  60159. Susan Lesch,
  60160. Sylvain Pasche,
  60161. T. J. Crowder,
  60162. Tab Atkins,
  60163. Takeshi Yoshino,
  60164. <span lang=tr>Tantek Çelik</span>,
  60165. 田村健人 (TAMURA Kent),
  60166. Ted Mielczarek,
  60167. Terrence Wood,
  60168. Thijs van der Vossen,
  60169. Thomas Broyer,
  60170. Thomas Koetter,
  60171. Thomas O'Connor,
  60172. Tim Altman,
  60173. Tim Johansson,
  60174. TJ VanToll,
  60175. Toby Inkster,
  60176. Todd Moody,
  60177. Tom Baker,
  60178. Tom Pike,
  60179. Tommy Thorsen,
  60180. Tony Ross,
  60181. Travis Leithead,
  60182. Trevor Saunders,
  60183. Tyler Close,
  60184. Victor Carbune,
  60185. Vipul Snehadeep Chawathe,
  60186. Vitya Muhachev,
  60187. Vladimir Katardjiev,
  60188. Vladimir Vukićević,
  60189. voracity,
  60190. Wakaba,
  60191. Wayne Carr,
  60192. Wayne Pollock,
  60193. Wellington Fernando de Macedo,
  60194. Weston Ruter,
  60195. Wilhelm Joys Andersen,
  60196. Will Levine,
  60197. William Chen,
  60198. William Swanson,
  60199. Wladimir Palant,
  60200. Wojciech Mach,
  60201. Wolfram Kriesing,
  60202. Xan Gregg,
  60203. Yang Chen,
  60204. Ye-Kui Wang,
  60205. Yehuda Katz,
  60206. Yi-An Huang,
  60207. Yngve Nysaeter Pettersen,
  60208. Yonathan Randolph,
  60209. Yuzo Fujishima,
  60210. Zhenbin Xu,
  60211. Zoltan Herczeg,
  60212. and
  60213. Øistein E. Andersen,
  60214. for their useful comments, both large and small, that have led to changes to this specification
  60215. over the years.</p>
  60216. <p>Thanks also to everyone who has ever posted about HTML to their blogs, public mailing lists, or
  60217. forums, including all the contributors to the <a href=http://www.w3.org/html/wg/lists/>various
  60218. W3C HTML WG lists</a> and the <a href=//www.whatwg.org/mailing-list>various WHATWG
  60219. lists</a>.
  60220. <p>Special thanks to Richard Williamson for creating the first implementation of
  60221. <code id=acknowledgements:the-canvas-element><a href=#the-canvas-element>canvas</a></code> in Safari, from which the canvas feature was designed.</p>
  60222. <p>Special thanks also to the Microsoft employees who first implemented the event-based
  60223. drag-and-drop mechanism, <code id=acknowledgements:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>, and other
  60224. features first widely deployed by the Windows Internet Explorer browser.</p>
  60225. <p>Special thanks and $10,000 to David Hyatt who came up with a broken implementation
  60226. of the <a href=#adoptionAgency>adoption agency algorithm</a> that the editor had to reverse
  60227. engineer and fix before using it in the parsing section.</p>
  60228. <p>Thanks to the participants of the microdata usability study for allowing us to use their
  60229. mistakes as a guide for designing the microdata feature.</p>
  60230. <p>Thanks to the many sources that provided inspiration for the examples used in the
  60231. specification.</p>
  60232. <p>Thanks also to the Microsoft blogging community for some ideas, to the attendees of the W3C
  60233. Workshop on Web Applications and Compound Documents for inspiration, to the #mrt crew, the #mrt.no
  60234. crew, and the #whatwg crew, and to Pillar and Hedral for their ideas and support.</p>
  60235. <p>Thanks to Igor Zhbanov for generating PDF versions of the specification.</p>
  60236. <p>This specification is written by Ian Hickson (Google, ian@hixie.ch), with contributions from
  60237. Simon Pieters (Opera, simonp@opera.com) in the <code id=acknowledgements:the-img-element><a href=#the-img-element>img</a></code> section.</p>
  60238. <div itemtype=http://n.whatwg.org/work itemscope="">
  60239. <p>The image in the introduction is based on <a itemprop=work href=http://www.flickr.com/photos/wonderlane/2986252088/>a photo</a>
  60240. by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/wonderlane/>Wonderlane</a>.
  60241. (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
  60242. </div>
  60243. <div itemtype=http://n.whatwg.org/work itemscope="">
  60244. <p>The image of two cute kittens in a basket used in the context menu example is based on
  60245. <a itemprop=work href=http://www.flickr.com/photos/digidreamgrafix/8370087640/>a photo</a>
  60246. by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/digidreamgrafix/>Alex G</a>.
  60247. (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
  60248. </div>
  60249. <div itemtype=http://n.whatwg.org/work itemscope="">
  60250. <p>The Blue Robot Player sprite used in the canvas demo is based on
  60251. <a itemprop=work href=http://johncolburn.deviantart.com/art/Blue-Robot-Player-Sprite-323813997>a work</a> by
  60252. <a itemprop=http://creativecommons.org/ns#attributionURL href=http://johncolburn.deviantart.com/>JohnColburn</a>.
  60253. (<a itemprop=license href=http://creativecommons.org/licenses/by-sa/3.0/>CC BY-SA 3.0</a>)</p>
  60254. </div>
  60255. <div itemtype=http://n.whatwg.org/work itemscope="">
  60256. <p>The photograph of robot 148 climbing the tower at the FIRST Robotics Competition 2013 Silicon Valley Regional is based on
  60257. <a itemprop=work href=http://www.flickr.com/photos/lenore-m/8631391979/>a work</a> by
  60258. <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/lenore-m/>Lenore Edman</a>.
  60259. (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)</p>
  60260. </div>
  60261. <p>Parts of this specification are © Copyright 2004-2014 Apple Inc., Mozilla Foundation, and
  60262. Opera Software ASA. You are granted a license to use, reproduce and create derivative works of
  60263. this document.</p>